blob: 5ac23f9cd806e70d6d892332bd10b0208a895c02 [file] [log] [blame]
2021-10-16 Lauro Moura <lmoura@igalia.com>
[GTK4] Update signal name to monitor window resize
https://bugs.webkit.org/show_bug.cgi?id=231854
Reviewed by Carlos Garcia Campos.
Using size-changed (previous signal name) makes the MiniBrowser crash
running the WebDriver tests.
The signal name was changed in
https://gitlab.gnome.org/GNOME/gtk/-/commit/b7380543449ea679a2c912b66aab4855b2bb41f2,
as part of GTK 3.99.5.
Covered by existing tests.
* UIProcess/API/glib/WebKitUIClient.cpp:
2021-10-15 Alex Christensen <achristensen@webkit.org>
Start using adattributiond on iOS
https://bugs.webkit.org/show_bug.cgi?id=231829
Reviewed by Brady Eidson.
This makes one small change to use adattributiond on iOS by default instead of the network process.
The rest of this patch is to keep the tests doing what they used to.
* UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
(WKWebsiteDataStoreConfigurationCopyPCMMachServiceName):
(WKWebsiteDataStoreConfigurationSetPCMMachServiceName):
* UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
2021-10-15 Alex Christensen <achristensen@webkit.org>
Use attributedBundleIdentifier instead of applicationBundleIdentifier when present for handling PCM attribution
https://bugs.webkit.org/show_bug.cgi?id=231827
Reviewed by Brady Eidson.
This is the same identifier that SafariViewController uses in _setEphemeralUIEventAttribution:forApplicationWithBundleID:
If we don't do this, then SafariViewController looks in the database for PCMs from com.apple.SafariViewService and doesn't find any and doesn't send any reports.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::attributedBundleIdentifier):
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::attributedBundleIdentifier):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
* NetworkProcess/NetworkSession.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:ephemeral:]):
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:]): Deleted.
2021-10-15 Per Arne Vollan <pvollan@apple.com>
[macOS] Add telemetry for system calls in WP
https://bugs.webkit.org/show_bug.cgi?id=231836
<rdar://problem/84317842>
Reviewed by Brent Fulgham.
Add telemetry for system calls in WP to understand in which context they are being used.
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-15 Ross Kirsling <ross.kirsling@sony.com>
Realize Mac CMake build of WebCore and WebKit
https://bugs.webkit.org/show_bug.cgi?id=231749
Reviewed by Alex Christensen.
* CMakeLists.txt:
* PlatformMac.cmake:
2021-10-15 Eric Carlson <eric.carlson@apple.com>
[iOS] Support getDisplayMedia
https://bugs.webkit.org/show_bug.cgi?id=231455
<rdar://problem/84044495>
Reviewed by Youenn Fablet and Jer Noble.
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::alertMessageText): Add text for default screen capture prompt.
(WebKit::allowButtonText): Ditto.
(WebKit::doNotAllowButtonText): Ditto.
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Call
default getDisplayMedia prompt if the delegate doesn't implement the private
prompt selector.
* UIProcess/MediaPermissionUtilities.h:
* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::promptForGetDisplayMedia): New default
getDisplayMedia prompt.
(WebKit::UserMediaPermissionRequestProxy::promptForGetUserMedia):
(WebKit::UserMediaPermissionRequestProxy::doDefaultAction): Call promptForGetDisplayMedia
or promptForGetUserMedia according to the request type.
(WebKit::UserMediaPermissionRequestProxy::canPromptForGetDisplayMedia):
(WebKit::UserMediaPermissionRequestProxy::prompt): Deleted.
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::doDefaultAction): Deleted.
2021-10-15 Jer Noble <jer.noble@apple.com>
[iOS] Screen Sharing doesn't switch to AirPlay when <video> enters fullscreen mode
https://bugs.webkit.org/show_bug.cgi?id=231807
<rdar://82995799>
Reviewed by Eric Carlson.
WebKit will allow AVPlayer to switch to AirPlay Video mode from Screen Sharing when a
<video> element is in fullscreen mode. However, the fullscreen state this code depends on
is not stored in the GPU process.
Implement RemoteMediaPlayerProxy::mediaPlayerFullscreenMode()
and ::mediaPlayerIsVideoFullscreenStandby().
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setVideoFullscreenMode):
(WebKit::RemoteMediaPlayerProxy::videoFullscreenStandbyChanged):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerFullscreenMode const):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerIsVideoFullscreenStandby const):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::videoFullscreenStandbyChanged):
2021-10-15 Per Arne Vollan <pvollan@apple.com>
Some canvas tests are failing
https://bugs.webkit.org/show_bug.cgi?id=231837
<rdar://problem/84318280>
Reviewed by Brent Fulgham.
To be able to receive the Launch Services database over XPC, a Network process XPC endpoint has to be sent to the
GPU process. This was being sent in GPUProcessProxy::didFinishLaunching, but since the session ID and Website data
store is not always available there, it was sometimes not being sent. Instead, send the endpoint in
GPUProcessProxy::addSession, where the Website data store is always available.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::didFinishLaunching):
(WebKit::GPUProcessProxy::addSession):
2021-10-15 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r283925.
https://bugs.webkit.org/show_bug.cgi?id=231839
Incorrect
Reverted changeset:
"[macOS] Grant access in sandbox to 'system-privilege' for
root"
https://bugs.webkit.org/show_bug.cgi?id=231501
https://commits.webkit.org/r283925
2021-10-15 Ryan Haddad <ryanhaddad@apple.com>
Explicitly link adattributiond with Foundation and CoreFoundation
https://bugs.webkit.org/show_bug.cgi?id=231835
Reviewed by Brady Eidson.
Apply the same treatment to adattributiond as was done for webpushd in r284250.
* Configurations/adattributiond.xcconfig:
2021-10-15 Garrett Davidson <garrett_davidson@apple.com>
Import AuthenticationServicesCore's public module as well
https://bugs.webkit.org/show_bug.cgi?id=231806
<rdar://84299174>
Reviewed by Wenson Hsieh.
Import the public module explicitly before the private module.
* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
2021-10-15 Per Arne Vollan <pvollan@apple.com>
[macOS] Sort unix syscall list in WP sandbox
https://bugs.webkit.org/show_bug.cgi?id=231810
<rdar://problem/84305761>
Unreviewed formatting change. No change in behavior.
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-15 BJ Burg <bburg@apple.com>
[Cocoa] Web Inspector: handle Promise objects returned from evaluateScriptInExtensionTab
https://bugs.webkit.org/show_bug.cgi?id=231709
<rdar://problem/84224179>
Reviewed by Timothy Hatcher.
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
(WebKit::WebInspectorUIExtensionController::evaluateScriptInExtensionTab):
Add JSLockHolders for when we are poking at the result value.
Drive-by, fix a typo in logging code.
2021-10-15 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r284079): [Debug] IPCTestingAPI.CanReceiveSharedMemory is timing out
https://bugs.webkit.org/show_bug.cgi?id=231701
<rdar://problem/84219000>
Reviewed by Tim Horton.
Implement two new methods on JSIPCStreamClientConnection: `sendMessage()` and `sendSyncMessage()`, which can be
used to send IPC messages through the IPC stream client connection. To do this, we match the existing methods of
the same names on JSIPC by creating a message encoder and sending it over the stream connection's IPC
connection, effectively treating all IPC messages as out-of-line.
In the future, this should be changed so that we only try to send out-of-line messages if the message itself is
not stream encodable; for the time being, this at least allows us to fix the failing API test, and still makes
it possible to test sending arbitrary IPC through the connection stream, such that we'll be able to exercise
WebGL and display list IPC via these special JS IPC bindings.
* Platform/IPC/StreamClientConnection.h:
* WebProcess/WebPage/IPCTestingAPI.cpp:
Declare several static helper functions near the top of this source file, so that we can use them in
JSIPCStreamClientConnection below.
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::create):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::JSIPCStreamClientConnection):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::staticFunctions):
Drive-by fix: make the pointer from JSIPCStreamConnectionBuffer to JSIPCStreamClientConnection a WeakPtr, to
prevent the stream connection buffer from keeping the client connection alive for longer than necessary. The
JSIPCStreamConnectionBuffer is always intended to be outlived by JSIPCStreamClientConnection when using JS IPC.
(WebKit::IPCTestingAPI::extractIPCStreamMessageInfo):
Pull logic for extracting a destination ID, message name, and IPC timeout into a common helper method.
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::prepareToSendOutOfStreamMessage):
Add a helper method that encodes the given message and prepares the stream connection for sending this as an
out-of-stream message by setting the destination ID (if needed) and appending the `ProcessOutOfStreamMessage`
message to indicate that the recipient should expect an out-of-stream message.
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendMessage):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendSyncMessage):
(WebKit::IPCTestingAPI::JSIPC::createStreamClientConnection):
2021-10-15 Brent Fulgham <bfulgham@apple.com>
[macOS] Update sandboxes to support finer-grained XPC services in the media stack
https://bugs.webkit.org/show_bug.cgi?id=231782
<rdar://problem/84275671>
Reviewed by Eric Carlson.
CoreMedia is refactoring to limit the features accessible through a given XPC service.
We need to add an additional service name. This new name just exposes features already
exposed through other XPC endpoints we already allow.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in: Always allow access to the new service.
* UIProcess/WebPageProxy.cpp:
(WebKit::mediaRelatedMachServices): Updated for new service name.
* WebProcess/com.apple.WebProcess.sb.in: Conditionally consume the new extension
if the GPU process is turned off.
2021-10-15 Kate Cheney <katherine_cheney@apple.com>
Unreviewed maccatalyst build fix.
* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setTCCIdentity):
2021-10-15 Alex Christensen <achristensen@webkit.org>
Explicitly link webpushd with Foundation and CoreFoundation
https://bugs.webkit.org/show_bug.cgi?id=231808
<rdar://84302128>
Reviewed by Brady Eidson.
There is a build environment where the linker can't find a bunch of symbols from Foundation and CoreFoundation.
This should fix that build.
* Configurations/webpushd.xcconfig:
2021-10-15 Per Arne <pvollan@apple.com>
[iOS][GPUP] Block access to Launch Services Database service
https://bugs.webkit.org/show_bug.cgi?id=231504
<rdar://problem/84091679>
Reviewed by Brent Fulgham.
After <https://commits.webkit.org/242382@main>, access to this service is no longer required.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-10-15 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, revert an unintentional sandbox change in r284079
I accidentally included the below change as a part of r284079, since it was necessary in order to avoid several
layout test failures on macOS Monterey:
- fast/canvas/toDataURL-supportedTypes.html
- fast/canvas/canvas-blending-image-over-image.html
- fast/canvas/canvas-blending-image-over-gradient.html
- fast/canvas/canvas-blending-image-over-color.html
- fast/canvas/toDataURL-not-empty.html
...but forgot to revert this change when landing the final patch.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-10-15 Brady Eidson <beidson@apple.com>
WebKit Managed Notifications: Skeleton NotificationProvider.
<rdar://84275562> and https://bugs.webkit.org/show_bug.cgi?id=231786
Reviewed by Alex Christensen.
No new tests (No behavior change yet)
Currently WebNotificationManagerProxy manages dispatching out stuff to the NotificationProvider SPI
that - for example - Safari on Mac implements.
The interface between the ManagerProxy and the Provider is already the perfect way to add an alternative behavior.
This introduces the skeleton class of an alternative NotificationProvider that will eventually implement
WebKit-managed notifications.
While under development it will have a global runtime switch so we can A/B test between the client-managed and
WebKit-managed notifications. That switch would eventually be replaced by full compile-time behavior which would
be decided by a shipping vendor.
Note: This patch enables the new flag BUILT_IN_NOTIFICATIONS to get the new mechanisms building, but that flag by
itself doesn't expose Notifications interfaces in WebCore.
That will still require enabling NOTIFICATIONS separately.
* SourcesCocoa.txt:
* UIProcess/API/APINotificationProvider.h:
(API::NotificationProvider::isClientReplaceable const): A temporary mechanism to prevent API clients from overriding
the built-in NotificationProvider if the feature is enabled. Useful right now because existing Safari does that with existing SPI.
* UIProcess/API/APIUIClient.h:
(API::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
* UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.h: Copied from Source/WebKit/UIProcess/API/APINotificationProvider.h.
* UIProcess/Notifications/Cocoa/WebNotificationProviderCocoa.mm: Added.
(WebKit::WebNotificationProviderCocoa::createIfEnabled):
(WebKit::WebNotificationProviderCocoa::WebNotificationProviderCocoa):
(WebKit::WebNotificationProviderCocoa::show):
(WebKit::WebNotificationProviderCocoa::cancel):
(WebKit::WebNotificationProviderCocoa::didDestroyNotification):
(WebKit::WebNotificationProviderCocoa::clearNotifications):
(WebKit::WebNotificationProviderCocoa::addNotificationManager):
(WebKit::WebNotificationProviderCocoa::removeNotificationManager):
(WebKit::WebNotificationProviderCocoa::notificationPermissions):
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::WebNotificationManagerProxy::WebNotificationManagerProxy):
(WebKit::WebNotificationManagerProxy::setProvider):
Fix changes to the Unified Build:
* UIProcess/ios/WKHoverPlatter.h:
* UIProcess/ios/WKHoverPlatter.mm:
* WebKit.xcodeproj/project.pbxproj:
2021-10-14 Alex Christensen <achristensen@webkit.org>
Add AdAttributionDaemon plist on iOS
https://bugs.webkit.org/show_bug.cgi?id=231309
Reviewed by John Wilander.
This adds a plist that tells launchd where to find AdAttributionDaemon and how to launch it.
In another patch I'll add a change to WebsiteDataStoreConfiguration to tell WebKit to use the daemon.
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::registerScheduledActivityHandler):
* Shared/EntryPointUtilities/Cocoa/Daemon/com.apple.webkit.adattributiond.plist: Added.
* WebKit.xcodeproj/project.pbxproj:
2021-10-14 Wenson Hsieh <wenson_hsieh@apple.com>
[JS IPC] Implement a way to synchronously wait for an incoming IPC message
https://bugs.webkit.org/show_bug.cgi?id=231745
Reviewed by Tim Horton.
Add support for `IPC.waitForMessage()`, which blocks until we receive an incoming IPC message that matches the
given message name and destination ID. We use this new method to fix the failing API test
IPCTestingAPI.CanReceiveIPCSemaphore, which verifies that we're able to receive, decode, and call methods on
an IPC semaphore sent from the GPU process to the web process. In this case, we wait for the incoming
"RemoteRenderingBackendProxy::DidCreateWakeUpSemaphoreForDisplayListStream" message after creating the remote
rendering backend in the GPU process.
* Platform/IPC/Connection.h:
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::setWakeUpSemaphore):
Also add a method on JSIPCStreamClientConnection to install a given IPC semaphore as the wakeup semaphore for
the IPC stream. We'll use this in the next patch when implementing the ability to send messages through the IPC
stream.
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::staticFunctions):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::streamBuffer):
Drive-by fix: make sure we grab the VM lock before trying to unwrap JS objects.
(WebKit::IPCTestingAPI::JSIPC::staticFunctions):
(WebKit::IPCTestingAPI::JSIPC::sendMessage):
Drive-by fix: correct a minor typo in the exception message.
(WebKit::IPCTestingAPI::extractSyncIPCMessageInfo):
Pull logic for extracting an IPC::Connection, destination ID, message name, and IPC timeout into a separate
helper function, and use it in `waitForMessage` as well as `sendSyncMessage`.
(WebKit::IPCTestingAPI::JSIPC::waitForMessage):
(WebKit::IPCTestingAPI::JSIPC::sendSyncMessage):
2021-10-14 Alex Christensen <achristensen@webkit.org>
Fix build after r284216
https://bugs.webkit.org/show_bug.cgi?id=231523
* WebKit.xcodeproj/project.pbxproj:
2021-10-14 Kate Cheney <katherine_cheney@apple.com>
Adopt attribution AVCaptureSession SPI for GPU process
https://bugs.webkit.org/show_bug.cgi?id=231621
<rdar://problem/80748535>
Reviewed by Eric Carlson.
Add SPI to attribute camera access to host app in the GPU process.
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setTCCIdentity):
* Shared/Cocoa/TCCSoftLink.h:
* Shared/Cocoa/TCCSoftLink.mm:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
(WebKit::UserMediaCaptureManagerProxy::ConnectionProxy::setTCCIdentity):
* WebKit.xcodeproj/project.pbxproj:
2021-10-14 John Pascoe <j_pascoe@apple.com>
Update deleteLocalAuthenticatorCredentialWithID and setUsernameForLocalCredentialWithID according to internal needs
https://bugs.webkit.org/show_bug.cgi?id=231777
rdar://84276065
Reviewed by Brent Fulgham.
Covered by manual tests.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel deleteLocalAuthenticatorCredentialWithID:]):
(+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):
2021-10-14 Alex Christensen <achristensen@webkit.org>
Reduce memory use of AdAttributionDaemon
https://bugs.webkit.org/show_bug.cgi?id=231523
Reviewed by Brady Eidson.
* Configurations/adattributiond.xcconfig:
* Shared/API/Cocoa/WKMain.h:
* Shared/API/Cocoa/WKMain.mm:
(WKXPCServiceMain):
(WKPCMDaemonMain): Deleted.
* Shared/EntryPointUtilities/Cocoa/Daemon/adattributiond.cpp: Renamed from Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/adattributiond.c.
(main):
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-10-14 Yusuke Suzuki <ysuzuki@apple.com>
Fix build failures with newer clang
https://bugs.webkit.org/show_bug.cgi?id=231783
Reviewed by Chris Dumez.
We do not need to define copy constructor and assignment operator if we would like to use the default implementation.
The default copy constructor and assignment operator works well for TouchBarMenuItemData, so let's drop it.
* Shared/TouchBarMenuItemData.h:
2021-10-14 Peng Liu <peng.liu6@apple.com>
Promote WKPreferences._needsSiteSpecificQuirks to API
https://bugs.webkit.org/show_bug.cgi?id=230721
<rdar://83255206>
Reviewed by Jer Noble.
Add a new API `WKPreferences.isSetSiteSpecificQuirksModeEnabled`.
No new tests. Updated API tests to use the new API.
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences isSiteSpecificQuirksModeEnabled]):
(-[WKPreferences setSiteSpecificQuirksModeEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2021-10-14 Alex Christensen <achristensen@webkit.org>
Remove Variant.h
https://bugs.webkit.org/show_bug.cgi?id=231744
Reviewed by Darin Adler.
* NetworkProcess/NetworkLoadChecker.h:
* NetworkProcess/cache/NetworkCacheData.h:
* Platform/IPC/ArgumentCoders.h:
* Platform/IPC/Attachment.h:
* Platform/IPC/MessageReceiveQueueMap.h:
* Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
* Shared/WebCompiledContentRuleListData.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/wpe/TouchGestureController.h:
* UIProcess/Automation/SimulatedInputDispatcher.cpp:
* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
* UIProcess/PageClient.h:
* UIProcess/ProcessThrottler.h:
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
* WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
2021-10-14 Per Arne Vollan <pvollan@apple.com>
[macOS] Crash on WP startup
https://bugs.webkit.org/show_bug.cgi?id=231773
<rdar://84218823>
Unreviewed partial revert of https://trac.webkit.org/r283375.
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-14 Alex Christensen <achristensen@webkit.org>
Share IPC communication code between webpushd and adattributiond
https://bugs.webkit.org/show_bug.cgi?id=231718
Reviewed by Brady Eidson.
This shares enough code from adattributiond to implement a communication protocol for webpushd.
Right now the protocol only has one action, EchoTwice, which echos a WTF::String twice as its reply,
but that is just a testable behavior that will be soon replaced by more complicated and useful behaviors.
* Configurations/webpushd.xcconfig:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm:
(WebKit::PCM::addVersionAndEncodedMessageToDictionary):
* Shared/Daemon/DaemonUtilities.h: Copied from Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/webpushd.c.
* Shared/Daemon/DaemonUtilities.mm: Added.
(WebKit::startListeningForMachServiceConnections):
(WebKit::vectorToXPCData):
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::connectionAdded):
(WebKit::connectionRemoved):
(WebKit::PCMDaemonMain):
(WebKit::startListeningForMachServiceConnections): Deleted.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* webpushd/WebPushDaemonMain.mm: Added.
(WebPushD::CompletionHandler<void):
(WebPushD::echoTwice):
(WebPushD::decodeMessageAndSendReply):
(WebPushD::connectionEventHandler):
(WebPushD::connectionAdded):
(WebPushD::connectionRemoved):
(main):
2021-10-14 Wenson Hsieh <wenson_hsieh@apple.com>
[JS IPC] Make it possible to establish a stream connection using the JS IPC testing API
https://bugs.webkit.org/show_bug.cgi?id=231710
Reviewed by Tim Horton.
Work towards fixing IPCTestingAPI.CanReceiveIPCSemaphore and IPCTestingAPI.CanReceiveSharedMemory, which broke
after I refactored RemoteRenderingBackend to be a IPC stream message receiver (instead of a standard IPC message
receiver). To achieve this, we introduce two new JS wrapper objects to encapsulate an IPC stream client
connection, as well as the stream buffer used to service that connection.
This allows us to establish a streaming IPC connection from the web process to the GPU process via JS IPC API,
like so:
```
const bufferSize = 1 << 16;
const streamConnection = IPC.createStreamClientConnection('GPU', bufferSize);
IPC.sendMessage('GPU', 0, IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, [
{ type: 'RemoteRenderingBackendCreationParameters', 'identifier': 123, 'pageProxyID': IPC.webPageProxyID, 'pageID': IPC.pageID },
{ type: 'StreamConnectionBuffer', value: streamConnection.streamBuffer() }
]);
```
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::create):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::connection):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::JSIPCStreamClientConnection):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::create):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::encode const):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::JSIPCStreamConnectionBuffer):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::createJSWrapper):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::wrapperClass):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::unwrap):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::toWrapped):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::initialize):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::finalize):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::staticFunctions):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::streamBuffer):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::createJSWrapper):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::wrapperClass):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::unwrap):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::toWrapped):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::initialize):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::finalize):
(WebKit::IPCTestingAPI::JSIPCStreamConnectionBuffer::staticFunctions):
(WebKit::IPCTestingAPI::JSIPC::staticFunctions):
(WebKit::IPCTestingAPI::encodeStreamConnectionBuffer):
(WebKit::IPCTestingAPI::encodeArgument):
(WebKit::IPCTestingAPI::JSIPC::createStreamClientConnection):
2021-10-14 Timothy Hatcher <timothy@apple.com>
Null check the context in -[WKWebProcessPlugInFrame jsContextForServiceWorkerWorld:]
https://bugs.webkit.org/show_bug.cgi?id=231758
Reviewed by Chris Dumez.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(-[WKWebProcessPlugInFrame jsContextForServiceWorkerWorld:]):
_frame->jsContextForServiceWorkerWorld() can return nullptr, so null check before using the result.
2021-10-14 Myles C. Maxfield <mmaxfield@apple.com>
All the SDKVariant.xcconfig files should match
https://bugs.webkit.org/show_bug.cgi?id=231663
Reviewed by Youenn Fablet.
* Configurations/SDKVariant.xcconfig:
2021-10-14 Chris Dumez <cdumez@apple.com>
[WKWebView _loadServiceWorkerURL] ends up lowercasing URL host
https://bugs.webkit.org/show_bug.cgi?id=231742
Reviewed by Timothy Hatcher.
[WKWebView _loadServiceWorkerURL] ends up lowercasing URL host. While I don't think it is technically wrong
(hosts should not be case-sensitive), it can be confusing.
The reason this was happening is that I was using SecurityOriginData::fromURL(url).toString() to extract the
URL's scheme/host/port and SecurityOriginData::fromURL() lowercases the scheme and host. I am now using
URL::protocolHostAndPort() instead, which does not have this side effect and is actually more efficient.
No new tests, extended existing API test.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadServiceWorker):
2021-10-14 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Move getCurrentExecutablePath() and getCurrentExecutableName() to FileSystem
https://bugs.webkit.org/show_bug.cgi?id=231732
Reviewed by Michael Catanzaro.
* Shared/glib/ProcessExecutablePathGLib.cpp:
(WebKit::getExecutablePath):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bubblewrapSpawn):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2021-10-13 Chris Dumez <cdumez@apple.com>
Drop makeWeakPtr() and use WeakPtr { } directly
https://bugs.webkit.org/show_bug.cgi?id=231679
Reviewed by Darin Adler.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::GPUConnectionToWebProcess):
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
* GPUProcess/media/RemoteAudioHardwareListenerProxy.cpp:
(WebKit::RemoteAudioHardwareListenerProxy::RemoteAudioHardwareListenerProxy):
* GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
* GPUProcess/media/RemoteCDMFactoryProxy.cpp:
(WebKit::RemoteCDMFactoryProxy::RemoteCDMFactoryProxy):
(WebKit::RemoteCDMFactoryProxy::createCDM):
* GPUProcess/media/RemoteCDMInstanceProxy.cpp:
(WebKit::RemoteCDMInstanceProxy::RemoteCDMInstanceProxy):
(WebKit::RemoteCDMInstanceProxy::createSession):
* GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp:
(WebKit::RemoteCDMInstanceSessionProxy::create):
* GPUProcess/media/RemoteCDMProxy.cpp:
(WebKit::RemoteCDMProxy::createInstance):
* GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::RemoteImageDecoderAVFProxy):
* GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp:
(WebKit::RemoteLegacyCDMFactoryProxy::RemoteLegacyCDMFactoryProxy):
(WebKit::RemoteLegacyCDMFactoryProxy::createCDM):
* GPUProcess/media/RemoteLegacyCDMProxy.cpp:
(WebKit::RemoteLegacyCDMProxy::createSession):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy):
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy):
(WebKit::RemoteMediaPlayerProxy::setLegacyCDMSession):
* GPUProcess/media/RemoteMediaResource.cpp:
(WebKit::RemoteMediaResource::RemoteMediaResource):
* GPUProcess/media/RemoteMediaResourceLoader.cpp:
(WebKit::RemoteMediaResourceLoader::RemoteMediaResourceLoader):
* GPUProcess/media/RemoteMediaSourceProxy.cpp:
(WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy):
* GPUProcess/media/RemoteRemoteCommandListenerProxy.cpp:
(WebKit::RemoteRemoteCommandListenerProxy::RemoteRemoteCommandListenerProxy):
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy):
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy):
* GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
* NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
(-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]):
* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::NetworkDataTask):
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::startWithScheduling):
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
(WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::sendDidReceiveResponsePotentiallyInNewBrowsingContextGroup):
* NetworkProcess/NetworkSocketChannel.cpp:
(WebKit::NetworkSocketChannel::NetworkSocketChannel):
* NetworkProcess/NetworkStorageSessionProvider.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp:
(WebKit::PCM::ClientImpl::ClientImpl):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp:
(WebKit::PCM::ConnectionToMachService::ConnectionToMachService):
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementConnectionCocoa.mm:
(WebKit::PCM::ConnectionToMachService::initializeConnectionIfNeeded const):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):
(WebKit::ServiceWorkerFetchTask::start):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
(WebKit::WebSWServerToContextConnection::registerFetch):
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::StorageArea):
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::connectToLocalStorageArea):
(WebKit::StorageManagerSet::connectToTransientLocalStorageArea):
(WebKit::StorageManagerSet::connectToSessionStorageArea):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::Engine):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(WebKit::NetworkDataTaskCocoa::swapSessionIfNecessary):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate initWithNetworkSession:wrapper:withCredentials:]):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(WebKit::NetworkSessionCocoa::createWebSocketTask):
(WebKit::NetworkSessionCocoa::addWebPageNetworkParameters):
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::FileSystemStorageHandle):
* NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp:
(WebKit::FileSystemStorageHandleRegistry::registerHandle):
* Platform/IPC/Connection.cpp:
(IPC::Connection::addMessageObserver):
* Platform/IPC/MessageReceiverMap.cpp:
(IPC::MessageReceiverMap::addMessageReceiver):
* Platform/cocoa/WKPaymentAuthorizationDelegate.mm:
(-[WKPaymentAuthorizationDelegate _initWithRequest:presenter:]):
* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
* Shared/WebSQLiteDatabaseTracker.h:
* Shared/XR/XRDeviceProxy.cpp:
(WebKit::XRDeviceProxy::XRDeviceProxy):
* Shared/mac/SecItemShim.cpp:
(WebKit::initializeSecItemShim):
* UIProcess/API/APIAttachment.cpp:
(API::Attachment::Attachment):
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::HTTPCookieStore):
(API::HTTPCookieStore::registerObserver):
* UIProcess/API/APIInspectorExtension.cpp:
(API::InspectorExtension::InspectorExtension):
* UIProcess/API/APIWebAuthenticationPanel.cpp:
(API::WebAuthenticationPanel::WebAuthenticationPanel):
(API::WebAuthenticationPanel::handleRequest):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _removeDataDetectedLinks:]):
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKMediaSessionCoordinatorHelper initWithCoordinator:]):
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel setDelegate:]):
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _detectDataWithTypes:completionHandler:]):
* UIProcess/Cocoa/GroupActivities/GroupActivitiesCoordinator.mm:
(-[WKGroupActivitiesCoordinatorDelegate initWithParent:]):
* UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
(-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationState):
(WebKit::NavigationState::NavigationClient::NavigationClient):
(WebKit::tryInterceptNavigation):
(WebKit::NavigationState::HistoryClient::HistoryClient):
* UIProcess/Cocoa/SOAuthorization/PopUpSOAuthorizationSession.mm:
(-[WKSOSecretDelegate initWithSession:]):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::SOAuthorizationSession):
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::ContextMenuClient::ContextMenuClient):
(WebKit::UIDelegate::UIClient::UIClient):
(WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::grantAccess):
(WebKit::WebPasteboardProxy::didModifyContentsOfPasteboard):
(WebKit::WebPasteboardProxy::PasteboardAccessInformation::grantAccess):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::setMediaAccessibilityPreferences):
(WebKit::WebProcessPool::registerNotificationObservers):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKDOMPasteMenuDelegate initWithWebViewImpl:]):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::DownloadProxy):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::getOrCreate):
* UIProcess/Inspector/InspectorTargetProxy.cpp:
(WebKit::InspectorTargetProxy::create):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::WebInspectorUIExtensionControllerProxy):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::RemoteMediaSessionCoordinatorProxy):
* UIProcess/MediaKeySystemPermissionRequestProxy.cpp:
(WebKit::MediaKeySystemPermissionRequestProxy::MediaKeySystemPermissionRequestProxy):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::XPCEventHandler::XPCEventHandler):
* UIProcess/PDF/WKPDFHUDView.mm:
(-[WKPDFHUDView initWithFrame:pluginIdentifier:page:]):
* UIProcess/SpeechRecognitionPermissionRequest.h:
(WebKit::SpeechRecognitionPermissionRequest::SpeechRecognitionPermissionRequest):
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSource.cpp:
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp:
(WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource):
* UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::setAlternateBackForwardListSourcePage):
* UIProcess/WebAuthentication/Authenticator.h:
(WebKit::Authenticator::setObserver):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::runPanel):
(WebKit::AuthenticatorManager::dispatchPanelClientCall const):
* UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
(WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
* UIProcess/WebAuthentication/Cocoa/AuthenticatorPresenterCoordinator.mm:
(WebKit::AuthenticatorPresenterCoordinator::AuthenticatorPresenterCoordinator):
* UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
(WebKit::NfcConnection::NfcConnection):
* UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm:
(-[WKASCAuthorizationPresenterDelegate initWithCoordinator:]):
* UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm:
(-[WKNFReaderSessionDelegate initWithConnection:]):
* UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm:
(WebKit::WebAuthenticatorCoordinatorProxy::performRequest):
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
* UIProcess/WebAuthentication/fido/FidoService.cpp:
(WebKit::FidoService::getInfo):
* UIProcess/WebContextMenuListenerProxy.cpp:
(WebKit::WebContextMenuListenerProxy::WebContextMenuListenerProxy):
* UIProcess/WebContextMenuProxy.cpp:
(WebKit::WebContextMenuProxy::WebContextMenuProxy):
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::WebCookieManagerProxy):
* UIProcess/WebDataListSuggestionsDropdown.cpp:
(WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
* UIProcess/WebDateTimePicker.cpp:
(WebKit::WebDateTimePicker::WebDateTimePicker):
* UIProcess/WebEditCommandProxy.cpp:
(WebKit::WebEditCommandProxy::WebEditCommandProxy):
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::WebFrameProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::PageClientProtector::PageClientProtector):
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::addObserver):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::getGPUProcessConnection):
(WebKit::WebProcessPool::getWebAuthnProcessConnection):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::createWebPage):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::createSpeechRecognitionServer):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::WeakOrStrongPtr::WeakOrStrongPtr):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
* UIProcess/gtk/WaylandCompositor.cpp:
(WebKit::WaylandCompositor::Surface::attachBuffer):
(WebKit::WaylandCompositor::bindSurfaceToWebPage):
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsControl showSuggestionsDropdown:activationType:]):
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::setImpl):
* UIProcess/mac/WKRevealItemPresenter.mm:
(-[WKRevealItemPresenter initWithWebViewImpl:item:frame:menuLocation:]):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
(WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem):
* UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
(-[WKDataListSuggestionsController showSuggestionsDropdown:]):
* UIProcess/mac/WebDateTimePickerMac.mm:
(-[WKDateTimePicker showPicker:]):
* WebProcess/Automation/WebAutomationDOMWindowObserver.cpp:
(WebKit::WebAutomationDOMWindowObserver::WebAutomationDOMWindowObserver):
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::m_renderingBackend):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::cacheImageBuffer):
(WebKit::RemoteResourceCacheProxy::recordNativeImageUse):
* WebProcess/GPU/media/AudioTrackPrivateRemote.cpp:
(WebKit::AudioTrackPrivateRemote::AudioTrackPrivateRemote):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::MediaSourcePrivateRemote):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::connection):
* WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:
(WebKit::RemoteAudioHardwareListener::RemoteAudioHardwareListener):
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::ensureConnection):
* WebProcess/GPU/media/RemoteAudioSourceProvider.cpp:
(WebKit::RemoteAudioSourceProvider::RemoteAudioSourceProvider):
* WebProcess/GPU/media/RemoteCDM.cpp:
(WebKit::RemoteCDM::createInstance):
* WebProcess/GPU/media/RemoteCDMFactory.cpp:
(WebKit::RemoteCDMFactory::createCDM):
* WebProcess/GPU/media/RemoteCDMInstance.cpp:
(WebKit::RemoteCDMInstance::createSession):
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::RemoteImageDecoderAVF):
* WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp:
(WebKit::RemoteImageDecoderAVFManager::createImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::ensureGPUProcessConnection):
* WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp:
(WebKit::RemoteLegacyCDMFactory::createCDM):
* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
* WebProcess/GPU/media/RemoteRemoteCommandListener.cpp:
(WebKit::RemoteRemoteCommandListener::ensureGPUProcessConnection):
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::SourceBufferPrivateRemote):
* WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
(WebKit::TextTrackPrivateRemote::TextTrackPrivateRemote):
* WebProcess/GPU/media/VideoTrackPrivateRemote.cpp:
(WebKit::VideoTrackPrivateRemote::VideoTrackPrivateRemote):
* WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
(-[WKVideoLayerRemote setMediaPlayerPrivateRemote:]):
* WebProcess/GPU/media/ios/RemoteMediaSessionHelper.cpp:
(WebKit::RemoteMediaSessionHelper::ensureConnection):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::add):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
(WebKit::SampleBufferDisplayLayerManager::createLayer):
(WebKit::SampleBufferDisplayLayerManager::addLayer):
* WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp:
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::WebSocketChannel):
* WebProcess/Network/WebSocketChannelManager.cpp:
(WebKit::WebSocketChannelManager::addChannel):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::connectToSource):
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFPluginAccessibilityObject initWithPDFPlugin:andElement:]):
(WebKit::PDFPlugin::PDFPlugin):
* WebProcess/Plugins/Plugin.cpp:
(WebKit::Plugin::initialize):
* WebProcess/WebCoreSupport/WebDeviceOrientationUpdateProvider.cpp:
(WebKit::WebDeviceOrientationUpdateProvider::WebDeviceOrientationUpdateProvider):
(WebKit::WebDeviceOrientationUpdateProvider::deviceOrientationChanged):
(WebKit::WebDeviceOrientationUpdateProvider::deviceMotionChanged):
* WebProcess/WebCoreSupport/WebPermissionController.cpp:
(WebKit::WebPermissionController::WebPermissionController):
* WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp:
(WebKit::WebSpeechRecognitionConnection::registerClient):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::setRemoteObjectRegistry):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::drawRect):
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPC::JSIPC):
(WebKit::IPCTestingAPI::JSMessageListener::JSMessageListener):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::RemoteLayerTreeDisplayRefreshMonitor):
(WebKit::RemoteLayerTreeDisplayRefreshMonitor::updateDrawingArea):
* WebProcess/WebPage/WebContextMenu.cpp:
(WebKit::WebContextMenu::WebContextMenu):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::initWithCoreMainFrame):
(WebKit::WebFrame::createSubframe):
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::setLoadListener):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActiveDataListSuggestionPicker):
(WebKit::WebPage::setActiveDateTimeChooser):
(WebKit::WebPage::startTextManipulations):
(WebKit::WebPage::requestTextRecognition):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didFinishContentChangeObserving):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::createPDFHUD):
* WebProcess/WebStorage/StorageAreaImpl.cpp:
(WebKit::StorageAreaImpl::StorageAreaImpl):
* WebProcess/cocoa/AudioSessionRoutingArbitrator.cpp:
(WebKit::AudioSessionRoutingArbitrator::AudioSessionRoutingArbitrator):
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
2021-10-13 Jean-Yves Avenard <jya@apple.com>
Clearly distinguish serial from concurrent WorkQueue
https://bugs.webkit.org/show_bug.cgi?id=231418
rdar://problem/84021977
Reviewed by Chris Dumez.
Replace instances of WorkQueue being constructed as a concurrent one
with ConcurrentWorkQueue.
Remove the now unnecessary use of WorkQueue::Type::Serial in constructor.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::videoMediaStreamTrackRendererQueue):
(WebKit::GPUProcess::libWebRTCCodecsQueue):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::Engine):
* NetworkProcess/cache/NetworkCacheIOChannel.h:
* NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::readSyncInThread):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::Storage):
* NetworkProcess/cache/NetworkCacheStorage.h:
(WebKit::NetworkCache::Storage::ioQueue):
(WebKit::NetworkCache::Storage::backgroundIOQueue):
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::open):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::readerQueue):
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
(WebKit::MediaTrackReader::storageQueue):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::ContentRuleListStore):
* UIProcess/API/APIContentRuleListStore.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::appBoundDomainQueue):
* WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp:
(WebKit::RemoteAudioSourceProviderManager::RemoteAudioSourceProviderManager):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::LibWebRTCCodecs):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::EventDispatcher):
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::RemoteCaptureSampleManager):
2021-10-13 Adrian Perez de Castro <aperez@igalia.com>
[GTK] Opening emoji chooser crashes UI process with GTK 3.24.30
https://bugs.webkit.org/show_bug.cgi?id=228664
Reviewed by Michael Catanzaro.
Instead of providing a copy of the emoji chooser widget, use GLib's
introspection features and a little sprinkle of knowledge about how
GTK works in order to obtain the type code of the GtkEmojiChooser
widget included with GTK. This ensures that a working widget is
always used, regardless of the current GTK version.
No new tests needed.
* UIProcess/API/gtk/WebKitEmojiChooser.cpp:
(webkitEmojiChooserNew):
(): Deleted.
(webkitEmojiChooserAddEmoji): Deleted.
(webkitEmojiChooserAddRecentItem): Deleted.
(emojiActivated): Deleted.
(emojiDataHasVariations): Deleted.
(webkitEmojiChooserShowVariations): Deleted.
(emojiLongPressed): Deleted.
(emojiPressed): Deleted.
(emojiPopupMenu): Deleted.
(verticalAdjustmentChanged): Deleted.
(webkitEmojiChooserSetupSectionBox): Deleted.
(scrollToSection): Deleted.
(webkitEmojiChooserSetupSectionButton): Deleted.
(webkitEmojiChooserSetupRecent): Deleted.
(webkitEmojiChooserEnsureEmptyResult): Deleted.
(webkitEmojiChooserSearchChanged): Deleted.
(webkitEmojiChooserSetupFilters): Deleted.
(webkitEmojiChooserSetupEmojiSections): Deleted.
(webkitEmojiChooserInitializeEmojiMaxWidth): Deleted.
(webkitEmojiChooserConstructed): Deleted.
(webkitEmojiChooserShow): Deleted.
(webkit_emoji_chooser_class_init): Deleted.
* UIProcess/API/gtk/WebKitEmojiChooser.h:
2021-10-13 Alex Christensen <achristensen@webkit.org>
Prepare adattributiond Connection and IPC code for reuse with webpushd
https://bugs.webkit.org/show_bug.cgi?id=231680
Reviewed by Brady Eidson.
I move Connection, Encoder, and Decoder out of namespace PCM and into namespace Daemon and keep the PCM parts in PCM::Connection.
I remove an unnecessary memory copy by using a Span instead of a Vector for decoding.
I make ConnectionToMachService a template to be used with a different communication protocol for communicating with webpushd.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp:
(WebKit::PCM::Connection::Connection):
(WebKit::PCM::ConnectionToMachService::ConnectionToMachService): Deleted.
(WebKit::PCM::ConnectionToMachService::send const): Deleted.
(WebKit::PCM::ConnectionToMachService::sendWithReply const): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h:
(WebKit::PCM::Connection::Connection): Deleted.
(WebKit::PCM::Connection::get const): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::MessageInfo::toStringForTesting::encodeReply):
(WebKit::PCM::handlePCMMessage):
(WebKit::PCM::handlePCMMessageSetDebugModeIsEnabled):
(WebKit::PCM::handlePCMMessageWithReply):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::sendMessage const):
(WebKit::PCM::ReplyCaller<>::callReply):
(WebKit::PCM::ReplyCaller<String>::callReply):
(WebKit::PCM::ManagerProxy::sendMessageWithReply const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementConnectionCocoa.mm:
(WebKit::PCM::Connection::newConnectionWasInitialized const):
(WebKit::PCM::Connection::connectionReceivedEvent const):
(WebKit::PCM::Connection::dictionaryFromMessage const):
(WebKit::PCM::ConnectionToMachService::initializeConnectionIfNeeded const): Deleted.
(WebKit::PCM::ConnectionToMachService::sendDebugModeIsEnabledMessageIfNecessary const): Deleted.
(WebKit::PCM::ConnectionToMachService::checkForDebugMessageBroadcast const): Deleted.
(WebKit::PCM::dictionaryFromMessage): Deleted.
(WebKit::PCM::Connection::send const): Deleted.
(WebKit::PCM::Connection::sendWithReply const): Deleted.
(WebKit::PCM::ConnectionToMachService::send const): Deleted.
(WebKit::PCM::ConnectionToMachService::sendWithReply const): Deleted.
* Platform/IPC/ArgumentCoders.cpp:
* Platform/IPC/DaemonConnection.cpp: Copied from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp.
(WebKit::Daemon::ConnectionToMachService<Traits>::send const):
(WebKit::Daemon::ConnectionToMachService<Traits>::sendWithReply const):
* Platform/IPC/DaemonConnection.h: Copied from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h.
(WebKit::Daemon::Connection::Connection):
(WebKit::Daemon::Connection::get const):
(WebKit::Daemon::ConnectionToMachService::ConnectionToMachService):
* Platform/IPC/DaemonDecoder.cpp: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp.
* Platform/IPC/DaemonDecoder.h: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h.
(WebKit::Daemon::Decoder::Decoder):
* Platform/IPC/DaemonEncoder.cpp: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp.
* Platform/IPC/DaemonEncoder.h: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.h.
* Platform/IPC/cocoa/DaemonConnectionCocoa.mm: Copied from Source/WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementConnectionCocoa.mm.
(WebKit::Daemon::Connection::send const):
(WebKit::Daemon::Connection::sendWithReply const):
(WebKit::Daemon::ConnectionToMachService<Traits>::initializeConnectionIfNeeded const):
(WebKit::Daemon::ConnectionToMachService<Traits>::send const):
(WebKit::Daemon::ConnectionToMachService<Traits>::sendWithReply const):
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonConnectionSet.h:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonConnectionSet.mm:
(WebKit::PCM::DaemonConnectionSet::setConnectedNetworkProcessHasDebugModeEnabled):
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::connectionEventHandler):
* Shared/cf/ArgumentCodersCF.cpp:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::CertificateInfo>::encode):
(IPC::ArgumentCoder<WebCore::CertificateInfo>::decode):
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-10-13 Sihui Liu <sihui_liu@apple.com>
Implement FileSystemHandle move()
https://bugs.webkit.org/show_bug.cgi?id=231676
<rdar://problem/84199823>
Reviewed by Youenn Fablet.
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::isValidFileName):
(WebKit::FileSystemStorageHandle::requestCreateHandle):
(WebKit::FileSystemStorageHandle::removeEntry):
(WebKit::FileSystemStorageHandle::move):
* NetworkProcess/storage/FileSystemStorageHandle.h:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::move):
* NetworkProcess/storage/NetworkStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp:
(WebKit::WebFileSystemStorageConnection::move):
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h:
2021-10-13 Wenson Hsieh <wenson_hsieh@apple.com>
Support both VK and VKC-prefixed SPI when softlinking VisionKitCore classes
https://bugs.webkit.org/show_bug.cgi?id=231683
rdar://83744729
Reviewed by Tim Horton.
Several SPI classes in VisionKitCore are going to be renamed to be prefixed with VKC- rather than VK-, with a
`@compatibility_alias` for the existing SPI names. Refactor Live Text support in WebKit to be both binary and
source compatible with this future version of VisionKitCore, by checking for the existence of both class names
when softlinking VKImageAnalyzer and VKImageAnalyzerRequest. See below for more details.
* Platform/cocoa/TextRecognitionUtilities.h:
* Platform/cocoa/TextRecognitionUtilities.mm:
(WebKit::hasVisionKitCorePrefixedClasses):
(WebKit::createImageAnalyzer):
(WebKit::createImageAnalyzerRequest):
Instead of calling into PAL softlinking functions to allocate VKImageAnalyzer, put this logic behind a helper
function in TextRecognitionUtilities, which knows how to check for either class.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::ensureImageAnalyzer):
(WebKit::createImageAnalyzerRequest):
(WebKit::WebViewImpl::requestTextRecognition):
(WebKit::WebViewImpl::computeHasImageAnalysisResults):
(WebKit::createImageAnalysisRequest): Deleted.
Use the helper functions declared in TextRecognitionUtilities.h.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView imageAnalyzer]):
(-[WKContentView createImageAnalyzerRequest:image:imageURL:]):
(-[WKContentView createImageAnalyzerRequest:image:]):
(-[WKContentView requestTextRecognition:imageData:completionHandler:]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
(-[WKContentView createImageAnalysisRequest:image:imageURL:]): Deleted.
(-[WKContentView createImageAnalysisRequest:image:]): Deleted.
Use the helper functions declared in TextRecognitionUtilities.h, instead of using PAL softlinking directly. We
also refactor this code to pass a CGImageRef instead of a UIImage when initializing the image analyzer request,
such that the helper functions can work across macOS and iOS.
Also rename `createImageAnalysisRequest` to `createImageAnalyzerRequest` for consistency with the class name.
2021-10-13 Per Arne <pvollan@apple.com>
Restrict "darwin-notification-post" to a minimal set in the WP sandbox
https://bugs.webkit.org/show_bug.cgi?id=231594
<rdar://66586792>
Reviewed by Brent Fulgham.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-13 Kimmo Kinnunen <kkinnunen@apple.com>
WebGL video texture upload is very slow due to excessive transfer of the video pixel buffer
https://bugs.webkit.org/show_bug.cgi?id=231425
Reviewed by Youenn Fablet.
Typical WebGL content requests the videos to be uploaded to a texture
once per render loop update, even though the video has not changed.
The video pixel buffer is slow to transfer across IPC. It should be transferred
only when it has changed.
MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC hold
the last requested pixel buffer ref. They will update it or discard it only
when pixelBufferForCurrentTime() is called.
Cache the pixel buffer to MediaPlayerPrivateRemote (GPUP side proxy)
Cache the pixel buffer to RemoteMediaPlayerProxy (WebP side proxy)
The caches increase the total memory use only during the duration
of the call, since after the ref has been updated, it refers
to the one always held in the original objects (MediaPlayerPrivateAVFoundationObjC
and MediaPlayerPrivateMediaSourceAVFObjC)
No new tests, fixes a perf regression wrt GPUP media.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::invalidate):
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime):
(WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTimeIfChanged):
(WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTime): Deleted.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime):
2021-10-13 Per Arne Vollan <pvollan@apple.com>
[iOS] Stop including 'util.sb' in the WebContent process' sandbox
https://bugs.webkit.org/show_bug.cgi?id=231570
<rdar://problem/84143956>
Reviewed by Brent Fulgham.
This is a step towards being able to test-compile the sandbox on Open Source builders.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* Shared/Sandbox/util.sb: Added.
2021-10-12 Alexey Proskuryakov <ap@apple.com>
Invoke build scripts with python3 explicitly
https://bugs.webkit.org/show_bug.cgi?id=231587
Reviewed by Jonathan Bedard.
Much of the work to support Python 3 was done years ago, but we need this to
actually use Python 3 on macOS.
* DerivedSources.make:
* Scripts/generate-message-receiver.py:
* Scripts/postprocess-header-rule:
* Scripts/webkit/messages_unittest.py:
* Scripts/webkit/model_unittest.py:
* Scripts/webkit/parser_unittest.py:
* Scripts/webkit/tests/Makefile:
2021-10-13 Alex Christensen <achristensen@webkit.org>
Remove WTF::Variant and WTF::get
https://bugs.webkit.org/show_bug.cgi?id=231675
Reviewed by Chris Dumez.
* GPUProcess/graphics/QualifiedResourceHeap.h:
(WebKit::QualifiedResourceHeap::get const):
* NetworkProcess/cache/NetworkCacheDataCurl.cpp:
(WebKit::NetworkCache::Data::Data):
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PasteboardCustomData::Entry>::encode):
(IPC::ArgumentCoder<IDBKeyPath>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientIdentifier>::encode):
* Shared/WebPreferencesStore.cpp:
(WebKit::valueForKey):
* UIProcess/API/wpe/TouchGestureController.h:
* UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::isValidBackgroundActivity):
(WebKit::ProcessThrottler::isValidForegroundActivity):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::getRpId):
(WebKit::WebCore::getUserName):
(WebKit::AuthenticatorManager::respondReceived):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::makeCredential):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
(WebKit::LocalAuthenticator::getAssertion):
(WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
(WebKit::LocalAuthenticator::continueGetAssertionAfterUserVerification):
(WebKit::LocalAuthenticator::deleteDuplicateCredential const):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:
(WebKit::getUserVerificationRequirement):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::makeCredential):
(WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived):
(WebKit::CtapAuthenticator::getAssertion):
(WebKit::CtapAuthenticator::processGoogleLegacyAppIdSupportExtension):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
(WebKit::U2fAuthenticator::makeCredential):
(WebKit::U2fAuthenticator::checkExcludeList):
(WebKit::U2fAuthenticator::issueRegisterCommand):
(WebKit::U2fAuthenticator::getAssertion):
(WebKit::U2fAuthenticator::issueSignCommand):
(WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
(WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::create):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::createImageBufferBackendHandle const):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::audioSamplesAvailable):
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
(webkit_dom_html_select_element_add):
* WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp:
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::executePendingEditorCommands):
* WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
(WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
2021-10-12 Jer Noble <jer.noble@apple.com>
[Build-time perf] Forward-declare more things in Document.h
https://bugs.webkit.org/show_bug.cgi?id=231489
Reviewed by Myles C. Maxfield.
Move the folowing enumerations outside their classes so that they can be forward-declared:
- MediaProducer::MediaStateFlags -> MediaProducerMediaStateFlags
- MediaProducer::MediaCaptureKind -> MediaProducerMediaCaptureKind
- MediaProducer::MutedState -> MediaProducerMutedState
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::enqueueSecurityPolicyViolationEvent):
* NetworkProcess/NetworkResourceLoader.h:
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/API/APIUIClient.h:
(API::UIClient::mediaCaptureStateDidChange):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetMuted):
(WKPageGetMediaState):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView cameraCaptureState]):
(-[WKWebView microphoneCaptureState]):
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _stopMediaCapture]):
(-[WKWebView _setPageMuted:]):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConfigureMediaCapture):
(webkit_web_view_set_camera_capture_state):
(webkit_web_view_set_microphone_capture_state):
(webkit_web_view_set_display_capture_state):
* UIProcess/Cocoa/MediaUtilities.h:
* UIProcess/Cocoa/MediaUtilities.mm:
(WebKit::toWKMediaCaptureStateDeprecated):
(WebKit::toWKMediaMutedState):
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::~UserMediaPermissionRequestManagerProxy):
(WebKit::UserMediaPermissionRequestManagerProxy::stopCapture):
(WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState):
(WebKit::WebPageProxy::setMuted):
(WebKit::WebPageProxy::stopMediaCapture):
(WebKit::WebPageProxy::isPlayingMediaDidChange):
(WebKit::WebPageProxy::updatePlayingMediaDidChange):
(WebKit::WebPageProxy::playbackTargetPickerClientStateDidChange):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::pageMutedStateChanged):
* UIProcess/WebProcessProxy.h:
* WebProcess/Plugins/PluginView.cpp:
* WebProcess/Plugins/PluginView.h:
(WebKit::PluginView::mediaState const):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::isPlayingMediaDidChange):
(WebKit::WebChromeClient::playbackTargetPickerClientStateDidChange):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::enqueueSecurityPolicyViolationEvent):
(WebKit::WebPage::setMuted):
(WebKit::WebPage::stopMediaCapture):
(WebKit::WebPage::isPlayingMediaDidChange):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-10-12 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Use IPC streaming for concurrent display list processing
https://bugs.webkit.org/show_bug.cgi?id=230860
rdar://83438038
Reviewed by Tim Horton.
This patch rebuilds the concurrent display list architecture in the web and GPU processes on top of the
streamable IPC connections currently used by WebGL in the GPU process. See below for more details.
There should be no change in behavior.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
Pass a StreamConnectionBuffer from the web process to the GPU process when constructing
RemoteRenderingBackend; this serves as the pool of shared memory used to store streaming IPC messages sent from
the web process to the GPU process. I've (somewhat arbitrarily) chosen the size of this StreamConnectionBuffer
to match WebGL's connection buffer, though this can be tuned as needed. In a future patch, we may also want to
implement a mechanism for starting out with a small connection buffer, and growing it by successively larger
segments as needed.
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/GPUConnectionToWebProcess.messages.in:
* GPUProcess/cocoa/GPUProcessCocoa.mm:
(WebKit::GPUProcess::additionalStateForDiagnosticReport const):
Add a FIXME for re-introducing diagnostic state logging when using streamable IPC.
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::RemoteDisplayListRecorder):
(WebKit::RemoteDisplayListRecorder::startListeningForIPC):
(WebKit::RemoteDisplayListRecorder::stopListeningForIPC):
Add and remove the remote display list as a destination on the RemoteRenderingBackend's stream connection. Note
that the synchronous dispatch to the main thread here is necessary to maintain the ordering of out-of-stream IPC
messages that may have been received on the IPC thread.
* GPUProcess/graphics/RemoteDisplayListRecorder.h:
(WebKit::RemoteDisplayListRecorder::create):
(WebKit::RemoteDisplayListRecorder::handleItem):
* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::RemoteImageBuffer):
(WebKit::RemoteImageBuffer::apply): Deleted.
Introduce `m_remoteDisplayList` to RemoteImageBuffer, and remove some logic for applying display list items that
is no longer necessary.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::create):
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
Set up the IPC stream connection and stream connection work queue, and immediately send a wakeup semaphore back
to the web process.
(WebKit::RemoteRenderingBackend::startListeningForIPC):
(WebKit::RemoteRenderingBackend::~RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::stopListeningForIPC):
Add a mechanism to immediately tell all `m_remoteDisplayLists` to stop listening for streaming IPC messages when
the owning RemoteRenderingBackend stops listening.
(WebKit::RemoteRenderingBackend::dispatch):
(WebKit::RemoteRenderingBackend::didCreateImageBufferBackend):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
(WebKit::RemoteRenderingBackend::applyMediaItem): Deleted.
(WebKit::RemoteRenderingBackend::ReplayerDelegate::ReplayerDelegate): Deleted.
(WebKit::RemoteRenderingBackend::ReplayerDelegate::apply): Deleted.
(WebKit::RemoteRenderingBackend::ReplayerDelegate::didCreateMaskImageBuffer): Deleted.
(WebKit::RemoteRenderingBackend::ReplayerDelegate::didResetMaskImageBuffer): Deleted.
(WebKit::RemoteRenderingBackend::ReplayerDelegate::recordResourceUse): Deleted.
(WebKit::RemoteRenderingBackend::submit): Deleted.
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): Deleted.
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): Deleted.
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier): Deleted.
(WebKit::RemoteRenderingBackend::setNextItemBufferToRead): Deleted.
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): Deleted.
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandleWithQualifiedIdentifier): Deleted.
(WebKit::RemoteRenderingBackend::resumeFromPendingWakeupInformation): Deleted.
(WebKit::RemoteRenderingBackend::didCreateMaskImageBuffer): Deleted.
(WebKit::RemoteRenderingBackend::didResetMaskImageBuffer): Deleted.
(WebKit::RemoteRenderingBackend::decodeItem): Deleted.
(WebKit::RemoteRenderingBackend::lastKnownState const): Deleted.
(WebKit::RemoteRenderingBackend::updateLastKnownState): Deleted.
Remove logic for coordinating wakeups and shared display list item buffers in the GPU process.
* GPUProcess/graphics/RemoteRenderingBackend.h:
Subclass IPC::StreamMessageReceiver. In this new concurrent display list model, RemoteRenderingBackend serves
as a streaming IPC destination alongside each RemoteDisplayListRecorder in the GPU process; all messages
previously sent to the RemoteRenderingBackend as normal IPC are now sent through the connection stream (though
some must be marked as non-stream-encodable).
(WebKit::RemoteRenderingBackend::streamConnection const):
(WebKit::RemoteRenderingBackend::decodeAndCreate): Deleted.
(): Deleted.
(WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const): Deleted.
Delete more logic related to concurrent display lists.
* GPUProcess/graphics/RemoteRenderingBackend.messages.in:
Make RemoteRenderingBackend a stream message receiver.
* GPUProcess/graphics/RemoteRenderingBackendCreationParameters.h:
(WebKit::RemoteRenderingBackendCreationParameters::encode const):
(WebKit::RemoteRenderingBackendCreationParameters::decode):
Remove the IPC::Semaphore here, that was previously used for quick GPU process wakeups. This semaphore is no
longer needed because we always use IPC::Semaphore for waking the GPU process when using streaming IPC.
* GPUProcess/graphics/RemoteResourceCache.h:
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
Make the RemoteImageBufferProxy template class directly subclass ConcreteImageBuffer instead of
DisplayList::ImageBuffer; additionally, introduce a `RemoteDisplayListRecorderProxy m_remoteDisplayList` here,
which we use as our drawing graphics context.
(WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy):
(WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
(WebKit::RemoteImageBufferProxy::recordNativeImageUse):
(WebKit::RemoteImageBufferProxy::recordFontUse):
(WebKit::RemoteImageBufferProxy::recordImageBufferUse):
(WebKit::RemoteImageBufferProxy::clearDisplayList): Deleted.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
(WebKit::RemoteRenderingBackendProxy::gpuProcessConnectionDidClose):
(WebKit::RemoteRenderingBackendProxy::createRemoteImageBuffer):
(WebKit::RemoteRenderingBackendProxy::sharedMemoryForGetPixelBuffer):
(WebKit::RemoteRenderingBackendProxy::destroyGetPixelBufferSharedMemory):
(WebKit::RemoteRenderingBackendProxy::getDataURLForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getDataForImageBuffer):
(WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
Send all IPC messages to RemoteRenderingBackend in the GPU process through the stream connection, instead of
using standard IPC messages. This guarantees ordering when receiving cached resources.
(WebKit::RemoteRenderingBackendProxy::cacheNativeImage):
(WebKit::RemoteRenderingBackendProxy::cacheFont):
(WebKit::RemoteRenderingBackendProxy::deleteAllFonts):
(WebKit::RemoteRenderingBackendProxy::releaseRemoteResource):
(WebKit::RemoteRenderingBackendProxy::finalizeRenderingUpdate):
(WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):
(WebKit::RemoteRenderingBackendProxy::ensureBackendCreated):
(WebKit::RemoteRenderingBackendProxy::streamConnection):
Add a mechanism to ensure that we have the IPC stream wakeup semaphore before grabbing the stream connection.
(WebKit::RemoteRenderingBackendProxy::didCreateWakeUpSemaphoreForDisplayListStream):
(WebKit::RemoteRenderingBackendProxy::willAppendItem): Deleted.
(WebKit::RemoteRenderingBackendProxy::sendWakeupMessage): Deleted.
(WebKit::RemoteRenderingBackendProxy::sendDeferredWakeupMessageIfNeeded): Deleted.
(WebKit::RemoteRenderingBackendProxy::didAppendData): Deleted.
(WebKit::RemoteRenderingBackendProxy::mostRecentlyUsedDisplayListHandle): Deleted.
(WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle): Deleted.
(WebKit::RemoteRenderingBackendProxy::createItemBuffer): Deleted.
Remove all logic previously used to coordinate concurrent display list processing on the remote rendering
backend.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::remoteResourceCacheProxy):
(WebKit::RemoteRenderingBackendProxy::sendToStream):
(WebKit::RemoteRenderingBackendProxy::sendSyncToStream):
Add helper methods to send IPC messages to the remote rendering backend through the connection stream.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in:
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::encodeRemoteRenderingBackendCreationParameters):
2021-10-12 Ross Kirsling <ross.kirsling@sony.com>
Non-unified build fixes, October 2021 edition.
https://bugs.webkit.org/show_bug.cgi?id=231654
Reviewed by Don Olmstead.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp:
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2021-10-12 Alex Christensen <achristensen@webkit.org>
Add webpushd executable
https://bugs.webkit.org/show_bug.cgi?id=231650
Reviewed by Brady Eidson.
* Configurations/webpushd.xcconfig: Added.
* Scripts/process-entitlements.sh:
* Shared/EntryPointUtilities/Cocoa/Daemon/webpushd.c: Added.
(main):
* WebKit.xcodeproj/project.pbxproj:
2021-10-12 Wenson Hsieh <wenson_hsieh@apple.com>
Move some staged VisionKitCore SPI into VisionKitCoreSPI.h
https://bugs.webkit.org/show_bug.cgi?id=231648
Reviewed by Tim Horton.
Move these interface declarations out of this implementation file, and into PAL instead, but only if we're not
using the Apple internal SDK. Additionally, redefine VKWKDataDetectorInfo as a class instead of a protocol; this
workaround was only added to ensure source and binary compatibility with older versions of the internal macOS
Monterey/iOS 15 SDK.
No change in behavior.
* Platform/cocoa/TextRecognitionUtilities.mm:
(WebKit::makeTextRecognitionResult):
2021-10-12 Alex Christensen <achristensen@webkit.org>
Use std::variant instead of WTF::Variant
https://bugs.webkit.org/show_bug.cgi?id=231629
Reviewed by Chris Dumez.
* NetworkProcess/NetworkLoadChecker.h:
* NetworkProcess/cache/NetworkCacheData.h:
* Platform/IPC/ArgumentCoders.h:
(IPC::VariantCoder::encode):
(IPC::VariantCoder::decode):
* Platform/IPC/Attachment.h:
* Platform/IPC/MessageReceiveQueueMap.h:
* Shared/SessionState.h:
* Shared/WebCoreArgumentCoders.h:
* Shared/WebPreferencesStore.h:
* Shared/mac/MediaFormatReader/MediaSampleCursor.h:
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/API/C/WKMockMediaDevice.cpp:
(WKAddMockMediaDevice):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]):
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):
* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::simulateKeyboardInteraction):
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
* UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::showSafeBrowsingWarning):
* UIProcess/PageClient.h:
(WebKit::PageClient::showSafeBrowsingWarning):
* UIProcess/ProcessThrottler.h:
* UIProcess/WebAuthentication/Authenticator.h:
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::getRpId):
(WebKit::WebCore::getUserName):
* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:
(WebKit::getClientDataType):
(WebKit::getUserVerificationRequirement):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedPolicyDecision):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::showSafeBrowsingWarning):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::showSafeBrowsingWarning):
* WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:
(WebKit::WebAuthnConnectionToWebProcess::handleRequest):
* WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
2021-10-12 Garrett Davidson <garrett_davidson@apple.com>
Adopt platform UI for WebAuthn
https://bugs.webkit.org/show_bug.cgi?id=230906
<rdar://74659556>
Reviewed by David Kilzer.
Switch to using the platform's UI for WebAuthn transactions, where available,
which takes precedence over the WebAuthn process.
Covered by existing tests.
* Platform/spi/Cocoa/AuthenticationServicesCoreSPI.h:
When possible, switch to importing the umbrella header directly instead of
redeclaring the entire interface.
Also, fix an existing bug caused by the redeclaration, where the
ASCSecurityKeyPublicKeyCredentialKind enum was renamed.
* SourcesCocoa.txt:
Build the new file.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]):
Return the full error to the delegate.
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.h:
* UIProcess/WebAuthentication/Cocoa/AuthenticationServicesCoreSoftLink.mm:
Add all of the new required classes for soft linking, and sort the list.
* UIProcess/WebAuthentication/Cocoa/WebAuthenticatorCoordinatorProxy.mm: Added.
(WebKit::toArrayBuffer):
(WebKit::toNSData):
(WebKit::toNSString):
(WebKit::toExceptionCode):
(WebKit::toASCDescriptor):
Helper methods for converting between WK and ASC types.
(WebKit::configureRegistrationRequestContext):
(WebKit::configurationAssertionRequestContext):
Create and configure an ASCCredentialRequestContext from the provided options.
(WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
(WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
Configure and perform the request.
(WebKit::WebAuthenticatorCoordinatorProxy::performRequest):
- Create a proxy to talk to AuthenticationServicesAgent.
- Ask the proxy if we're allowed to perform the request.
- If no, return an error.
- If yes, create presenter and present over the web page's window.
- When the request if finished, check the kind of credential we got, and return
the relevant AuthenticatorResponseData/AuthenticatorAttachment.
- If the request was canceled or failed, `credential` will be nil and `error` will
be non-nil. In most cases, the error will be WKErrorDomain, which we can convert
directly to ExceptionData. The one exception is the user canceled the request in
the platform UI, so return the appropriate ExceptionData in that case. The final
"Operation failed." case covers anything else unexpected happening.
(WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
If +shouldUseAlternateCredentialStore is true, this is always true. Otherwise,
fall back to the old behavior.
* UIProcess/WebAuthentication/Cocoa/WKASCAuthorizationPresenterDelegate.mm:
(-[WKASCAuthorizationPresenterDelegate authorizationPresenter:credentialRequestedForLoginChoice:authenticatedContext:completionHandler:]):
Use the new name of the enum, unconditionally.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
Wrap a few methods in the new flag. When the flag is on, these methods will exist
in WebAuthenticatorCoordinatorProxy.mm.
* UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
New ivar and method for the platform presenter.
Make the superclass public so we can use the WeakPtr inheritance.
* UIProcess/ios/WKHoverPlatterParameters.mm:
Add some missing imports since this file got pushed off the end of
UnifiedSource47-mm.mm.
* WebKit.xcodeproj/project.pbxproj:
Add the new file.
* WebProcess/WebAuthentication/WebAuthenticatorCoordinator.cpp:
When platform UI is available, prefer it over the WebAuthn process.
(WebKit::WebAuthenticatorCoordinator::makeCredential):
(WebKit::WebAuthenticatorCoordinator::getAssertion):
(WebKit::WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable):
2021-10-12 Simon Fraser <simon.fraser@apple.com>
Scrolling thread animations need to commit layers on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231593
Reviewed by Tim Horton.
Re-land r284022 with a fix in WebPageProxy to avoid non-balanced calls to
setDisplayLinkForDisplayWantsFullSpeedUpdates().
Scroll animations were running on the scrolling thread (in that the timers were firing on
that thread), but the scrolling thread wasn't changing layer positions, so those animations
weren't smooth.
This happened because of an existing assumption that we only commit layer changes on the
scrolling thread in response to wheel events; the machinery around
ThreadedScrollingTree::displayDidRefresh() was all gated on having recently received a wheel
event.
To fix this we need to communicate back to the UI process when there are active scroll
animations running. The ScrollingTree already tracks this, and the virtual
hasNodeWithAnimatedScrollChanged() on ScrollingCoordinator is called for it. To get this to
the UI process on macOS, subclass ScrollingCoordinatorMac in WebKit2 and override
hasNodeWithAnimatedScrollChanged() to call into WebPage, which then IPCs to WebPageProxy.
This ends up calling setDisplayLinkForDisplayWantsFullSpeedUpdates() so that know to IPC
displayDidRefresh to EventDispatcher off the main thread (as we do for wheel events).
Scroll animations are still based on a 60Hz timer, but in future should be driven by
displayDidRefresh() notifications.
* SourcesCocoa.txt:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wheelEventHysteresisUpdated):
(WebKit::WebPageProxy::updateDisplayLinkFrequency):
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
(WebKit::WebPageProxy::setHasActiveAnimatedScrolls):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createScrollingCoordinator const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setHasActiveAnimatedScrolls):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
(WebKit::TiledCoreAnimationScrollingCoordinator::TiledCoreAnimationScrollingCoordinator):
(WebKit::TiledCoreAnimationScrollingCoordinator::pageDestroyed):
(WebKit::TiledCoreAnimationScrollingCoordinator::hasNodeWithAnimatedScrollChanged):
2021-10-12 Tim Horton <timothy_horton@apple.com>
Remove some unused UIKit SPI declarations
https://bugs.webkit.org/show_bug.cgi?id=231646
Reviewed by Wenson Hsieh.
* Platform/spi/ios/UIKitSPI.h:
2021-10-12 Sihui Liu <sihui_liu@apple.com>
Implement FileSystemSyncAccessHandle read() and write()
https://bugs.webkit.org/show_bug.cgi?id=231466
<rdar://problem/84050394>
Reviewed by Youenn Fablet.
Let network process open the file and pass file descriptor to web process, so that web process can read and
write the file without sending IPC messages. Currently getting file size, truncating file and syncing file are
still performed by network process.
* NetworkProcess/storage/FileSystemStorageError.h:
(WebKit::convertToException):
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::createSyncAccessHandle):
(WebKit::FileSystemStorageHandle::truncate):
(WebKit::FileSystemStorageHandle::flush):
(WebKit::FileSystemStorageHandle::close):
* NetworkProcess/storage/FileSystemStorageHandle.h:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::createSyncAccessHandle):
* NetworkProcess/storage/NetworkStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* Platform/IPC/SharedFileHandle.cpp: Added.
(IPC::SharedFileHandle::create):
(IPC::SharedFileHandle::encode const):
(IPC::SharedFileHandle::decode):
* Platform/IPC/SharedFileHandle.h: Added.
(IPC::SharedFileHandle::handle):
(IPC::SharedFileHandle::SharedFileHandle):
* Platform/IPC/cocoa/SharedFileHandleCocoa.cpp: Added.
(IPC::SharedFileHandle::create):
(IPC::SharedFileHandle::encode const):
(IPC::SharedFileHandle::decode):
* Sources.txt:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _fileSystemAccessEnabled]):
(-[WKPreferences _setFileSystemAccessEnabled:]):
(-[WKPreferences _storageAPIEnabled]):
(-[WKPreferences _setStorageAPIEnabled:]):
(-[WKPreferences _accessHandleEnabled]):
(-[WKPreferences _setAccessHandleEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp:
(WebKit::WebFileSystemStorageConnection::createSyncAccessHandle):
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-12 Chris Dumez <cdumez@apple.com>
Decrease use of makeWeakPtr()
https://bugs.webkit.org/show_bug.cgi?id=231615
Reviewed by Alex Christensen.
Decrease use of makeWeakPtr() and use WeakPtr { } directly instead.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::getConfiguration):
(WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime):
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::Unit):
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
(WebKit::RemoteSampleBufferDisplayLayer::initialize):
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::processContentRuleListsForLoad):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::cannotHandle):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::controlClient):
(WebKit::WebSWServerConnection::startFetch):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::firePushEvent):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::initialize):
(WebKit::CacheStorage::Engine::writeFile):
(WebKit::CacheStorage::Engine::readFile):
(WebKit::CacheStorage::Engine::fetchEntries):
(WebKit::CacheStorage::Engine::clearCachesForOriginFromDisk):
* NetworkProcess/cocoa/WebSocketTaskCocoa.mm:
(WebKit::WebSocketTask::readNextMessage):
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _createMediaSessionCoordinatorForTesting:completionHandler:]):
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.mm:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::createTabForExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptForExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::reloadForExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::showExtensionTab):
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptInExtensionTab):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/SpeechRecognitionPermissionManager.cpp:
(WebKit::SpeechRecognitionPermissionManager::requestSpeechRecognitionServiceAccess):
(WebKit::SpeechRecognitionPermissionManager::requestMicrophoneAccess):
* UIProcess/SpeechRecognitionServer.cpp:
(WebKit::SpeechRecognitionServer::requestPermissionForRequest):
(WebKit::SpeechRecognitionServer::handleRequest):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList):
* UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp:
(WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowAccess):
* WebProcess/GPU/media/RemoteLegacyCDMFactory.cpp:
(WebKit::RemoteLegacyCDMFactory::registerFactory):
* WebProcess/GPU/media/RemoteMediaEngineConfigurationFactory.cpp:
(WebKit::RemoteMediaEngineConfigurationFactory::registerFactory):
* WebProcess/GPU/webrtc/AudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::AudioMediaStreamTrackRendererInternalUnitManager::Proxy::createRemoteUnit):
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::startRecording):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::initialize):
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::registerExtension):
(WebKit::WebInspectorUIExtensionController::unregisterExtension):
(WebKit::WebInspectorUIExtensionController::createTabForExtension):
(WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
(WebKit::WebInspectorUIExtensionController::reloadForExtension):
(WebKit::WebInspectorUIExtensionController::showExtensionTab):
(WebKit::WebInspectorUIExtensionController::evaluateScriptInExtensionTab):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::join):
(WebKit::RemoteMediaSessionCoordinator::seekTo):
(WebKit::RemoteMediaSessionCoordinator::play):
(WebKit::RemoteMediaSessionCoordinator::pause):
(WebKit::RemoteMediaSessionCoordinator::setTrack):
* WebProcess/Network/webrtc/LibWebRTCNetworkManager.cpp:
(WebKit::LibWebRTCNetworkManager::StartUpdating):
(WebKit::LibWebRTCNetworkManager::StopUpdating):
(WebKit::LibWebRTCNetworkManager::CreateNameForAddress):
* WebProcess/XR/PlatformXRSystemProxy.cpp:
(WebKit::PlatformXRSystemProxy::enumerateImmersiveXRDevices):
2021-10-12 Chris Dumez <cdumez@apple.com>
Stop passing RegistrableDomain by value in NetworkSessionCocoa
https://bugs.webkit.org/show_bug.cgi?id=231633
Reviewed by Alex Christensen.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::hasIsolatedSession const):
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::isolatedSession):
(WebKit::SessionSet::isolatedSession):
(WebKit::NetworkSessionCocoa::hasIsolatedSession const):
2021-10-12 Alex Christensen <achristensen@webkit.org>
Rename AdAttributionDaemon to adattributiond
https://bugs.webkit.org/show_bug.cgi?id=231620
Reviewed by Kate Cheney.
adattributiond is its approved name in rdar://80701098 and we already used it in some places.
Use it consistently.
* Configurations/adattributiond.xcconfig: Renamed from Source/WebKit/Configurations/AdAttributionDaemon.xcconfig.
* Resources/SandboxProfiles/ios/com.apple.WebKit.adattributiond.sb: Renamed from Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.AdAttributionDaemon.sb.
* Scripts/process-entitlements.sh:
* Shared/EntryPointUtilities/Cocoa/Daemon/adattributiond.c: Renamed from Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/AdAttributionDaemon.c.
* WebKit.xcodeproj/project.pbxproj:
2021-10-12 Alex Christensen <achristensen@webkit.org>
Reduce use of WebCore structures in adattributiond
https://bugs.webkit.org/show_bug.cgi?id=231617
Reviewed by Chris Dumez.
In order to reduce the memory use of adattributiond, I'm planning to have it not link WebKit.framework.
This is progress towards that.
I use a RunLoop::Timer instead of a WebCore::Timer, which does the same thing on the main thread.
I use a WTF::String to represent the error description or lack thereof instead of sending the whole error.
I stop sending the response, because it was unused.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PCM::NetworkLoader::start):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm:
(WebKit::PCM::NetworkLoader::start):
2021-10-12 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r284022.
Caused tests to exit early due to an assertion failure
Reverted changeset:
"Scrolling thread animations need to commit layers on the
scrolling thread"
https://bugs.webkit.org/show_bug.cgi?id=231593
https://commits.webkit.org/r284022
2021-10-12 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 9: Finish migrating RemoteResourceCache to QualifiedRenderingResourceIdentifier
https://bugs.webkit.org/show_bug.cgi?id=231414
<rdar://problem/84015584>
Reviewed by Said Abou-Hallawa.
Now that DisplayList::ResourceHeap exists, we can make a ResourceHeap subclass specifically for
the GPU process. The implementation of this class holds QualifiedRenderingResourceIdentifiers
instead of RenderingResourceIdentifier.
* GPUProcess/graphics/QualifiedResourceHeap.h: Added.
(WebKit::QualifiedResourceHeap::QualifiedResourceHeap):
(WebKit::QualifiedResourceHeap::add):
(WebKit::QualifiedResourceHeap::getImageBuffer const):
(WebKit::QualifiedResourceHeap::getNativeImage const):
(WebKit::QualifiedResourceHeap::getFont const):
(WebKit::QualifiedResourceHeap::hasImageBuffer const):
(WebKit::QualifiedResourceHeap::hasNativeImage const):
(WebKit::QualifiedResourceHeap::hasFont const):
(WebKit::QualifiedResourceHeap::removeImageBuffer):
(WebKit::QualifiedResourceHeap::removeNativeImage):
(WebKit::QualifiedResourceHeap::removeFont):
(WebKit::QualifiedResourceHeap::deleteAllFonts):
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::maybeRemoveResource):
* GPUProcess/graphics/RemoteResourceCache.h:
* WebKit.xcodeproj/project.pbxproj:
2021-10-12 Simon Fraser <simon.fraser@apple.com>
Scrolling thread animations need to commit layers on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231593
Reviewed by Tim Horton.
Scroll animations were running on the scrolling thread (in that the timers were firing on
that thread), but the scrolling thread wasn't changing layer positions, so those animations
weren't smooth.
This happened because of an existing assumption that we only commit layer changes on the
scrolling thread in response to wheel events; the machinery around
ThreadedScrollingTree::displayDidRefresh() was all gated on having recently received a wheel
event.
To fix this we need to communicate back to the UI process when there are active scroll
animations running. The ScrollingTree already tracks this, and the virtual
hasNodeWithAnimatedScrollChanged() on ScrollingCoordinator is called for it. To get this to
the UI process on macOS, subclass ScrollingCoordinatorMac in WebKit2 and override
hasNodeWithAnimatedScrollChanged() to call into WebPage, which then IPCs to WebPageProxy.
This ends up calling setDisplayLinkForDisplayWantsFullSpeedUpdates() so that know to IPC
displayDidRefresh to EventDispatcher off the main thread (as we do for wheel events).
Scroll animations are still based on a 60Hz timer, but in future should be driven by
displayDidRefresh() notifications.
* SourcesCocoa.txt:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::wheelEventHysteresisUpdated):
(WebKit::WebPageProxy::updateDisplayLinkFrequency):
(WebKit::WebPageProxy::updateWheelEventActivityAfterProcessSwap):
(WebKit::WebPageProxy::setHasActiveAnimatedScrolls):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createScrollingCoordinator const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setHasActiveAnimatedScrolls):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
* WebProcess/WebPage/mac/TiledCoreAnimationScrollingCoordinator.mm: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
(WebKit::TiledCoreAnimationScrollingCoordinator::TiledCoreAnimationScrollingCoordinator):
(WebKit::TiledCoreAnimationScrollingCoordinator::pageDestroyed):
(WebKit::TiledCoreAnimationScrollingCoordinator::hasNodeWithAnimatedScrollChanged):
2021-10-12 Alex Christensen <achristensen@webkit.org>
Use STL instead of WTF::get_if, WTF::Monostate, WTF::visit, and WTF::holds_alternative
https://bugs.webkit.org/show_bug.cgi?id=231582
Reviewed by Darin Adler.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
* NetworkProcess/cache/NetworkCacheDataCurl.cpp:
(WebKit::NetworkCache::Data::Data):
* Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<std::monostate>::encode):
(IPC::ArgumentCoder<std::monostate>::decode):
(IPC::ArgumentCoder<Monostate>::encode): Deleted.
(IPC::ArgumentCoder<Monostate>::decode): Deleted.
* Platform/IPC/FormDataReference.h:
(IPC::FormDataReference::encode const):
* Platform/IPC/MessageReceiveQueueMap.cpp:
(IPC::MessageReceiveQueueMap::get const):
* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::sendOutputMessage):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<PasteboardCustomData::Entry>::encode):
(IPC::ArgumentCoder<IDBKeyPath>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientData>::encode):
(IPC::ArgumentCoder<ServiceWorkerOrClientIdentifier>::encode):
* Shared/WebPreferencesStore.cpp:
(WebKit::valueForKey):
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::isValidBackgroundActivity):
(WebKit::ProcessThrottler::isValidForegroundActivity):
(WebKit::ProcessThrottler::TimedActivity::updateTimer):
* UIProcess/WebAuthentication/Authenticator.cpp:
(WebKit::Authenticator::handleRequest):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::WebCore::getRpId):
(WebKit::WebCore::getUserName):
(WebKit::AuthenticatorManager::respondReceived):
(WebKit::AuthenticatorManager::invokePendingCompletionHandler):
* UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:
(WebKit::getClientDataType):
(WebKit::getUserVerificationRequirement):
* UIProcess/gtk/WebPasteboardProxyGtk.cpp:
(WebKit::WebPasteboardProxy::writeCustomData):
* WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::create):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableIOSurfaceBackend::create):
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::executePendingEditorCommands):
* WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
2021-10-12 Chris Dumez <cdumez@apple.com>
Allow direct construction of WeakPtr without makeWeakPtr()
https://bugs.webkit.org/show_bug.cgi?id=231580
Reviewed by Darin Adler.
Allow direct construction of WeakPtr without makeWeakPtr(), and deprecate makeWeakPtr().
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::removeDataRecords):
(WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
(WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
(WebKit::ResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
(WebKit::ResourceLoadStatisticsStore::debugBroadcastConsoleMessage):
* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::cancel):
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::scheduleFailure):
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRequest):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::m_messagePortChannelRegistry):
(WebKit::NetworkProcess::suspendIDBServers):
(WebKit::NetworkProcess::storageQuotaManager):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::startNetworkLoad):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::initialize):
(WebKit::PingLoad::didReceiveChallenge):
(WebKit::PingLoad::didReceiveResponse):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::fireConversionRequest):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
(WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
(WebKit::PrivateClickMeasurementManager::destroyStoreForTesting):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::ServiceWorkerSoftUpdateLoader):
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::startTransactionIfNecessary):
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::setIsHoldingLockedFiles):
* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
* Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* Shared/WebSQLiteDatabaseTracker.cpp:
(WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
* UIProcess/ApplicationStateTracker.mm:
(WebKit::ApplicationStateTracker::ApplicationStateTracker):
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::checkForResponsiveness):
* UIProcess/Cocoa/DownloadProxyMapCocoa.mm:
(WebKit::DownloadProxyMap::platformCreate):
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::modelElementDidCreatePreview):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::start):
(WebKit::SOAuthorizationSession::continueStartAfterGetAuthorizationHints):
(WebKit::SOAuthorizationSession::complete):
(WebKit::SOAuthorizationSession::presentViewController):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::scheduleActivityStateUpdate):
(WebKit::WebPageProxy::setUpHighlightsObserver):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::showSafeBrowsingWarning):
(WebKit::WebViewImpl::updateWindowAndViewFrames):
(WebKit::WebViewImpl::scheduleSetTopContentInsetDispatch):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::prepareForMoveToWindow):
(WebKit::WebViewImpl::validateUserInterfaceItem):
(WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
(WebKit::WebViewImpl::interpretKeyEvent):
(WebKit::WebViewImpl::firstRectForCharacterRange):
(WebKit::WebViewImpl::performKeyEquivalent):
(WebKit::WebViewImpl::keyUp):
(WebKit::WebViewImpl::keyDown):
(WebKit::WebViewImpl::flagsChanged):
(WebKit::WebViewImpl::nativeMouseEventHandler):
(WebKit::WebViewImpl::handleContextMenuTranslation):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::getGPUProcessConnection):
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::setAssertionType):
(WebKit::ProcessThrottler::sendPrepareToSuspendIPC):
* UIProcess/SpeechRecognitionPermissionManager.cpp:
(WebKit::SpeechRecognitionPermissionManager::requestUserPermission):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::grantRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::updateCaptureDevices):
* UIProcess/WebAuthentication/Authenticator.cpp:
(WebKit::Authenticator::handleRequest):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManager::clearStateAsync):
(WebKit::AuthenticatorManager::downgrade):
(WebKit::AuthenticatorManager::requestPin):
(WebKit::AuthenticatorManager::runPanel):
* UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
(WebKit::AuthenticatorTransportService::startDiscovery):
(WebKit::AuthenticatorTransportService::restartDiscovery):
* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::makeCredential):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterDecidePolicy):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterReceivingLAContext):
(WebKit::LocalAuthenticator::continueMakeCredentialAfterUserVerification):
(WebKit::LocalAuthenticator::getAssertion):
(WebKit::LocalAuthenticator::continueGetAssertionAfterResponseSelected):
* UIProcess/WebAuthentication/Cocoa/NfcService.mm:
(WebKit::NfcService::platformStartDiscovery):
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::send):
(WebKit::MockHidConnection::feedReports):
(WebKit::MockHidConnection::continueFeedReports):
* UIProcess/WebAuthentication/Mock/MockNfcService.mm:
(WebKit::MockNfcService::receiveStartPolling):
* UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
(WebKit::WebAuthnProcessProxy::getWebAuthnProcessConnection):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::makeCredential):
(WebKit::CtapAuthenticator::getAssertion):
(WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::continueGetNextAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::getRetries):
(WebKit::CtapAuthenticator::continueGetKeyAgreementAfterGetRetries):
(WebKit::CtapAuthenticator::continueRequestPinAfterGetKeyAgreement):
(WebKit::CtapAuthenticator::continueGetPinTokenAfterRequestPin):
* UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
(WebKit::CtapHidDriver::Worker::transact):
(WebKit::CtapHidDriver::Worker::write):
(WebKit::CtapHidDriver::transact):
(WebKit::CtapHidDriver::continueAfterChannelAllocated):
* UIProcess/WebAuthentication/fido/FidoService.cpp:
(WebKit::FidoService::getInfo):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
(WebKit::U2fAuthenticator::issueCommand):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::tryClose):
(WebKit::WebPageProxy::setUnderPageBackgroundColorOverride):
(WebKit::WebPageProxy::handlePreventableTouchEvent):
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::runModalJavaScriptDialog):
(WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
(WebKit::WebPageProxy::contextMenuItemSelected):
(WebKit::WebPageProxy::createMediaSessionCoordinator):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::getGPUProcessConnection):
(WebKit::WebProcessPool::getWebAuthnProcessConnection):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::isResponsive):
(WebKit::WebProcessProxy::isResponsiveWithLazyStop):
(WebKit::WebProcessProxy::establishServiceWorkerContext):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
* UIProcess/XR/PlatformXRSystem.cpp:
(WebKit::PlatformXRSystem::initializeTrackingAndRendering):
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::acquireSync):
(WebKit::ProcessAndUIAssertion::processAssertionWasInvalidated):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::willOpenAppLink):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
(WebKit::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::updateCaptureDevices):
* WebProcess/WebCoreSupport/WebPermissionController.cpp:
(WebKit::WebPermissionController::tryProcessingRequests):
* WebProcess/WebCoreSupport/WebSpeechSynthesisClient.cpp:
(WebKit::WebSpeechSynthesisClient::speak):
(WebKit::WebSpeechSynthesisClient::pause):
(WebKit::WebSpeechSynthesisClient::resume):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::sendDidFirstLayerFlushIfNeeded):
(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
(WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded):
2021-10-12 Brent Fulgham <bfulgham@apple.com>
Sandbox complexity and performance improvements
https://bugs.webkit.org/show_bug.cgi?id=231184
<rdar://problem/47565664>
Reviewed by Per Arne Vollan.
This patch adopts a set of suggested improvements made by Apple's Sandbox team:
1. Minimize regex usage
2. Remove duplicate rules
3. Remove 'defined?' checks for the many things that are supported in all WebKit target OSes.
These will simplify the rules, and should provide some launch time improvement.
* 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-10-12 Per Arne Vollan <pvollan@apple.com>
[iOS][GPUP] Remove sandbox access to com.apple.audio.AudioComponentRegistrar
https://bugs.webkit.org/show_bug.cgi?id=231583
<rdar://75225970>
Reviewed by Brent Fulgham.
Remove sandbox access to com.apple.audio.AudioComponentRegistrar in GPUP on iOS, since it is not required there.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-10-12 Wenson Hsieh <wenson_hsieh@apple.com>
Add some missing WebCore:: namespaces in RemoteDisplayListRecorderProxy
https://bugs.webkit.org/show_bug.cgi?id=231584
Reviewed by Myles C. Maxfield.
A tiny bit of cleanup before #230860.
* GPUProcess/graphics/RemoteDisplayListRecorder.h:
(WebKit::RemoteDisplayListRecorder::handleItem):
Drive-by fix: also add a missing call to `std::forward` when applying display list items with additional
resources as arguments.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
Add the missing `WebCore::` prefixes.
2021-10-12 Alex Christensen <achristensen@webkit.org>
Remove non-HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) code
https://bugs.webkit.org/show_bug.cgi?id=231579
Reviewed by Chris Dumez.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(processServerTrustEvaluation):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
2021-10-12 Simon Fraser <simon.fraser@apple.com>
Have the ScrollingTree track nodes with animated scrolls
https://bugs.webkit.org/show_bug.cgi?id=231554
Reviewed by Tim Horton.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition):
2021-10-12 Alex Christensen <achristensen@webkit.org>
Begin migration from WTF::Variant to std::variant
https://bugs.webkit.org/show_bug.cgi?id=231086
Reviewed by Chris Dumez.
* Platform/IPC/ArgumentCoders.h:
(IPC::VariantCoder::encode):
(IPC::VariantCoder::decode):
2021-10-12 Per Arne Vollan <pvollan@apple.com>
[iOS] Add syscall telemetry in the WebContent process' sandbox
https://bugs.webkit.org/show_bug.cgi?id=231508
<rdar://83197060>
Reviewed by Brent Fulgham.
Add syscall telemetry in the WebContent process' sandbox to learn more about the context in which they are being used.
This patch also removes some telemetry with backtraces for other rules, since they are no longer needed.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-10-12 Per Arne Vollan <pvollan@apple.com>
[GPUP] Add missing entitlement
https://bugs.webkit.org/show_bug.cgi?id=231499
<rdar://83847918>
Reviewed by Brent Fulgham.
Add the entitlement "com.apple.private.webkit.use-xpc-endpoint" in the GPU process,
which will enable XPC communication with other WebKit processes.
* Scripts/process-entitlements.sh:
2021-10-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r283890.
https://bugs.webkit.org/show_bug.cgi?id=231567
Introduced crash
Reverted changeset:
"Block access in sandbox to capability which is allowed by
default"
https://bugs.webkit.org/show_bug.cgi?id=231079
https://commits.webkit.org/r283890
2021-10-12 Youenn Fablet <youenn@apple.com>
Error the encoder in case we cannot create a RemoteVideoSample
https://bugs.webkit.org/show_bug.cgi?id=231505
<rdar://83975229>
Reviewed by Eric Carlson.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::encodeFrame):
RemoteVideoSample::create can return nullptr if we cannot get an IOSurface from the pixel buffer or if pixel buffer is null
due to VTPixelBufferConformerCopyConformedPixelBuffer failing.
In that case, we error the encoder instead of trying to encode the frame.
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 8: Consolidate DisplayList::ResourceHeap
https://bugs.webkit.org/show_bug.cgi?id=231411
<rdar://problem/84013167>
Reviewed by Simon Fraser.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::submit):
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::deleteAllFonts):
(WebKit::RemoteResourceCache::maybeRemoveResource):
(WebKit::RemoteResourceCache::updateHasActiveDrawables):
* GPUProcess/graphics/RemoteResourceCache.h:
(WebKit::RemoteResourceCache::resourceHeap const):
(WebKit::RemoteResourceCache::imageBuffers const): Deleted.
(WebKit::RemoteResourceCache::nativeImages const): Deleted.
(WebKit::RemoteResourceCache::fonts const): Deleted.
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 5: Migrate RemoteResourceCache to QualifiedRenderingResourceIdentifier
https://bugs.webkit.org/show_bug.cgi?id=231407
<rdar://problem/84010479>
Reviewed by Said Abou-Hallawa.
This pushes QualifiedRenderingResourceIdentifier down into RemoteResourceCache, but doesn't go all the way.
This patch augments RemoteResourceCache's API to accept QualifiedRenderingResourceIdentifiers, and also
migrates RemoteResourceCache::m_resourceUseCounters to use QualifiedRenderingResourceIdentifiers.
RemoteResourceCache::m_imageBuffers, RemoteResourceCache::m_nativeImages, and RemoteResourceCache::m_fonts
are WebCore typedefs, and are passed to WebCore's display list replaying code, but that code should have no
notion of process identifiers. Therefore, in order to make those members hold data that WebCore doesn't
understand, I'm going to have to wrap an opaque class around them and pass that class around instead of
the raw HashMaps. I'll do that in another patch.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::setStateWithQualifiedIdentifiers):
(WebKit::RemoteDisplayListRecorder::clipToImageBufferWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawGlyphsWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawNativeImageWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawPatternWithQualifiedIdentifier):
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::ReplayerDelegate):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::recordResourceUse):
(WebKit::RemoteRenderingBackend::submit):
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::ensureResourceUseCounter):
(WebKit::RemoteResourceCache::maybeRemoveResource):
(WebKit::RemoteResourceCache::recordResourceUse):
(WebKit::RemoteResourceCache::releaseRemoteResource):
* GPUProcess/graphics/RemoteResourceCache.h:
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 6: Uniquify more of RemoteDisplayListRecorder at entry points
https://bugs.webkit.org/show_bug.cgi?id=231552
<rdar://problem/84130587>
This is an extension of https://bugs.webkit.org/show_bug.cgi?id=231548. It applies QualifiedRenderingResourceIdentifiers
at the rest of the entry points of RemoteDisplayListRecorder.
Reviewed by Wenson Hsieh.
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::setState):
(WebKit::RemoteDisplayListRecorder::setStateWithQualifiedIdentifiers):
(WebKit::RemoteDisplayListRecorder::drawGlyphs):
(WebKit::RemoteDisplayListRecorder::drawGlyphsWithQualifiedIdentifier):
* GPUProcess/graphics/RemoteDisplayListRecorder.h:
2021-10-11 Simon Fraser <simon.fraser@apple.com>
Make DrawingAreaType an enum class
https://bugs.webkit.org/show_bug.cgi?id=231543
Reviewed by Wenson Hsieh.
Make DrawingAreaType an enum class, and make the DrawingArea type member const.
* Shared/DrawingAreaInfo.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::isUsingUISideCompositing const):
* UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics):
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDrawingArea):
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::WebPageProxy::enterAcceleratedCompositingMode):
(WebKit::WebPageProxy::didFirstLayerFlush):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createScrollingCoordinator const):
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::DrawingAreaCoordinatedGraphics):
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::create):
(WebKit::DrawingArea::supportsGPUProcessRendering):
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 5: Uniquify RemoteDisplayListRecorder at entry points
https://bugs.webkit.org/show_bug.cgi?id=231548
<rdar://problem/84128595>
Reviewed by Wenson Hsieh.
This simply applies the same treatment in https://commits.webkit.org/242676@main to
RemoteDisplayListRecorder. This is being done in a follow-up patch because it
relies on https://bugs.webkit.org/show_bug.cgi?id=231484.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::RemoteDisplayListRecorder):
(WebKit::RemoteDisplayListRecorder::clipToImageBuffer):
(WebKit::RemoteDisplayListRecorder::clipToImageBufferWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawImageBuffer):
(WebKit::RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawNativeImage):
(WebKit::RemoteDisplayListRecorder::drawNativeImageWithQualifiedIdentifier):
(WebKit::RemoteDisplayListRecorder::drawPattern):
(WebKit::RemoteDisplayListRecorder::drawPatternWithQualifiedIdentifier):
* GPUProcess/graphics/RemoteDisplayListRecorder.h:
(WebKit::RemoteDisplayListRecorder::create):
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
Revert 242806@main because it broke the build
https://bugs.webkit.org/show_bug.cgi?id=231546
Unreviewed.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::ReplayerDelegate):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::recordResourceUse):
(WebKit::RemoteRenderingBackend::submit):
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::ensureResourceUseCounter):
(WebKit::RemoteResourceCache::maybeRemoveResource):
(WebKit::RemoteResourceCache::recordResourceUse):
(WebKit::RemoteResourceCache::releaseRemoteResource):
* GPUProcess/graphics/RemoteResourceCache.h:
2021-10-11 Wenson Hsieh <wenson_hsieh@apple.com>
Clean up some code in DisplayList::Recorder in preparation for bug #230860
https://bugs.webkit.org/show_bug.cgi?id=231532
Reviewed by Myles C. Maxfield.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordGetPixelBuffer): Deleted.
(WebKit::RemoteDisplayListRecorderProxy::recordPutPixelBuffer): Deleted.
See WebCore ChangeLog for more details.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
2021-10-11 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 5: Migrate RemoteResourceCache to QualifiedRenderingResourceIdentifier
https://bugs.webkit.org/show_bug.cgi?id=231407
<rdar://problem/84010479>
Reviewed by Said Abou-Hallawa.
This pushes QualifiedRenderingResourceIdentifier down into RemoteResourceCache, but doesn't go all the way.
This patch augments RemoteResourceCache's API to accept QualifiedRenderingResourceIdentifiers, and also
migrates RemoteResourceCache::m_resourceUseCounters to use QualifiedRenderingResourceIdentifiers.
RemoteResourceCache::m_imageBuffers, RemoteResourceCache::m_nativeImages, and RemoteResourceCache::m_fonts
are WebCore typedefs, and are passed to WebCore's display list replaying code, but that code should have no
notion of process identifiers. Therefore, in order to make those members hold data that WebCore doesn't
understand, I'm going to have to wrap an opaque class around them and pass that class around instead of
the raw HashMaps. I'll do that in another patch.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::ReplayerDelegate):
(WebKit::RemoteRenderingBackend::ReplayerDelegate::recordResourceUse):
(WebKit::RemoteRenderingBackend::submit):
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cacheFont):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::ensureResourceUseCounter):
(WebKit::RemoteResourceCache::maybeRemoveResource):
(WebKit::RemoteResourceCache::recordResourceUse):
(WebKit::RemoteResourceCache::releaseRemoteResource):
* GPUProcess/graphics/RemoteResourceCache.h:
2021-10-11 Wenson Hsieh <wenson_hsieh@apple.com>
Introduce RemoteDisplayListRecorderProxy and RemoteDisplayListRecorder
https://bugs.webkit.org/show_bug.cgi?id=231484
Reviewed by Simon Fraser.
Introduce two new classes that house most of the logic for propagating display list items from the web content
process to the GPU process. RemoteDisplayListRecorderProxy is a subclass of DisplayList::Recorder that records
each item by sending it to the GPU process through a stream connection, which will be added to
RemoteRenderingBackendProxy in a subsequent patch. The RemoteDisplayListRecorderProxy will be managed by
RemoteImageBufferProxy in the web process. RemoteDisplayListRecorder acts as the streaming IPC destination in
the GPU process, and handles the incoming display list items by applying them to the platform graphics context.
For most of these display list items, we can propagate them to the GPU process by sending each display list
item's constructor arguments as separate IPC arguments. In a future patch, we should add support for encoding
the following display list items in the same way:
- SetInlineFillColor
- SetInlineStrokeColor
- SetState
- SetLineDash
- DrawGlyphs
- DrawLinesForText
- FillRectWithGradient
For now, the above display list items are encoded and decoded as whole items. While there's no practical
disadvantage to implementing it this way, it would be nice to make it consistent.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp: Added.
(WebKit::RemoteDisplayListRecorder::RemoteDisplayListRecorder):
(WebKit::RemoteDisplayListRecorder::resourceCache):
(WebKit::RemoteDisplayListRecorder::drawingContext):
(WebKit::RemoteDisplayListRecorder::startListeningForIPC):
(WebKit::RemoteDisplayListRecorder::stopListeningForIPC):
(WebKit::RemoteDisplayListRecorder::save):
(WebKit::RemoteDisplayListRecorder::restore):
(WebKit::RemoteDisplayListRecorder::translate):
(WebKit::RemoteDisplayListRecorder::rotate):
(WebKit::RemoteDisplayListRecorder::scale):
(WebKit::RemoteDisplayListRecorder::setCTM):
(WebKit::RemoteDisplayListRecorder::concatenateCTM):
(WebKit::RemoteDisplayListRecorder::setInlineFillColor):
(WebKit::RemoteDisplayListRecorder::setInlineStrokeColor):
(WebKit::RemoteDisplayListRecorder::setStrokeThickness):
(WebKit::RemoteDisplayListRecorder::setState):
(WebKit::RemoteDisplayListRecorder::setLineCap):
(WebKit::RemoteDisplayListRecorder::setLineDash):
(WebKit::RemoteDisplayListRecorder::setLineJoin):
(WebKit::RemoteDisplayListRecorder::setMiterLimit):
(WebKit::RemoteDisplayListRecorder::clearShadow):
(WebKit::RemoteDisplayListRecorder::clip):
(WebKit::RemoteDisplayListRecorder::clipOut):
(WebKit::RemoteDisplayListRecorder::clipToImageBuffer):
(WebKit::RemoteDisplayListRecorder::clipOutToPath):
(WebKit::RemoteDisplayListRecorder::clipPath):
(WebKit::RemoteDisplayListRecorder::beginClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorder::endClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorder::drawGlyphs):
(WebKit::RemoteDisplayListRecorder::drawImageBuffer):
(WebKit::RemoteDisplayListRecorder::drawNativeImage):
(WebKit::RemoteDisplayListRecorder::drawPattern):
(WebKit::RemoteDisplayListRecorder::beginTransparencyLayer):
(WebKit::RemoteDisplayListRecorder::endTransparencyLayer):
(WebKit::RemoteDisplayListRecorder::drawRect):
(WebKit::RemoteDisplayListRecorder::drawLine):
(WebKit::RemoteDisplayListRecorder::drawLinesForText):
(WebKit::RemoteDisplayListRecorder::drawDotsForDocumentMarker):
(WebKit::RemoteDisplayListRecorder::drawEllipse):
(WebKit::RemoteDisplayListRecorder::drawPath):
(WebKit::RemoteDisplayListRecorder::drawFocusRingPath):
(WebKit::RemoteDisplayListRecorder::drawFocusRingRects):
(WebKit::RemoteDisplayListRecorder::fillRect):
(WebKit::RemoteDisplayListRecorder::fillRectWithColor):
(WebKit::RemoteDisplayListRecorder::fillRectWithGradient):
(WebKit::RemoteDisplayListRecorder::fillCompositedRect):
(WebKit::RemoteDisplayListRecorder::fillRoundedRect):
(WebKit::RemoteDisplayListRecorder::fillRectWithRoundedHole):
(WebKit::RemoteDisplayListRecorder::fillLine):
(WebKit::RemoteDisplayListRecorder::fillArc):
(WebKit::RemoteDisplayListRecorder::fillQuadCurve):
(WebKit::RemoteDisplayListRecorder::fillBezierCurve):
(WebKit::RemoteDisplayListRecorder::fillPath):
(WebKit::RemoteDisplayListRecorder::fillEllipse):
(WebKit::RemoteDisplayListRecorder::getPixelBuffer):
(WebKit::RemoteDisplayListRecorder::putPixelBuffer):
(WebKit::RemoteDisplayListRecorder::paintFrameForMedia):
(WebKit::RemoteDisplayListRecorder::strokeRect):
(WebKit::RemoteDisplayListRecorder::strokeLine):
(WebKit::RemoteDisplayListRecorder::strokeArc):
(WebKit::RemoteDisplayListRecorder::strokeQuadCurve):
(WebKit::RemoteDisplayListRecorder::strokeBezierCurve):
(WebKit::RemoteDisplayListRecorder::strokePath):
(WebKit::RemoteDisplayListRecorder::strokeEllipse):
(WebKit::RemoteDisplayListRecorder::clearRect):
(WebKit::RemoteDisplayListRecorder::applyStrokePattern):
(WebKit::RemoteDisplayListRecorder::applyFillPattern):
(WebKit::RemoteDisplayListRecorder::applyDeviceScaleFactor):
(WebKit::RemoteDisplayListRecorder::flushContext):
* GPUProcess/graphics/RemoteDisplayListRecorder.h: Added.
(WebKit::RemoteDisplayListRecorder::create):
(WebKit::RemoteDisplayListRecorder::handleItem):
* GPUProcess/graphics/RemoteDisplayListRecorder.messages.in: Added.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::performWithMediaPlayerOnMainThread):
* GPUProcess/graphics/RemoteRenderingBackend.h:
Add helper methods to RemoteRenderingBackend that are called from RemoteDisplayListRecorder.
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:
Make it possible to encode and decode SetInlineFillColor and SetInlineStrokeColor using simple argument coder.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: Added.
(WebKit::RemoteDisplayListRecorderProxy::RemoteDisplayListRecorderProxy):
(WebKit::m_renderingBackend):
(WebKit::RemoteDisplayListRecorderProxy::getPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::putPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::canDrawImageBuffer const):
(WebKit::RemoteDisplayListRecorderProxy::renderingMode const):
(WebKit::RemoteDisplayListRecorderProxy::recordSave):
(WebKit::RemoteDisplayListRecorderProxy::recordRestore):
(WebKit::RemoteDisplayListRecorderProxy::recordTranslate):
(WebKit::RemoteDisplayListRecorderProxy::recordRotate):
(WebKit::RemoteDisplayListRecorderProxy::recordScale):
(WebKit::RemoteDisplayListRecorderProxy::recordSetCTM):
(WebKit::RemoteDisplayListRecorderProxy::recordConcatenateCTM):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineFillColor):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineStrokeColor):
(WebKit::RemoteDisplayListRecorderProxy::recordSetStrokeThickness):
(WebKit::RemoteDisplayListRecorderProxy::recordSetState):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineCap):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineDash):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineJoin):
(WebKit::RemoteDisplayListRecorderProxy::recordSetMiterLimit):
(WebKit::RemoteDisplayListRecorderProxy::recordClearShadow):
(WebKit::RemoteDisplayListRecorderProxy::recordClip):
(WebKit::RemoteDisplayListRecorderProxy::recordClipOut):
(WebKit::RemoteDisplayListRecorderProxy::recordClipToImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordClipOutToPath):
(WebKit::RemoteDisplayListRecorderProxy::recordClipPath):
(WebKit::RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawGlyphs):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawNativeImage):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
(WebKit::RemoteDisplayListRecorderProxy::recordBeginTransparencyLayer):
(WebKit::RemoteDisplayListRecorderProxy::recordEndTransparencyLayer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawRect):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawLine):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawLinesForText):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawDotsForDocumentMarker):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPath):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingPath):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingRects):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithColor):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithGradient):
(WebKit::RemoteDisplayListRecorderProxy::recordFillCompositedRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRoundedRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithRoundedHole):
(WebKit::RemoteDisplayListRecorderProxy::recordFillLine):
(WebKit::RemoteDisplayListRecorderProxy::recordFillArc):
(WebKit::RemoteDisplayListRecorderProxy::recordFillQuadCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordFillBezierCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordFillPath):
(WebKit::RemoteDisplayListRecorderProxy::recordFillEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordGetPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordPutPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordPaintFrameForMedia):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeRect):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeLine):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeArc):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeQuadCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeBezierCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokePath):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordClearRect):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyStrokePattern):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyFillPattern):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyDeviceScaleFactor):
(WebKit::RemoteDisplayListRecorderProxy::recordResourceUse):
(WebKit::RemoteDisplayListRecorderProxy::flushContext):
(WebKit::RemoteDisplayListRecorderProxy::createNestedContext):
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: Added.
(WebKit::RemoteDisplayListRecorderProxy::~RemoteDisplayListRecorderProxy):
(WebKit::RemoteDisplayListRecorderProxy::resetNeedsFlush):
(WebKit::RemoteDisplayListRecorderProxy::needsFlush const):
(WebKit::RemoteDisplayListRecorderProxy::send):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::recordNativeImageUse):
(WebKit::RemoteRenderingBackendProxy::recordFontUse):
(WebKit::RemoteRenderingBackendProxy::recordImageBufferUse):
(WebKit::RemoteRenderingBackendProxy::isCached const):
Add helper methods to RemoteRenderingBackendProxy that are called from RemoteDisplayListRecorderProxy.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::sendToStream):
2021-10-11 Dean Jackson <dino@apple.com>
Disable SystemPreview in WKContentProviderRegistry
https://bugs.webkit.org/show_bug.cgi?id=231538
rdar://84110761
Reviewed by Tim Horton.
Disable the WebViewContentProvider for System Previews
if UIKIT_WEBKIT_INTERNALS is true.
* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry initWithConfiguration:]):
* UIProcess/ios/WKSystemPreviewView.h:
* UIProcess/ios/WKSystemPreviewView.mm:
2021-10-11 Alex Christensen <achristensen@webkit.org>
Unified build fix
https://bugs.webkit.org/show_bug.cgi?id=231524
Reviewed by Chris Dumez.
This adds some missing includes and things to fix the build once I add some more files, making the unified build combine differently
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm:
(-[WKNetworkSessionDelegateAllowingOnlyNonRedirectedJSON URLSession:dataTask:didReceiveResponse:completionHandler:]):
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
2021-10-11 Per Arne Vollan <pvollan@apple.com>
[macOS] Grant access in sandbox to 'system-privilege' for root
https://bugs.webkit.org/show_bug.cgi?id=231501
<rdar://83959448>
Reviewed by Brent Fulgham.
When running as root, WebKit processes need access to 'system-privilege'.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-11 Simon Fraser <simon.fraser@apple.com>
Smooth-scroll animations should run in the UI process on iOS
https://bugs.webkit.org/show_bug.cgi?id=204936
Reviewed by Tim Horton.
Implement animated scrolls in the UI process for UI-side compositing. The scrolling tree
decoded in the UI process has a RequestedScrollData with the 'animated' flag. This is
processed by handleScrollPositionRequest() as normal.
ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition() responds by calling
through to the delegate, which simply calls -[setContentOffset:animated:YES] on the
UIScrollView.
Main frame scrolls are a little different because the programmatic scroll needs to be
handled after layer tree commits; leverage the existing
RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll() code, but clean it up to
share the RequestedScrollData type, and have commitScrollingTreeState() return
std::optional<RequestedScrollData> instead of storing a pointer to a struct on the stack as
it did before. The various requestScroll() functions take a ScrollIsAnimated flag which
turns into -[setContentOffset:animated:YES] in WKWebView.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(WebKit::dump):
* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/API/ios/WKWebViewIOS.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _scrollToContentScrollPosition:scrollOrigin:animated:]):
(-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]): Deleted.
* UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/API/wpe/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): The delegate's
commitStateAfterChildren() has to run first to update UIScrollView state before the programmatic scroll
is handled in the base class.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): The delegate's
commitStateAfterChildren() has to run first to update UIScrollView state before the programmatic scroll
is handled in the base class.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::startAnimatedScrollToPosition):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::stopAnimatedScroll):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollLayer const): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActions const): Deleted.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::clearActiveTouchActions): Deleted.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestScroll):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/playstation/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/playstation/PageClientImpl.h:
* UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::requestScroll):
* UIProcess/win/PageClientImpl.h:
2021-10-11 Alex Christensen <achristensen@webkit.org>
Prepare to switch from WTF::Variant to std::variant
https://bugs.webkit.org/show_bug.cgi?id=231239
Reviewed by Chris Dumez.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
* Platform/IPC/FormDataReference.h:
(IPC::FormDataReference::encode const):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::locateIterator const):
* UIProcess/API/APIWebAuthenticationPanel.h:
* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2021-10-11 Alex Christensen <achristensen@webkit.org>
Add AdAttributionDaemon sandbox on iOS
https://bugs.webkit.org/show_bug.cgi?id=231308
Reviewed by Brent Fulgham.
This makes it so that AdAttributionDaemon has enough permission to access the network and its storage file and not much else.
* Configurations/AdAttributionDaemon.xcconfig:
* Resources/SandboxProfiles/ios/com.apple.WebKit.AdAttributionDaemon.sb: Added.
* Scripts/process-entitlements.sh:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::enterSandbox):
* WebKit.xcodeproj/project.pbxproj:
2021-10-11 Per Arne Vollan <pvollan@apple.com>
[iOS] Sort syscall filters in the WebContent process' sandbox
https://bugs.webkit.org/show_bug.cgi?id=231509
<rdar://problem/84095366>
Unreviewed, this patch only sorts existing message filters.
Syscall filters should be sorted in the WebContent process' sandbox. This patch does not add or
remove items from the filters, so there should be no change in behavior.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-10-11 Per Arne Vollan <pvollan@apple.com>
Block access in sandbox to capability which is allowed by default
https://bugs.webkit.org/show_bug.cgi?id=231079
<rdar://66586853>
Reviewed by Brent Fulgham.
Some capabilities are allowed by default, and needs to be explicitly denied in the sandbox.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-11 Per Arne Vollan <pvollan@apple.com>
[iOS] Add message filter in the WebContent process' sandbox
https://bugs.webkit.org/show_bug.cgi?id=231046
<rdar://problem/83743661>
Reviewed by Brent Fulgham.
Add IOKit message filter in the WebContent process' sandbox on iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-10-10 Sihui Liu <sihui_liu@apple.com>
Add support for iterating FileSystemDirectoryHandle
https://bugs.webkit.org/show_bug.cgi?id=231142
<rdar://problem/83848092>
Reviewed by Youenn Fablet and Yusuke Suzuki.
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::FileSystemStorageHandle):
(WebKit::FileSystemStorageHandle::getHandleNames):
(WebKit::FileSystemStorageHandle::getHandle):
* NetworkProcess/storage/FileSystemStorageHandle.h:
(WebKit::FileSystemStorageHandle::type const):
* NetworkProcess/storage/FileSystemStorageManager.cpp:
(WebKit::FileSystemStorageManager::createHandle):
(WebKit::FileSystemStorageManager::getType):
* NetworkProcess/storage/FileSystemStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::getHandleNames):
(WebKit::NetworkStorageManager::getHandle):
* NetworkProcess/storage/NetworkStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp:
(WebKit::WebFileSystemStorageConnection::getFileHandle):
(WebKit::WebFileSystemStorageConnection::getDirectoryHandle):
(WebKit::WebFileSystemStorageConnection::getHandleNames):
(WebKit::WebFileSystemStorageConnection::getHandle):
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h:
2021-10-10 Michael Catanzaro <mcatanzaro@gnome.org>
[WPE] Expose WKTextCheckerSetContinuousSpellCheckingEnabled and use it from WKTR
https://bugs.webkit.org/show_bug.cgi?id=231446
Reviewed by Philippe Normand.
This is to avoid WKTR needing to poke WebKit internals to turn on spellchecking.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/API/C/glib/WKTextCheckerGLib.cpp: Renamed from Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp.
(WKTextCheckerSetClient):
(WKTextCheckerContinuousSpellCheckingEnabledStateChanged):
(WKTextCheckerGrammarCheckingEnabledStateChanged):
(WKTextCheckerCheckSpelling):
(WKTextCheckerChangeSpellingToWord):
(WKTextCheckerSetSpellCheckingLanguages):
(WKTextCheckerSetContinuousSpellCheckingEnabled):
* UIProcess/API/C/glib/WKTextCheckerGLib.h: Renamed from Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.h.
* UIProcess/gtk/WebTextChecker.h:
* UIProcess/gtk/WebTextCheckerClient.h:
2021-10-09 Simon Fraser <simon.fraser@apple.com>
Run smooth scroll animations on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231481
Reviewed by Tim Horton.
Implement AsyncScrollingCoordinator::requestAnimatedScrollToPosition() and stopAnimatedScroll()
so that smooth scroll animations are dispatched to the scrolling thread.
RequestedScrollData gains a requestType field so that we can indicate the need
to cancel a running animation on the scrolling thread.
Tested by tests in imported/w3c/web-platform-tests/css/cssom-view.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<RequestedScrollData>::encode):
(ArgumentCoder<RequestedScrollData>::decode):
(WebKit::dump):
2021-10-08 BJ Burg <bburg@apple.com>
[Cocoa] Web Inspector: provide a way for _WKInspectorExtension clients to be notified when the inspected page navigates
https://bugs.webkit.org/show_bug.cgi?id=231338
<rdar://71200338>
Reviewed by Devin Rousso.
Add plumbing for a new event to pass from WebInspectorUI out to _WKInspectorExtensionDelegate.
* UIProcess/API/APIInspectorExtensionClient.h:
(API::InspectorExtensionClient::inspectedPageDidNavigate):
* UIProcess/API/Cocoa/_WKInspectorExtensionDelegate.h:
* UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.h:
* UIProcess/Inspector/Cocoa/InspectorExtensionDelegate.mm:
(WebKit::InspectorExtensionDelegate::InspectorExtensionDelegate):
(WebKit::InspectorExtensionDelegate::InspectorExtensionClient::inspectedPageDidNavigate):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.messages.in:
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::inspectedPageDidNavigate):
Call the delegate method for all _WKInspectorExtensions associated with this
id<_WKInspectorExtensionHost>. Clients can map from extension to inspector if needed.
* WebProcess/Inspector/RemoteWebInspectorUI.h:
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::inspectedPageDidNavigate):
* WebProcess/Inspector/WebInspectorUI.h:
* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::inspectedPageDidNavigate):
* WebProcess/Inspector/WebInspectorUIExtensionController.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::inspectedPageDidNavigate):
2021-10-08 Jer Noble <jer.noble@apple.com>
[Build-time perf] Forward-declare more things in Element.h
https://bugs.webkit.org/show_bug.cgi?id=231283
Reviewed by Myles C. Maxfield.
Include ElementInlines.h in various necessary places.
* Shared/TouchBarMenuData.cpp:
* Shared/TouchBarMenuItemData.cpp:
* Shared/glib/InputMethodState.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
* WebProcess/cocoa/PlaybackSessionManager.mm:
2021-10-08 Simon Fraser <simon.fraser@apple.com>
Ensure that animated scrolls will run on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231441
Reviewed by Tim Horton.
On macOS, scrolling tree commits run on the main thread (holding a lock), so we can't start
scroll animations directly inside the commit because then they will run on the main thread.
Fix by adding ScrollingTree::didCommitTree(), and having ThreadedScrollingTree override it
to bounce to the scrolling tree to start animations. We also have to intercept requested scroll
position updates via ScrollingTree::scrollingTreeNodeRequestsScroll(); ThreadedScrollingTree
uses this to put pending animations into m_nodesWithPendingScrollAnimations.
Now that ScrollingTreeScrollingNode::commitStateAfterChildren() responds to
RequestedScrollPosition changes by calling handleScrollPositionRequest(), we can remove code
in derived classes that did the same thing.
Not yet tested because animated scrolls don't yet get to the scrolling tree.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
2021-10-08 Wenson Hsieh <wenson_hsieh@apple.com>
Split DisplayList::Recorder into an abstract base class and a concrete implementation
https://bugs.webkit.org/show_bug.cgi?id=231404
Reviewed by Myles Maxfield.
See WebCore/ChangeLog for more details.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-10-08 Ben Nham <nham@apple.com>
Fix crash in NetworkProcess preconnect due to dereferencing deallocated session
https://bugs.webkit.org/show_bug.cgi?id=231456
<rdar://problem/83752148>
Reviewed by Chris Dumez.
We capture a raw NetworkSession reference in the preconnect completion handler. This
reference could point to a deallocated object if the NetworkSession dies before the
preconnect finishes.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
2021-10-08 John Pascoe <j_pascoe@apple.com>
Update getAllLocalAuthenticatorCredentials query according to internal needs
https://bugs.webkit.org/show_bug.cgi?id=231439
rdar://84032359
Reviewed by Tim Horton.
Covered by manual tests.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(updateQueryIfNecessary):
(getAllLocalAuthenticatorCredentialsImpl):
2021-10-08 Basuke Suzuki <basuke.suzuki@sony.com>
Fix build break after r283796 when ENABLE_SERVICE_WORKER is off
https://bugs.webkit.org/show_bug.cgi?id=231440
Unreviewed build fix.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::hasServiceWorkerBackgroundActivityForTesting const):
2021-10-08 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 4: Migrate PendingWakeupInformation to QualifiedRenderingResourceIdentifier
https://bugs.webkit.org/show_bug.cgi?id=231406
<rdar://problem/84009999>
Reviewed by Wenson Hsieh.
This starts pushing QualifiedRenderingResourceIdentifier into a few more places. It's being pushed into
PendingWakeupInformation and RemoteImageBuffer. (I can't split this patch up any further because the
pieces intermingle.)
The next step is to push QualifiedRenderingResourceIdentifier down into RemoteResourceCache.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteImageBuffer.h:
(WebKit::RemoteImageBuffer::create):
(WebKit::RemoteImageBuffer::RemoteImageBuffer):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::didCreateImageBufferBackend):
(WebKit::RemoteRenderingBackend::didFlush):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::setNextItemBufferToRead):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
(WebKit::RemoteRenderingBackend::resumeFromPendingWakeupInformation):
* GPUProcess/graphics/RemoteRenderingBackend.h:
(WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const):
2021-10-08 Tim Horton <timothy_horton@apple.com>
defaultAlternateFormControlDesignEnabled() can't read UIUserInterfaceIdiom in the Web Content process
https://bugs.webkit.org/show_bug.cgi?id=231416
<rdar://problem/84009054>
Reviewed by Anders Carlsson.
It turns out WebPreferences default getters are run in the Web Content process,
which is a problem for defaultAlternateFormControlDesignEnabled because
it needs to consult with application state.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
Explicitly initialize this preference in the UI process.
2021-10-08 Michael Catanzaro <mcatanzaro@gnome.org>
REGRESSION(r283802): broke Apple ports
https://bugs.webkit.org/show_bug.cgi?id=231434
Unreviewed, revert changes to TextChecker.h that broke the iOS build.
* UIProcess/TextChecker.h:
2021-10-08 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 3: Uniquify in wakeUpAndApplyDisplayList
https://bugs.webkit.org/show_bug.cgi?id=231405
<rdar://problem/84008003>
Reviewed by Chris Dumez.
This simply applies the same treatment in https://commits.webkit.org/242676@main to
RemoteRenderingBackend::wakeUpAndApplyDisplayList(). This is being done in a follow-up
patch because it relies on https://bugs.webkit.org/show_bug.cgi?id=231403.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayListWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::resumeFromPendingWakeupInformation):
* GPUProcess/graphics/RemoteRenderingBackend.h:
(WebKit::RemoteRenderingBackend::PendingWakeupInformation::arguments const): Deleted.
2021-10-08 Philippe Normand <pnormand@igalia.com>
[WPE][Qt] API export fixes
https://bugs.webkit.org/show_bug.cgi?id=231430
Reviewed by Michael Catanzaro.
Remove internal WebKit API (GRefPtr) from the public QtWPE API, and export classes exposing
the public QtWPE API.
* UIProcess/API/wpe/qt/WPEQtView.cpp:
(WPEQtView::~WPEQtView):
(WPEQtView::createWebView):
(WPEQtView::url const):
(WPEQtView::setUrl):
(WPEQtView::loadProgress const):
(WPEQtView::title const):
(WPEQtView::canGoBack const):
(WPEQtView::isLoading const):
(WPEQtView::canGoForward const):
(WPEQtView::goBack):
(WPEQtView::goForward):
(WPEQtView::reload):
(WPEQtView::stop):
(WPEQtView::loadHtml):
(WPEQtView::runJavaScript):
* UIProcess/API/wpe/qt/WPEQtView.h:
(): Deleted.
(WPEQtView::triggerUpdate): Deleted.
(WPEQtView::errorOccured const): Deleted.
(WPEQtView::setErrorOccured): Deleted.
* UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h:
* UIProcess/TextChecker.h:
2021-10-08 Youenn Fablet <youenn@apple.com>
Bind the number of WebRTC sockets opened per process
https://bugs.webkit.org/show_bug.cgi?id=231171
Reviewed by Alex Christensen.
Migrate from HashMap to StdMap so that we can keep the order based on socket identifiers.
Take benefit of the ordering so that, above a certain size, we get the oldest socket, close it and remove it from the map.
We set the maximum size to 256 sockets per process.
Fix a potential bug in NetworkRTCTCPSocketCocoa to ensure we remove the socket from the map even if the nw connection is not live.
Manually tested.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
2021-10-08 Youenn Fablet <youenn@apple.com>
Add support for processing push events without service worker clients
https://bugs.webkit.org/show_bug.cgi?id=231285
Reviewed by Chris Dumez.
When firing a push event, ask UIProcess to take a background assertion for the process running the service worker.
We use a counter based approach to take/dispose of the backgorund assertion.
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebProcessProxy.cpp:
* UIProcess/WebProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-10-07 Simon Fraser <simon.fraser@apple.com>
Plumb "animated scroll did end" back from the scrolling tree
https://bugs.webkit.org/show_bug.cgi?id=231412
Reviewed by Tim Horton.
Before we can enable async animated scrolls, we have to get the "did end" notification back
from the scrolling thread/UI process in order to clear the ScrollAnimationStatus on
ScrollableArea.
The scroll animations are run by the ScrollingEffectsController owned by
ScrollingTreeScrollingNodeDelegateMac/ScrollingTreeScrollingNodeDelegateNicosia. Their
didStopAnimatedScroll() implementations call through the ScrollingTreeScrollingNde to the
ScrollingTree, which enqueues ScrollUpdate just as we do for scroll position changes.
ScrollUpdate is enhanced to contain an 'updateType' with a AnimatedScrollDidEnd value. When
this is received by AsyncScrollingCoordinator it clears the ScrollAnimationStatus on the
relevant FrameView/RenderLayerScrollableArea.
With UI-side compositing, AnimatedScrollDidEndForNode is an IPC message back to
RemoteScrollingCoordinator.
Not yet tested because async animated scrolls are not enabled.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidStopAnimatedScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeDidStopAnimatedScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.messages.in:
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
(WebKit::RemoteScrollingCoordinator::animatedScrollDidEndForNode):
2021-10-07 Simon Fraser <simon.fraser@apple.com>
Add some plumbing for running smooth scroll animations in the scrolling thread/UI process
https://bugs.webkit.org/show_bug.cgi?id=231402
Reviewed by Tim Horton.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<RequestedScrollData>::encode):
(ArgumentCoder<RequestedScrollData>::decode):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::startAnimatedScrollToPosition):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::stopAnimatedScroll):
2021-10-07 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 2: Unroll PendingWakeupInformation::arguments
https://bugs.webkit.org/show_bug.cgi?id=231403
Reviewed by Wenson Hsieh.
We're in the process of replacing RenderingResourceIdentifiers in the GPU process with
QualifiedRenderingResourceIdentifier. Unfortunately, PendingWakeupInformation holds
a GPUProcessWakeupMessageArguments which itself holds a RenderingResourceIdentifiers.
PendingWakeupInformation is part of the GPU process, so it needs to migrate to
QualifiedRenderingResourceIdentifier, but GPUProcessWakeupMessageArguments is the type
of the arguments to the WakeUpAndApplyDisplayList message, so it can't hold a
QualifiedRenderingResourceIdentifier.
So, the solution is to unroll PendingWakeupInformation::arguments, and hoist its fields
directly into the PendingWakeupInformation. That way, PendingWakeupInformation can be
updated to use QualifiedRenderingResourceIdentifier, without affecting
the WakeUpAndApplyDisplayList message.
No new tests because there is no behavior change.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
(WebKit::RemoteRenderingBackend::setNextItemBufferToRead):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandleWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::resumeFromPendingWakeupInformation):
* GPUProcess/graphics/RemoteRenderingBackend.h:
(WebKit::RemoteRenderingBackend::PendingWakeupInformation::arguments const):
(WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const):
2021-10-07 Simon Fraser <simon.fraser@apple.com>
Minor refactoring to use ScrollUpdate in more places
https://bugs.webkit.org/show_bug.cgi?id=231395
Reviewed by Myles C. Maxfield.
* WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode):
2021-10-07 Myles C. Maxfield <mmaxfield@apple.com>
[GPU Process] Unique RenderingResourceIdentifiers Part 1: Uniquify at entry points
https://bugs.webkit.org/show_bug.cgi?id=231281
<rdar://problem/83920780>
Reviewed by Chris Dumez.
Each web process creates its own RenderingResourceIdentifiers. Because the GPU process
can service multiple web processes, these identifiers can collide in the GPU process.
This is somewhat error prone, and might cause us to make a mistake in the future and
introduce a bug which lets one web process see another web process's resources (which
would be mega bad).
The goal of this project is to treat RenderingResourceIdentifiers in the GPU process
as a tuple of (the identifer we got from the web process, the process identifier of
the web process). This way, the tuples uniquely identify a resource across the entire
GPU process. Doing it this way makes it less likely that we'll make a mega bad mistake
in the future.
This patch is the first step: It introduces the QualifiedRenderingResourceIdentifier
type, which holds the tuple described above, and makes all the GPU process message
receivers immediately turn any RenderingResourceIdentifiers they received from the
web processes into QualifiedRenderingResourceIdentifiers. Not only do the identifiers
immediately get packed, but each message receiver now has an implementation function
which only accepts the QualifiedRenderingResourceIdentifier, so we can't make a
mistake and use the unpacked one accidentally.
Because this patch is just the first step, the QualifiedRenderingResourceIdentifiers
get unpacked eagerly, and the inner logic of the GPU process is unaffected. The
subsequent two patches will push the QualifiedRenderingResourceIdentifiers deeper
into the guts of the GPU process, eventually to the point where
RenderingResourceIdentifiers are never used there.
* GPUProcess/graphics/QualifiedRenderingResourceIdentifier.h: Added.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintRenderingResultsToCanvasWithQualifiedIdentifier):
(WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvas):
(WebKit::RemoteGraphicsContextGL::paintCompositedResultsToCanvasWithQualifiedIdentifier):
(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
(WebKit::RemoteRenderingBackend::createImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataURLForImageBuffer):
(WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getDataForImageBuffer):
(WebKit::RemoteRenderingBackend::getDataForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBuffer):
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheNativeImage):
(WebKit::RemoteRenderingBackend::cacheNativeImageWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::cacheFont):
(WebKit::RemoteRenderingBackend::cacheFontWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::releaseRemoteResource):
(WebKit::RemoteRenderingBackend::releaseRemoteResourceWithQualifiedIdentifier):
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle):
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandleWithQualifiedIdentifier):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* WebKit.xcodeproj/project.pbxproj:
2021-10-07 Arcady Goldmints-Orlov <agoldmints@igalia.com>
[GTK][WPE] Disable privateClickMeasurement when creating the network process
https://bugs.webkit.org/show_bug.cgi?id=231175
Reviewed by Adrian Perez de Castro.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess):
2021-10-07 Aditya Keerthi <akeerthi@apple.com>
Fix the macCatalyst build
https://bugs.webkit.org/show_bug.cgi?id=231373
rdar://83984197
Reviewed by Tim Horton.
* UIProcess/API/ios/WKWebViewIOS.mm: Add missing import.
2021-10-07 Darin Adler <darin@apple.com>
Get rid of the deviceClass function, up-leveling to deviceClassIsSmallScreen
https://bugs.webkit.org/show_bug.cgi?id=231344
Reviewed by Tim Horton.
* Shared/UserInterfaceIdiom.h:
* Shared/UserInterfaceIdiom.mm:
(WebKit::currentUserInterfaceIdiomIsSmallScreen): Renamed to say "is small screen"
instead of "is phone or watch", the same concept. Also switched to TriState instead
of using a unique enumeration.
(WebKit::setCurrentUserInterfaceIdiomIsSmallScreen): Ditto.
(WebKit::updateCurrentUserInterfaceIdiom): Updated for name change.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const): Updated for name change.
(WebKit::WebProcessCreationParameters::decode): Ditto.
* Shared/WebProcessCreationParameters.h: Ditto.
* Shared/ios/WebPreferencesDefaultValuesIOS.mm:
(WebKit::defaultTextAutosizingUsesIdempotentMode): Updated for name change.
(WebKit::defaultMediaSourceEnabled): Use !deviceClassIsSmallScreen instead of
deviceClass != iPhone and != iPod, and also remove unneeded compile time conditionals.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm: Removed uneeded Device.h include.
(-[WKWebViewConfiguration init]): Updated for name change.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
(WebKit::WebProcessPool::registerNotificationObservers): Ditto, also got rid of
local variable.
* UIProcess/ios/SmartMagnificationController.mm:
(WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
Updated for name change.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKFormInputSession setAccessoryViewCustomButtonTitle:]): Ditto.
(-[WKContentView endEditingAndUpdateFocusAppearanceWithReason:]): Ditto.
(-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]): Ditto.
(-[WKContentView _zoomToRevealFocusedElement]): Ditto.
(-[WKContentView _elementTypeRequiresAccessoryView:]): Ditto.
(-[WKContentView _updateAccessory]): Ditto.
(-[WKContentView _shouldUseLegacySelectPopoverDismissalBehavior]): Ditto.
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(WebKit::WebDataListSuggestionsDropdownIOS::show): Ditto.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::desktopClassBrowsingSupported): Ditto.
* UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
(-[WKAirPlayRoutePicker show:fromRect:]): Ditto.
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel _showPhotoPickerWithSourceType:]): Ditto.
(-[WKFileUploadPanel _presentMenuOptionForCurrentInterfaceIdiom:]): Ditto.
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl initWithView:]): Ditto.
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectMultiplePicker configurePresentation]): Ditto.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess): Ditto.
(WebKit::WebProcess::userInterfaceIdiomDidChange): Ditto.
2021-10-07 Wenson Hsieh <wenson_hsieh@apple.com>
Add the ability to dispatch messages to multiple receiver types in IPC::StreamServerConnection
https://bugs.webkit.org/show_bug.cgi?id=231305
Reviewed by Kimmo Kinnunen.
In preparation for using streamable IPC for display list rendering in the GPU process (i.e. 2D canvas and DOM
rendering), refactor StreamServerConnection such that it is capable of dispatching stream messages to generic
StreamMessageReceivers. This has the disadvantage of performing a vtable lookup with each message dispatch, but
I did not measure this to be a significant performance regression on any of the canvas subtests in MotionMark.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
Make RemoteGraphicsContextGL subclass StreamMessageReceiver.
* Platform/IPC/StreamMessageReceiver.h: Added.
(IPC::StreamMessageReceiver::~StreamMessageReceiver):
* Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnection::startReceivingMessages):
(IPC::StreamServerConnection::stopReceivingMessages):
(IPC::StreamServerConnection::dispatchStreamMessages):
(IPC::StreamServerConnection::processSetStreamDestinationID):
(IPC::StreamServerConnection::dispatchStreamMessage):
(IPC::StreamServerConnection::dispatchOutOfStreamMessage):
Now that these methods are no longer templated, we can move their implementations from the header to the
implementation file.
* Platform/IPC/StreamServerConnection.h:
Remove the template argument from StreamServerConnection, and instead make this start and stop receiving
messages for generic StreamMessageReceiver objects.
(IPC::StreamServerConnection<Receiver>::startReceivingMessages): Deleted.
(IPC::StreamServerConnection<Receiver>::stopReceivingMessages): Deleted.
(IPC::StreamServerConnection<Receiver>::dispatchStreamMessages): Deleted.
(IPC::StreamServerConnection<Receiver>::processSetStreamDestinationID): Deleted.
(IPC::StreamServerConnection<Receiver>::dispatchStreamMessage): Deleted.
(IPC::StreamServerConnection<Receiver>::dispatchOutOfStreamMessage): Deleted.
* WebKit.xcodeproj/project.pbxproj:
2021-10-07 Kimmo Kinnunen <kkinnunen@apple.com>
ScopedEGLDefaultDisplay should be removed
https://bugs.webkit.org/show_bug.cgi?id=231011
Reviewed by Kenneth Russell.
Implement the release of WebGL resources with the amended
GraphicsContextGLOpenGL::releaseResources() instead of
previous separate function GraphicsContextGLOpenGL::releaseAllResources().
Use the resource release code path universally, as
GraphicsContextGLOpenGL::releaseResources() is now common code.
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp:
(WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources):
(WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources):
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.h:
* GPUProcess/graphics/ScopedWebGLRenderingResourcesRequestCocoa.cpp: Removed.
(WebKit::ScopedWebGLRenderingResourcesRequest::scheduleFreeWebGLRenderingResources): Deleted.
(WebKit::ScopedWebGLRenderingResourcesRequest::freeWebGLRenderingResources): Deleted.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-10-07 Basuke Suzuki <basuke.suzuki@sony.com>
Change the confusing feature name for testing purpose
https://bugs.webkit.org/show_bug.cgi?id=231259
Reviewed by Tim Horton.
ENABLE(EXPERIMENTAL_FEATURE) was used in the test, but that is very confusing with
ENABLE_EXPERIMENTAL_FEATURES. Change them to more obvious ENABLE(FEATURE_FOR_TESTING).
* Scripts/webkit/parser_unittest.py:
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::jsValueForArguments):
(IPC::messageArgumentDescriptions):
* Scripts/webkit/tests/MessageNames.cpp:
(IPC::isValidMessageName):
* Scripts/webkit/tests/TestWithLegacyReceiver.messages.in:
* Scripts/webkit/tests/TestWithLegacyReceiverMessageReceiver.cpp:
(WebKit::TestWithLegacyReceiver::didReceiveTestWithLegacyReceiverMessage):
* Scripts/webkit/tests/TestWithLegacyReceiverMessages.h:
* Scripts/webkit/tests/TestWithoutAttributes.messages.in:
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessages.h:
2021-10-06 Timothy Hatcher <timothy@apple.com>
_WKRemoteObjectRegistry's ReplyBlockCallChecker should always dealloc on the main thread
https://bugs.webkit.org/show_bug.cgi?id=231346
rdar://problem/83965481
Reviewed by Chris Dumez.
* Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
(-[_WKRemoteObjectRegistry _invokeMethod:]): Added WTF::DestructionThread::MainRunLoop to ReplyBlockCallChecker.
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Delete WebCore::DisplayList::SetInlineFillGradient
https://bugs.webkit.org/show_bug.cgi?id=231326
Reviewed by Simon Fraser.
See WebCore/ChangeLog for more details.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Add a configurable wake up message hysteresis to IPC::StreamClientConnection
https://bugs.webkit.org/show_bug.cgi?id=231304
Reviewed by Simon Fraser.
Make it possible to avoid sending the wakeup message in StreamClientConnection, until some configurable number
of messages have been queued up. This allows us to avoid triggering excessive wakeups in the GPU Process when
using streaming IPC for display lists in the Canvas Lines subtest in MotionMark, which exercises sending a
massive, constant stream of cheap drawing commands to the GPUP.
By default, this hysteresis remains at 0, which means that we'll continue to immediately send GL commands to the
GPU Process when using GPU Process for WebGL. In a future patch, I intend on defaulting to a small hysteresis
(i.e. ~256) for 2D canvas and DOM rendering.
* Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::wakeUpServer):
(IPC::StreamClientConnection::deferredWakeUpServer):
(IPC::StreamClientConnection::decrementRemainingMessageCountBeforeSendingWakeUp):
(IPC::StreamClientConnection::sendDeferredWakeUpMessageIfNeeded):
* Platform/IPC/StreamClientConnection.h:
Also mark StreamClientConnection with `WTF_MAKE_FAST_ALLOCATED`, so that we can wrap the client connection in a
`std::unique_ptr` in a future patch.
(IPC::StreamClientConnection::trySendStream):
When sending a normal (non-blocking) stream message, if the wakeup hysteresis count is non-zero, avoid
immediately signaling the semaphore and instead just set the hysteresis count to the client's specified count
(`m_wakeUpMessageHysteresis`).
(IPC::StreamClientConnection::trySendSyncStream):
When sending a sync message, we always want to immediately flush out any pending wakeup message regardless of
the current hysteresis, since we're waiting for the server to process a reply.
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Fix unified source-related build failures in RemoteSourceBufferProxy.cpp
https://bugs.webkit.org/show_bug.cgi?id=231335
Reviewed by Tim Horton.
We directly use WebCore::AudioTrackPrivate and WebCore::VideoTrackPrivate in RemoteSourceBufferProxy.cpp, but we
don't import their respective WebCore headers; this causes the build to break when shifting around unified
source groupings. Resolve this via the usual means (by importing these headers).
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Add some helper functions to RemoteResourceCache and RemoteResourceCacheProxy
https://bugs.webkit.org/show_bug.cgi?id=231319
Reviewed by Simon Fraser.
Add a few const getters to RemoteResourceCache, and make an existing getter on RemoteResourceCacheProxy const.
I plan to use these in future patches, to support using streamable IPC for display list rendering in the GPU
process.
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::cachedImageBuffer const):
(WebKit::RemoteResourceCache::cachedNativeImage const):
(WebKit::RemoteResourceCache::cachedFont const):
(WebKit::RemoteResourceCache::cachedImageBuffer): Deleted.
* GPUProcess/graphics/RemoteResourceCache.h:
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::cachedImageBuffer const):
(WebKit::RemoteResourceCacheProxy::cachedImageBuffer): Deleted.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Adopt WTF::ApproximateTime in IPC::Timeout
https://bugs.webkit.org/show_bug.cgi?id=231301
Reviewed by Simon Fraser.
When computing time out deadlines for IPC messages, the time granularities (on the order of hundreds of
milliseconds) are many, many orders of magnitude greater than the granularity of ApproximateTime; this makes it
much cheaper to use ApproximateTime instead of MonotonicTime when computing these deadlines, which significantly
improves performance in the case where we're streaming high volumes of IPC messages.
Additionally, in the case where the timeout duration is infinite, we can avoid asking for the current time
altogether, and simply use `ApproximateTime::infinity()`.
* Platform/IPC/Timeout.h:
(IPC::Timeout::Timeout):
(IPC::Timeout::secondsUntilDeadline const):
(IPC::Timeout::deadline const):
(IPC::Timeout::didTimeOut const):
2021-10-06 Sihui Liu <sihui_liu@apple.com>
Add support for FileSystemSyncAccessHandle
https://bugs.webkit.org/show_bug.cgi?id=231185
<rdar://problem/83847859>
Reviewed by Youenn Fablet.
Currently we only allow one open access handle on one file. Second access handle can be created after the first
is closed.
* NetworkProcess/storage/FileSystemStorageError.h:
(WebKit::convertToException):
(WebKit::convertToExceptionOr):
(WebKit::convertToExceptionCode): Deleted.
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::createSyncAccessHandle):
(WebKit::FileSystemStorageHandle::getSize):
(WebKit::FileSystemStorageHandle::truncate):
(WebKit::FileSystemStorageHandle::flush):
(WebKit::FileSystemStorageHandle::close):
* NetworkProcess/storage/FileSystemStorageHandle.h:
* NetworkProcess/storage/FileSystemStorageManager.cpp:
(WebKit::FileSystemStorageManager::connectionClosed):
(WebKit::FileSystemStorageManager::acquireLockForFile):
(WebKit::FileSystemStorageManager::releaseLockForFile):
* NetworkProcess/storage/FileSystemStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::createSyncAccessHandle):
(WebKit::NetworkStorageManager::getSizeForAccessHandle):
(WebKit::NetworkStorageManager::truncateForAccessHandle):
(WebKit::NetworkStorageManager::flushForAccessHandle):
(WebKit::NetworkStorageManager::closeAccessHandle):
* NetworkProcess/storage/NetworkStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp:
(WebKit::WebFileSystemStorageConnection::getFileHandle):
(WebKit::WebFileSystemStorageConnection::getDirectoryHandle):
(WebKit::WebFileSystemStorageConnection::removeEntry):
(WebKit::WebFileSystemStorageConnection::resolve):
(WebKit::WebFileSystemStorageConnection::createSyncAccessHandle):
(WebKit::WebFileSystemStorageConnection::getSize):
(WebKit::WebFileSystemStorageConnection::truncate):
(WebKit::WebFileSystemStorageConnection::flush):
(WebKit::WebFileSystemStorageConnection::close):
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h:
* WebProcess/WebCoreSupport/WebStorageConnection.cpp:
(WebKit::WebStorageConnection::fileSystemGetDirectory):
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
Move FlushIdentifier out of the DisplayList namespace
https://bugs.webkit.org/show_bug.cgi?id=231263
Reviewed by Simon Fraser.
In a future patch, I plan to use `DisplayList::FlushIdentifier` in code that is not specific to WebCore display
lists. As such, move this out into a separate header (`GraphicsContextFlushIdentifier.h`), and rename the enum
class accordingly.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::didFlush):
* GPUProcess/graphics/RemoteRenderingBackend.h:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::lastSentFlushIdentifier const):
(WebKit::RemoteImageBufferProxy::waitForDidFlushOnSecondaryThread):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::didFlush):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in:
2021-10-06 Aditya Keerthi <akeerthi@apple.com>
Fix watchOS, tvOS, and macCatalyst builds after r283592
https://bugs.webkit.org/show_bug.cgi?id=231300
rdar://83936867
Reviewed by Wenson Hsieh.
* Platform/spi/ios/PhotosUISPI.h:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]):
2021-10-06 Megan Gardner <megan_gardner@apple.com>
Allow text selection to flip.
https://bugs.webkit.org/show_bug.cgi?id=231234
rdar://83889188
Reviewed by Wenson Hsieh.
In order to bring webkit more in line with UIKit, allow text selection to flip.
This also requires a UIKit change tracked in rdar://83788439
This is currently guarded behind an off-by-default flag so that we can
test this new behavior before turning it on by default.
* Platform/spi/ios/UIKitSPI.h:
* Shared/ios/GestureTypes.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(toUIWKSelectionFlags):
(toSelectionFlags):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::selectionFlippingEnabled const):
(WebKit::WebPage::setSelectionFlippingEnabled):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeForPointInRootViewCoordinates):
(WebKit::WebPage::updateSelectionWithTouches):
2021-10-06 Chris Dumez <cdumez@apple.com>
IPC SimpleArgumentEncoder should static_assert(std::is_trivially_copyable<T>)
https://bugs.webkit.org/show_bug.cgi?id=230743
<rdar://problem/83757335>
Reviewed by Kimmo Kinnunen.
Add static_assert(std::is_trivially_copyable<T>) to IPC SimpleArgumentEncoder to avoid misuses.
* Platform/IPC/ArgumentCoders.h:
2021-10-06 Wenson Hsieh <wenson_hsieh@apple.com>
[WebKit2] Refactor some IPC argument encoder logic to work with StreamConnectionEncoder
https://bugs.webkit.org/show_bug.cgi?id=230714
rdar://83477591
Reviewed by Tim Horton.
Make it possible to use `IPC::StreamConnectionEncoder` to encode display list items (and their members) in an
IPC stream. This patch comprises two main sets of changes in `ArgumentCoders`, and `WebCoreArgumentCoders`. See
below for more details.
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<audit_token_t>::decode):
(IPC::ArgumentCoder<Monostate>::encode): Deleted.
(IPC::ArgumentCoder<Monostate>::decode): Deleted.
* Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<Monostate>::encode):
(IPC::ArgumentCoder<Monostate>::decode):
Many of these `encode()` methods are currently non-templated, which means that Encoder and Decoder used here
refer solely to IPC::Encoder and IPC::Decoder (respectively) instead of other types of encoders (namely,
StreamConnectionEncoder). Make these use templated `encode` methods intead, so that they work with generic
encoders.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<AffineTransform>::encode): Deleted.
(IPC::ArgumentCoder<AffineTransform>::decode): Deleted.
(IPC::ArgumentCoder<FloatPoint>::encode): Deleted.
(IPC::ArgumentCoder<FloatPoint>::decode): Deleted.
(IPC::ArgumentCoder<FloatPoint3D>::encode): Deleted.
(IPC::ArgumentCoder<FloatPoint3D>::decode): Deleted.
(IPC::ArgumentCoder<FloatRect>::encode): Deleted.
(IPC::ArgumentCoder<FloatRect>::decode): Deleted.
(IPC::ArgumentCoder<FloatBoxExtent>::encode): Deleted.
(IPC::ArgumentCoder<FloatBoxExtent>::decode): Deleted.
(IPC::ArgumentCoder<FloatSize>::encode): Deleted.
(IPC::ArgumentCoder<FloatSize>::decode): Deleted.
(IPC::ArgumentCoder<FloatRoundedRect>::encode): Deleted.
(IPC::ArgumentCoder<FloatRoundedRect>::decode): Deleted.
(IPC::ArgumentCoder<IntPoint>::encode): Deleted.
(IPC::ArgumentCoder<IntPoint>::decode): Deleted.
(IPC::ArgumentCoder<IntRect>::encode): Deleted.
(IPC::ArgumentCoder<IntRect>::decode): Deleted.
(IPC::ArgumentCoder<IntSize>::encode): Deleted.
(IPC::ArgumentCoder<IntSize>::decode): Deleted.
(IPC::ArgumentCoder<LayoutSize>::encode): Deleted.
(IPC::ArgumentCoder<LayoutSize>::decode): Deleted.
(IPC::ArgumentCoder<LayoutPoint>::encode): Deleted.
(IPC::ArgumentCoder<LayoutPoint>::decode): Deleted.
These WebCore argument coders are also currently incompatible with StreamConnectionEncoder, since they are non-
templated (and thus only work with IPC::Encoder). Since these are all encodable as POD types, we can just use
SimpleArgumentCoder for all of these. We also add new `DEFINE_SIMPLE_ARGUMENT_CODER_FOR_(HEADER|SOURCE)` macros
to make this code a bit easier to read, which adds SimpleArgumentCoder for the given type, for both standard
IPC::Encoder as well as IPC::StreamConnectionEncoder.
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<CGRect>::encode): Deleted.
(IPC::ArgumentCoder<CGRect>::decode): Deleted.
(IPC::ArgumentCoder<CGSize>::encode): Deleted.
(IPC::ArgumentCoder<CGSize>::decode): Deleted.
(IPC::ArgumentCoder<CGPoint>::encode): Deleted.
(IPC::ArgumentCoder<CGPoint>::decode): Deleted.
(IPC::ArgumentCoder<CGAffineTransform>::encode): Deleted.
(IPC::ArgumentCoder<CGAffineTransform>::decode): Deleted.
2021-10-06 Youenn Fablet <youenn@apple.com>
Implement https://w3c.github.io/push-api/#receiving-a-push-message
https://bugs.webkit.org/show_bug.cgi?id=231070
<rdar://problem/83759574>
Reviewed by Chris Dumez.
Add temporary SPI in WKWebsiteDataStore to allow pushing messages to service workers.
It takes a completion handler to check whether the message is acknowledged or not.
The service worker registration is identified by its scope for now.
A few additional things might need to be done:
- The case where the service worker is launched with no client.
- Handling of background assertions, especially if service worker has no client.
- Optimizations: skip events, optimization of network process launch by only loading the service worker registrations of an origin.
* NetworkProcess/NetworkProcess.cpp:
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
* UIProcess/Network/NetworkProcessProxy.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2021-10-06 Jer Noble <jer.noble@apple.com>
[Build-time perf] Forward declare JS TypedArrays
https://bugs.webkit.org/show_bug.cgi?id=231196
Reviewed by Tim Horton.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2021-10-06 Youenn Fablet <youenn@apple.com>
Close NetworkRTCProvider sockets explicitly when closing NetworkRTCProvider
https://bugs.webkit.org/show_bug.cgi?id=231228
<rdar://83237496>
Reviewed by Eric Carlson.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::close):
Make sure to explictly closing the socket before deleting it.
2021-10-05 Alex Christensen <achristensen@webkit.org>
Do daily activity in AdAttributionDaemon based off of when the xpc activity happens
https://bugs.webkit.org/show_bug.cgi?id=231254
Reviewed by Kate Cheney.
Before this change, we did the activity 5 seconds after startup of the daemon, which can be started
by sending an attribution to it or by the daily xpc activity. We want to do it only because of the xpc activity.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::doDailyActivityInManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::registerScheduledActivityHandler):
2021-10-05 Aditya Keerthi <akeerthi@apple.com>
[iOS] Transcode videos selected from UIImagePickerController
https://bugs.webkit.org/show_bug.cgi?id=230639
rdar://79665678
Reviewed by Tim Horton.
File inputs on iOS allow users to choose images/videos from the system
photo picker, using UIImagePickerController. In single selection mode,
UIImagePickerController transcodes the selected video to H.264. However,
in multiple selection mode, video is not transcoded and is left in its
original format.
Today, videos on most iOS devices are encoded with HEVC by default.
However, some sites, such as Twitter, only accept H.264 encoded video.
Thus, the current video upload behavior is problematic, as users may be
unable to upload video.
Unfortunately, the photo picking functionality of UIImagePickerController
is deprecated. The best solution would be to adopt PHPickerViewController,
the replacement API, which performs transcoding when retrieving selected
items (regardless of single/multiple selection). However,
PHPickerViewController currently lacks other functionality that WebKit
requires, preventing adoption.
Consequently, the short term solution is to transcode the videos in
WebKit, ensuring H.264 encoded video is always provided to sites. See
below for implementation details.
* Platform/spi/ios/PhotosUISPI.h: Added.
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[_WKFileUploadItem setFileURL:]):
Add a setter to update the file URL. Called after transcoding a _WKFileUploadItem.
(-[WKFileUploadMediaTranscoder initWithItems:videoCount:completionHandler:]):
Introduce WKFileUploadMediaTranscoder to manage transcoding of videos
and the display of progress UI. Transcoding is performed serially
(one video at a time), but occurs off the main thread.
(-[WKFileUploadMediaTranscoder start]):
Begin transcoding. Run a timer to update the progress UI, as
AVAssetExportSession does not provide progress updates on its own.
The progress UI is implemented using PUActivityProgressController, to
match system Photos UI.
(-[WKFileUploadMediaTranscoder _processItemAtIndex:]):
Transcode a single video, using AVAssetExportSession. If transcoding
fails for any reason, the original video is used as a fallback.
Transcoding can also be cancelled using the progress UI, in which case
no more videos are processed.
(-[WKFileUploadMediaTranscoder _finishedProcessing]):
(-[WKFileUploadMediaTranscoder _dismissProgress]):
(-[WKFileUploadMediaTranscoder _updateProgress:]):
(-[WKFileUploadMediaTranscoder _temporaryDirectoryCreateIfNecessary]):
(-[WKFileUploadPanel _chooseMediaItems:]):
Refactor the common aspects of single/multiple media selection into a
single method.
(-[WKFileUploadPanel imagePickerController:didFinishPickingMediaWithInfo:]):
(-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]):
(-[WKFileUploadPanel _processMediaInfoDictionaries:successBlock:failureBlock:]):
(-[WKFileUploadPanel _processMediaInfoDictionaries:atIndex:processedResults:successBlock:failureBlock:]):
(-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
Remove redundant platform conditional.
(-[WKFileUploadPanel _uploadMediaItemsTranscodingVideo:]):
If any videos were selected, transcode them prior to uploading.
* WebKit.xcodeproj/project.pbxproj:
2021-10-05 Alex Christensen <achristensen@webkit.org>
Add an entitlement check to only allow AdAttributionDaemon to be connected to by the network process
https://bugs.webkit.org/show_bug.cgi?id=231248
Reviewed by Alexey Proskuryakov.
Adding a restricted entitlement on macOS when using a non-internal SDK causes the network process to not start,
so in open source builds (in which the daemon is only used for unit tests) just skip the entitlement check.
* Scripts/process-entitlements.sh:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::startListeningForMachServiceConnections):
2021-10-05 Chris Dumez <cdumez@apple.com>
Authorization header lost on 30x redirects
https://bugs.webkit.org/show_bug.cgi?id=230935
<rdar://problem/83689955>
Reviewed by Darin Adler.
CFNetwork drops the Authorization request header in cases of same-origin redirects, which is not as per
the fetch specification [1] and doesn't match the behavior of other browsers.
To address the issue, WebKit adds the Authorization request back in case of a same-origin redirect.
[1] https://fetch.spec.whatwg.org/#concept-http-redirect-fetch
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2021-10-05 Tim Horton <timothy_horton@apple.com>
<model> should be draggable, similar to <img>
https://bugs.webkit.org/show_bug.cgi?id=229246
Reviewed by Wenson Hsieh.
* UIProcess/ios/DragDropInteractionState.mm:
(WebKit::shouldUseDragImageToCreatePreviewForDragSource):
For now, use the Web-Content-process-painted node-snapshot DragImage for the targeted preview on iOS.
2021-10-05 Tim Horton <timothy_horton@apple.com>
Add an alternate style for form controls, and implement it for checkboxes and radio buttons
https://bugs.webkit.org/show_bug.cgi?id=231160
Reviewed by Sam Weinig.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultAlternateFormControlDesignEnabled):
* Shared/WebPreferencesDefaultValues.h:
2021-10-05 Alex Christensen <achristensen@webkit.org>
Implement missing functions in PrivateClickMeasurementDaemonClient
https://bugs.webkit.org/show_bug.cgi?id=231060
Reviewed by Chris Dumez.
Enable debug mode in the daemon if any connected clients have debug mode enabled.
Broadcast debug messages to all clients, which will then broadcast them to all web processes.
Add an API test that turns it on then off and checks that the debug messages make it all the way to the inspector.
* NetworkProcess/NetworkSession.cpp:
(WebKit::managerOrProxy):
(WebKit::NetworkSession::setPrivateClickMeasurementDebugMode):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp:
(WebKit::PCM::ConnectionToMachService::ConnectionToMachService):
(WebKit::PCM::ConnectionToMachService::send const):
(WebKit::PCM::ConnectionToMachService::sendWithReply const):
(WebKit::PCM::Connection::Connection): Deleted.
(WebKit::PCM::Connection::send const): Deleted.
(WebKit::PCM::Connection::sendWithReply const): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h:
(WebKit::PCM::Connection::Connection):
(WebKit::PCM::Connection::get const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp:
(WebKit::PCM::DaemonClient::broadcastConsoleMessage):
(WebKit::PCM::DaemonClient::debugModeEnabled const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::setDebugModeIsEnabled):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::messageTypeSendsReply):
(WebKit::PCM::handlePCMMessageSetDebugModeIsEnabled):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::ManagerProxy):
(WebKit::PCM::ManagerProxy::setDebugModeIsEnabled):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementConnectionCocoa.mm: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm.
(WebKit::PCM::ConnectionToMachService::initializeConnectionIfNeeded const):
(WebKit::PCM::ConnectionToMachService::sendDebugModeIsEnabledMessageIfNecessary const):
(WebKit::PCM::ConnectionToMachService::checkForDebugMessageBroadcast const):
(WebKit::PCM::Connection::send const):
(WebKit::PCM::Connection::sendWithReply const):
(WebKit::PCM::ConnectionToMachService::send const):
(WebKit::PCM::ConnectionToMachService::sendWithReply const):
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonConnectionSet.h: Copied from Source/WebKit/NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h.
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonConnectionSet.mm: Added.
(WebKit::PCM::DaemonConnectionSet::singleton):
(WebKit::PCM::DaemonConnectionSet::add):
(WebKit::PCM::DaemonConnectionSet::remove):
(WebKit::PCM::DaemonConnectionSet::setConnectedNetworkProcessHasDebugModeEnabled):
(WebKit::PCM::DaemonConnectionSet::debugModeEnabled const):
(WebKit::PCM::DaemonConnectionSet::broadcastConsoleMessage):
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::connectionEventHandler):
(WebKit::startListeningForMachServiceConnections):
(WebKit::peers): Deleted.
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _setPrivateClickMeasurementDebugModeEnabledForTesting:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* WebKit.xcodeproj/project.pbxproj:
2021-10-04 Chris Dumez <cdumez@apple.com>
Add SPI to launch a service service worker in a WKWebView and expose service worker to injected bundle
https://bugs.webkit.org/show_bug.cgi?id=231045
<rdar://problem/83744069>
Reviewed by Geoff Garen.
Add new [WKWebView loadServiceWorker:(NSURL *)] to load a service worker in a web view. When called,
it causes us to create a page with HTML start registers the service worker with the provided URL.
The service worker in question will differ slightly from usual service workers in that:
- The service worker URL doesn't need to be HTTP/HTTPS. In particular, a custom scheme (with corresponding
custom scheme handler) can be used.
- The service worker will always run in the WKWebView's associated WebProcess (which can be controlled via
WKWebViewConfiguration._relatedWebView).
- The service worker will run on the main thead
- The service worker is not persistent, meaning that it will not be saved to disk, unlike regular service
workers.
- The service worker's global object will be exposed to the injected bundle via a new serviceWorkerGlobalObjectIsAvailableForFrame
function call on WKWebProcessPlugInLoadDelegate. The provided Frame will be the WKWebView's main frame.
- The service worker will be unregistered & exit as soon as its WKWebView gets closed / deallocated.
To make the service worker more usable via the injected bundle API, the following changes were made too:
- [WKWebProcessPlugInFrame lookUpFrameFromJSContext:] will return the WKWebView's main frame when passed in
that view's service worker context.
- A new [WKWebProcessPlugInFrame jsContextForServiceWorkerWorld:(WKWebProcessPlugInScriptWorld *)] SPI was
added to get the service worker's JS context from the view.
I added an API test that launches such a service worker, makes sure the injected bundle gets notified on
the main thread of the service worker global object and that it can script it. The test also makes sure
the _relatedWebView SPI works to force a service worker into another view's process. It also tests that
[WKWebProcessPlugInFrame lookUpFrameFromJSContext:] and [WKWebProcessPlugInFrame jsContextForServiceWorkerWorld:(WKWebProcessPlugInScriptWorld *)]
work as expected. Finally, it makes sure the service worker properly exits when the view gets closed.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::establishSWContextConnection):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::swServerForSession):
* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startFetch):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* Shared/LoadParameters.cpp:
(WebKit::LoadParameters::encode const):
(WebKit::LoadParameters::decode):
* Shared/LoadParameters.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView loadRequest:]):
(-[WKWebView loadFileURL:allowingReadAccessToURL:]):
(-[WKWebView loadData:MIMEType:characterEncodingName:baseURL:]):
(-[WKWebView _loadServiceWorker:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
(WebKit::WebPageProxy::loadServiceWorker):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::establishServiceWorkerContext):
(WebKit::WebProcessProxy::enableServiceWorkers):
* UIProcess/WebProcessProxy.h:
* WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
(API::InjectedBundle::PageLoaderClient::serviceWorkerGlobalObjectIsAvailableForFrame):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(-[WKWebProcessPlugInFrame jsContextForServiceWorkerWorld:]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
* WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(serviceWorkerGlobalObjectIsAvailableForFrame):
(setUpPageLoaderClient):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame):
(WebKit::InjectedBundlePageLoaderClient::serviceWorkerGlobalObjectIsAvailableForFrame):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
(WebKit::WebSWContextManagerConnection::establishConnection):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchServiceWorkerGlobalObjectAvailable):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::jsContextForServiceWorkerWorld):
(WebKit::WebFrame::frameForContext):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadData):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-10-04 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r283431.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):
2021-10-04 Chris Dumez <cdumez@apple.com>
Unreviewed build fix after r283431.
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):
2021-10-04 John Pascoe <j_pascoe@apple.com>
[WebAuthn] Prefer internal user verification if available over pin entry.
https://bugs.webkit.org/show_bug.cgi?id=213903
<rdar://problem/65359269>
Reviewed by Brent Fulgham.
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::feedReports):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
(WebKit::CtapAuthenticator::makeCredential):
(WebKit::CtapAuthenticator::getAssertion):
(WebKit::fido::toStatus): Deleted.
(WebKit::fido::isPinError): Deleted.
2021-10-04 John Pascoe <j_pascoe@apple.com>
[WebAuthn] Add SPI to change username of credential
https://bugs.webkit.org/show_bug.cgi?id=230956
<rdar://problem/83471755>
Reviewed by Brent Fulgham.
Adds a new method for changing the username of a given stored webauthn credential.
New API test: TestWebKitAPI.WebAuthenticationPanel.UpdateCredentialUsername
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.h:
* UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:
(+[_WKWebAuthenticationPanel setUsernameForLocalCredentialWithID:username:]):
2021-10-04 Youenn Fablet <youenn@apple.com>
Send necessary sandbox extensions to WebProcess in case WebRTC codecs run in WebProcess
https://bugs.webkit.org/show_bug.cgi?id=231073
Reviewed by Eric Carlson.
Manually tested, make sure to send extensions like if audio/video capture happens in WebProcess.
This allows validating regressions due or not to GPUProcess.
* UIProcess/WebPageProxy.cpp:
2021-10-04 Chris Dumez <cdumez@apple.com>
Use isolated NSURLSessions for each first party registrable domain
https://bugs.webkit.org/show_bug.cgi?id=230750
<rdar://83159358>
Reviewed by Alex Christensen.
Previously would use up to 10 isolated NSURLSessions only for domains marked as prevalent
by ITP *and* that the user interacts with as first party website. We now use different
isolated NSURLSession for each top-level registrable domain, not matter their ITP status.
This significantly improves privacy.
To avoid having too many NSURLSession, we clear the ones that haven't been used in the
last 10 minutes, every time we add a new one.
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
(WebKit::SessionSet::isolatedSession):
2021-10-04 Tim Horton <timothy_horton@apple.com>
process-entitlements should fail if a subcommand fails
https://bugs.webkit.org/show_bug.cgi?id=231155
Reviewed by Anders Carlsson.
* Scripts/process-entitlements.sh:
See bug 231154, which fixes a mistake in r283156 which made one of the
PlistBuddy invocations from process-entitlements fail, but did not
result in a failing build. PlistBuddy does correctly return a non-zero
return value in this case, so we should just tell the shell to propagate
that upwards.
2021-10-04 Alex Christensen <achristensen@webkit.org>
Enable PCM debug mode per WebsiteDataStore instead of process-global
https://bugs.webkit.org/show_bug.cgi?id=231096
Reviewed by Kate Cheney.
This will make it so we don't need to restart the network process in order to enable or disable debug mode.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::setPrivateClickMeasurementDebugMode):
(WebKit::NetworkProcess::privateClickMeasurementDebugModeEnabled const): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::setPrivateClickMeasurementDebugMode):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::privateClickMeasurementDebugModeEnabled const):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp:
(WebKit::PCM::ClientImpl::debugModeEnabled const):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setPrivateClickMeasurementDebugMode):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::experimentalFeatureEnabled):
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setPrivateClickMeasurementDebugMode):
2021-10-04 Jean-Yves Avenard <jya@apple.com>
Vorbis decoder can't be instantiated - follow up on Bug 230742
https://bugs.webkit.org/show_bug.cgi?id=231154
rdar://problem/83825162
Fix typo in expression.
Reviewed by Tim Horton.
* Scripts/process-entitlements.sh: Add missing bool keyword.
2021-10-03 Lauro Moura <lmoura@igalia.com>
[GTK] REGRESSION(r283304): All GTK4 layout tests are aborting
https://bugs.webkit.org/show_bug.cgi?id=231153
Reviewed by Alexey Proskuryakov.
Revert back to the previous NOP behavior of bindAccessibilityTree()
for GTK4, leaving the assert for the debug mode with an informative
message in the log.
Covered by existing tests.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree):
2021-10-03 Don Olmstead <don.olmstead@sony.com>
Non-unified build fixes, early October 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=231143
Unreviewed non-unified build fixes.
* NetworkProcess/NetworkResourceLoadParameters.h:
* UIProcess/API/C/WKContext.cpp:
(WKContextTerminateGPUProcess):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2021-10-03 Basuke Suzuki <basuke.suzuki@sony.com>
[PlayStation] Pass logging channel parameter to WebProcess from environment variable
https://bugs.webkit.org/show_bug.cgi?id=230726
<rdar://problem/83740947>
Reviewed by Fujii Hironori.
Added release log configuration environment variables to PlayStation port.
* UIProcess/playstation/WebProcessPoolPlayStation.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/playstation/WebProcessPlayStation.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-10-03 David Kilzer <ddkilzer@apple.com>
WTF::RetainPtr<> allows assignment of two pointer types that are not assignable
<https://webkit.org/b/230406>
<rdar://problem/83241893>
Reviewed by Darin Adler.
* Shared/API/Cocoa/WKRemoteObjectCoder.mm:
(transformTrustToData):
- Change return type to match object.
(encodeError):
- Use bridge_cast() to fix assignment.
(transformDataToTrust):
- Change return type to match object.
(decodeError):
- Use bridge_id_cast() to fix assignment.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
- Use bridge_id_cast() to fix assignment.
* UIProcess/mac/WebDataListSuggestionsDropdownMac.h:
- Use correct name of class that actually exists.
2021-10-03 Simon Fraser <simon.fraser@apple.com>
WebCore::Length incorrectly uses memcpy() for copy constructors/operator and IPC encoding/decoding
https://bugs.webkit.org/show_bug.cgi?id=230744
Reviewed by David Kilzer.
Safe encoding/decoding of Length requires that we encode the enum and fields separately,
and don't allow calc types (there isn't enough context in the receiving process to resolve
calc).
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Length>::encode):
(IPC::ArgumentCoder<Length>::decode):
* Shared/WebCoreArgumentCoders.h:
2021-10-02 David Kilzer <ddkilzer@apple.com>
Replace WKProcessPoolWeakObserver (Direct) category with (direct) property attribute
<https://webkit.org/b/231119>
Reviewed by Anders Carlsson.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(-[WKProcessPoolWeakObserver initWithWeakPtr:]):
- Merge WKProcessPoolWeakObserver (Direct) category into primary
interface, and use the (direct) property attribute instead.
2021-10-02 Chris Dumez <cdumez@apple.com>
REGRESSION (r275455): ASSERTION FAILED: process->hasOneRef() seen with TestWebKitAPI.WKProcessPool.WarmInitialProcess
https://bugs.webkit.org/show_bug.cgi?id=231106
Reviewed by Geoffrey Garen.
r275455 added a dispatch_async() which captures a Ref<> to a WebProcessProxy. This may cause the WebProcessProxy to
outlive its WebProcessPool (prewarmed WebProcessProxies to not ref their WebProcessPool), which is not supported.
We could fix the crash by also capturing a Ref<> to the WebProcessPool in the lambda. However, in this particular
instance, it does not seem useful to extend the lifetime of the WebProcessProxy / WebProcessPool so I opted to use
a WeakPtr.
No new tests, covered by existing API test crashing in debug.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
2021-10-01 Chris Dumez <cdumez@apple.com>
Drop support for macOS < 10.15
https://bugs.webkit.org/show_bug.cgi?id=231085
Reviewed by Darin Adler.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Shared/Cocoa/ArgumentCodersCocoa.mm:
(-[WKSecureCodingArchivingDelegate archiver:willEncodeObject:]):
* Shared/Cocoa/CoreTextHelpers.mm:
(WebKit::fontWithAttributes):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions):
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-01 Remy Demarest <rdemarest@apple.com>
Use DYLD_FRAMEWORK_PATH instead of DYLD_VERSIONED_FRAMEWORK_PATH on Safari Big Sur
https://bugs.webkit.org/show_bug.cgi?id=231058
Reviewed by David Kilzer.
Modify the DYLD environment variable that is used when compiling with staged frameworks.
We want to use DYLD_VERSIONED_FRAMEWORK_PATH to define the search path of the frameworks
for DYLD because this makes launching Safari and its child processes faster. However,
on Apple Silicon Big Sur using that environment variable does not work and results in Safari
loading frameworks from the System folder rather than from the StagedFrameworks/Safari
folder, this is because dyld on M1 does not look up that variable properly. To make sure
we actually load the frameworks from the desired location, we need to use DYLD_FRAMEWORK_PATH
instead, this makes dyld perform more stat() calls than usual to link the frameworks hence
why we prefer the other variable, but this is the only way to workaround the issue in
Big Sur on M1. In Monterey and above, this bug will be fixed in dyld so we only need this
variable before macOS 11.
Override OTHER_LDFLAGS_VERSIONED_FRAMEWORK_PATH_YES based on SDK and architecture to use
DYLD_FRAMEWORK_PATH instead of DYLD_VERSIONED_FRAMEWORK_PATH when building for macOS 11 and arm64.
* Configurations/BaseTarget.xcconfig:
2021-10-01 Brent Fulgham <bfulgham@apple.com>
Remove reference to od-server-name from sandbox profiles
https://bugs.webkit.org/show_bug.cgi?id=231098
<rdar://problem/67766415>
Reviewed by Per Arne Vollan.
The code that used to read the od-server-name property was removed in Big Sur,
so WebKit no longer needs to allow reading that property in its sandbox profiles.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-01 Ian Anderson <iana@apple.com>
WebKitLegacy's module map files don't get installed
https://bugs.webkit.org/show_bug.cgi?id=230736
Reviewed by David Kilzer.
Revert r271607 because it doesn't work and isn't the right approach.
* mac/MigrateHeadersFromWebKitLegacy.make:
2021-10-01 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r283274.
Broke HSTS.CrossOriginRedirect API test
Reverted changeset:
"Use isolated NSURLSessions for each first party registrable
domain"
https://bugs.webkit.org/show_bug.cgi?id=230750
https://commits.webkit.org/r283274
2021-10-01 Brent Fulgham <bfulgham@apple.com>
Remove special treatment for /private/var/db/dyld on older macOS
https://bugs.webkit.org/show_bug.cgi?id=231092
<rdar://problem/66580290>
Reviewed by Per Arne Vollan.
The dyld shared cache moved to /System/Library/dyld in Big Sur. We should remove access to the
old location from Big Sur (and beyond) since it isn't needed anymore.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-01 Kate Cheney <katherine_cheney@apple.com>
GPU Process microphone attribution SPI adoption
https://bugs.webkit.org/show_bug.cgi?id=231034
<rdar://problem/83732537>
Reviewed by Youenn Fablet.
Adopt SPI for App Privacy Report that attributes mic capture to the
host app.
* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::audioSessionProxy):
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::addProxy):
* GPUProcess/media/RemoteAudioSessionProxyManager.h:
* Scripts/process-entitlements.sh:
2021-10-01 Brent Fulgham <bfulgham@apple.com>
Protect WebFrame during invalidatePolicyListener()
https://bugs.webkit.org/show_bug.cgi?id=229981
<rdar://problem/82807413>
Reviewed by Alex Christensen.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::invalidatePolicyListeners): Protect the WebFrame while
policy handlers are run.
2021-10-01 Alex Christensen <achristensen@webkit.org>
Move ephemeral PCM storage from PCM manager to NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=231025
Reviewed by Kate Cheney.
With the daemon, we want the network process to hang on to an ephemeral PCM instead of the daemon,
which is responsible for many network processes. When attribution happens we insert the PCM then
attribute it like we did before, but from the NetworkSession instead of from the PCM manager.
Functionality covered by existing tests.
This just reduces state in the daemon. All the other state in the PCM manager is only used for tests.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::storePrivateClickMeasurement):
(WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
(WebKit::NetworkSession::clearPrivateClickMeasurement):
(WebKit::NetworkSession::setPrivateClickMeasurementEphemeralMeasurementForTesting):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
(WebKit::PrivateClickMeasurementManager::migratePrivateClickMeasurementFromLegacyStorage):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::clear):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::messageTypeSendsReply):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::storeUnattributed):
(WebKit::PCM::ManagerProxy::setEphemeralMeasurementForTesting): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp:
(WebKit::PCM::Store::insertPrivateClickMeasurement):
(WebKit::PCM::Store::attributePrivateClickMeasurement):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h:
2021-10-01 Per Arne Vollan <pvollan@apple.com>
[macOS] Remove obsolete sandbox rule
https://bugs.webkit.org/show_bug.cgi?id=231067
Reviewed by Brent Fulgham.
Remove sandbox rule that is no longer compiled on macOS.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-01 Chris Dumez <cdumez@apple.com>
Drop legacy USE(LEGACY_CFNETWORK_DOWNLOADS) code paths
https://bugs.webkit.org/show_bug.cgi?id=231081
Reviewed by Alex Christensen.
Drop legacy USE(LEGACY_CFNETWORK_DOWNLOADS) code paths, as we no longer support Mac OS 14 Mojave.
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::resume):
(WebKit::Download::platformCancelNetworkLoad):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView resumeDownloadFromResumeData:completionHandler:]):
2021-10-01 Per Arne Vollan <pvollan@apple.com>
Make sandbox rules for debug syscalls stricter
https://bugs.webkit.org/show_bug.cgi?id=230985
<rdar://49531420>
Reviewed by Brent Fulgham.
Make sandbox rules for debug syscalls stricter in the WebContent process on macOS and iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:
2021-10-01 Per Arne Vollan <pvollan@apple.com>
Send Launch Services database to GPU process
https://bugs.webkit.org/show_bug.cgi?id=225151
<rdar://74749122>
Reviewed by Brent Fulgham.
Send Launch Services database to the GPU process after it has finished launching, like we do for WebContent processes.
The Launch Services database is represented as an XPC object, and needs to be sent over a dedicated XPC channel.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::didFinishLaunching):
(WebKit::GPUProcessProxy::addSession):
* UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::XPCEventHandler::handleXPCEvent const):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setWebsiteDataStore):
(WebKit::WebProcessProxy::didFinishLaunching):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToProcess const):
(WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToAllProcesses):
(WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToWebProcess): Deleted.
(WebKit::WebsiteDataStore::sendNetworkProcessXPCEndpointToAllWebProcesses): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-10-01 Youenn Fablet <youenn@apple.com>
Attribute IOSurfaces created by camera and decoders to responsible WebProcess
https://bugs.webkit.org/show_bug.cgi?id=231075
Reviewed by Chris Dumez.
Make sure to mark camera and decoder generated IOSurfaces as owned by the responsible WebProcess.
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
2021-10-01 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][a11y] Add initial implementation of accessible interface when building with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=230256
Reviewed by Adrian Perez de Castro.
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformDetach): Unregister the page accessible object.
2021-09-30 Sam Weinig <weinig@apple.com>
Add dumping for UIViews with separated layers
https://bugs.webkit.org/show_bug.cgi?id=231056
Reviewed by Tim Horton.
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(allowListedClassToString):
Fix typo from previous patch where a comma was missed
and remove unnecessary assertion.
(dumpUIView):
Use the new dumpSeparatedLayerProperties when separated layers
are present.
2021-09-30 Simon Fraser <simon.fraser@apple.com>
Simplify some scrolling-related code in WebKit with use of RectEdges<bool>
https://bugs.webkit.org/show_bug.cgi?id=231037
Reviewed by Tim Horton.
Use RectEdges<bool> in code that tracks rubber banding state, and edge pinned state.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<RectEdges<bool>>::encode):
(IPC::ArgumentCoder<RectEdges<bool>>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageIsPinnedToLeftSide):
(WKPageIsPinnedToRightSide):
(WKPageIsPinnedToTopSide):
(WKPageIsPinnedToBottomSide):
(WKPageRubberBandsAtLeft):
(WKPageRubberBandsAtRight):
(WKPageRubberBandsAtTop):
(WKPageRubberBandsAtBottom):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::toWKRectEdge):
(WebKit::toRectEdges):
(WebKit::WebViewImpl::pinnedState):
(WebKit::WebViewImpl::rubberBandingEnabled):
(WebKit::WebViewImpl::setRubberBandingEnabled):
* UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::setRubberBandsAtLeft):
(WebKit::WebPageProxy::setRubberBandsAtRight):
(WebKit::WebPageProxy::setRubberBandsAtTop):
(WebKit::WebPageProxy::setRubberBandsAtBottom):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
(WebKit::WebPageProxy::rubberBandsAtLeft const): Deleted.
(WebKit::WebPageProxy::rubberBandsAtRight const): Deleted.
(WebKit::WebPageProxy::rubberBandsAtTop const): Deleted.
(WebKit::WebPageProxy::rubberBandsAtBottom const): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/EventDispatcher.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateMainFrameScrollOffsetPinning):
* WebProcess/WebPage/WebPage.h:
2021-09-30 Christopher Reid <chris.reid@sony.com>
Fix !ENABLE(WIRELESS_PLAYBACK_TARGET) build after r283319
https://bugs.webkit.org/show_bug.cgi?id=231036
Unreviewed build fix.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp: MediaPlaybackTargetContext.h is already included with WIRELESS_PLAYBACK_TARGET
* GPUProcess/media/RemoteMediaPlayerProxy.h:
2021-09-30 Per Arne <pvollan@apple.com>
[GPUP] Add syscall filter telemetry
https://bugs.webkit.org/show_bug.cgi?id=230960
<rdar://problem/83674166>
Reviewed by Brent Fulgham.
Add syscall filter telemetry in the GPU process' sandbox on iOS and macOS.
Syscall observed being in use are added without telemetry.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-09-30 Per Arne <pvollan@apple.com>
Add syscall filter telemetry for the Networking process
https://bugs.webkit.org/show_bug.cgi?id=230961
<rdar://problem/83674634>
Reviewed by Brent Fulgham.
Add syscall filter telemetry for the Networking process on iOS and macOS.
Syscalls that are known to be used are added without telemetry.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2021-09-30 Per Arne <pvollan@apple.com>
[macOS] Reduce sandbox telemetry
https://bugs.webkit.org/show_bug.cgi?id=231026
<rdar://83694937>
Reviewed by Brent Fulgham.
Remove sandbox telemetry for resources that we already see are in use.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2021-09-30 Eddy Wong <eddy_wong@apple.com>
Adopt presentationSceneIdentifierForPaymentAuthorizationController delegate call from PassKit
https://bugs.webkit.org/show_bug.cgi?id=230874
Reviewed by Devin Rousso.
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
(WebKit::NetworkConnectionToWebProcess::getWindowSceneIdentifierForPaymentPresentation): Implements getWindowSceneIdentifierForPaymentPresentation() by asking parent process (UIProcess) for scene ID via new XPC message.
* Platform/cocoa/PaymentAuthorizationPresenter.h:
(WebKit::PaymentAuthorizationPresenter::sceneIdentifier const): Holds temporarily the scene ID we'd like to use when presenting the payment sheet, to be read by WKPaymentAuthorizationControllerDelegate.
* Platform/cocoa/PaymentAuthorizationViewController.h: Declares presentInScene() which is just for conformance to PaymentAuthorizationPresenter
* Platform/cocoa/PaymentAuthorizationViewController.mm:
(WebKit::PaymentAuthorizationViewController::presentInScene): Provides a dummy implementation for presentInScene() for conformance.
* Platform/cocoa/WKPaymentAuthorizationDelegate.h: Surfaces _presenter for PaymentAuthorizationPresenter's use.
* Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Ditto.
* Platform/ios/PaymentAuthorizationController.h:
* Platform/ios/PaymentAuthorizationController.mm:
(-[WKPaymentAuthorizationControllerDelegate presentationSceneIdentifierForPaymentAuthorizationController:]): Implements the new PassKit delegate call returning the scene ID for the UIProcess.
(WebKit::PaymentAuthorizationController::dismiss): House keeping.
(WebKit::PaymentAuthorizationController::presentInScene): Stores the scene ID from the caller for WKPaymentAuthorizationControllerDelegate to read from.
* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI): Relays webPageProxyID for use by UIProcess ultimately to look up the correct WebPageProxy.
* Shared/ApplePay/WebPaymentCoordinatorProxy.h: Ditto.
* Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: Ditto.
* Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Presents payment sheet with scene ID if applicable.
* Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): Signature change.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getWindowSceneIdentifierForPaymentPresentation): Looks up the correct WebPageProxy and retrieve the scene ID for the caller (NetworkProcess).
* UIProcess/Network/NetworkProcessProxy.h: Ditto.
* UIProcess/Network/NetworkProcessProxy.messages.in: Ditto.
* UIProcess/PageClient.h: Adds ability to retrieve scene ID.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h: Ditto.
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::sceneID): Ditto.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::getWindowSceneIdentifierForPaymentPresentation): Dummy implementation for conformance to WebPageProxy. WebProcess does not talk to UIProcess directly for this function.
* WebProcess/ApplePay/WebPaymentCoordinator.cpp:
(WebKit::WebPaymentCoordinator::showPaymentUI): Passes the WebPageProxyIdentifier along.
2021-09-30 Jer Noble <jer.noble@apple.com>
Unreviewed Catalyst build fix; forward-declare in RemoteMediaPlayerProxy.h and include the correct file in RemoteMediaPlayerProxy.cpp.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
* GPUProcess/media/RemoteMediaPlayerProxy.h:
2021-09-30 John Wilander <wilander@apple.com>
PCM: Take app bundle ID into consideration when matching triggering events with pending clicks
https://bugs.webkit.org/show_bug.cgi?id=230778
<rdar://problem/83516528>
Reviewed by Alex Christensen.
https://commits.webkit.org/r282884 added app bundle IDs to unattributed
and attributed clicks in PCM. This patch makes sure we take those IDs
into consideration in PCM::Database::attributePrivateClickMeasurement().
A lot of the WebKit part is:
- Piping through app bundle IDs from the network session to the PCM
database where the ID will be matched against stored app bundle IDs.
- Piping through test configuration for app bundle ID.
The real change is in PCM::Database which is explained below.
Test: http/tests/privateClickMeasurement/multiple-app-bundle-ids.html
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setPrivateClickMeasurementAppBundleIDForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
(WebKit::NetworkSession::setPrivateClickMeasurementAppBundleIDForTesting):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::findPrivateClickMeasurement):
Now takes an app bundle ID supplied from the network session and
includes it in the database query to find matching entries. If and
attribution was saved with app bundle ID XYZ, it should only be
be converted in an application with app bundle ID XYZ.
(WebKit::PCM::Database::attributePrivateClickMeasurement):
This function calls PCM::Database::findPrivateClickMeasurement()
which needs the app bundle ID so that ID is forwarded through.
(WebKit::PCM::Database::removeUnattributed):
Also needs to take the app bundle ID into consideration.
(WebKit::PCM::Database::clearSentAttribution):
Also needs to take the app bundle ID into consideration.
(WebKit::PCM::Database::markReportAsSentToDestination):
Also needs to take the app bundle ID into consideration.
(WebKit::PCM::Database::markReportAsSentToSource):
Also needs to take the app bundle ID into consideration.
(WebKit::PCM::Database::earliestTimesToSend):
Also needs to take the app bundle ID into consideration.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::handleAttribution):
(WebKit::PrivateClickMeasurementManager::setPrivateClickMeasurementAppBundleIDForTesting):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::clear):
Clears the test setting for app bundle ID.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::messageTypeSendsReply):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::handleAttribution):
(WebKit::PCM::ManagerProxy::setPrivateClickMeasurementAppBundleIDForTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp:
(WebKit::PCM::Store::attributePrivateClickMeasurement):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPCMFraudPreventionValuesForTesting):
(WKPageSetPrivateClickMeasurementAppBundleIDForTesting):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _setPrivateClickMeasurementAppBundleIDForTesting:completionHandler:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setPrivateClickMeasurementAppBundleIDForTesting):
* UIProcess/WebPageProxy.h:
2021-09-30 Alex Christensen <achristensen@webkit.org>
Clean up PrivateClickMeasurement
https://bugs.webkit.org/show_bug.cgi?id=230978
Reviewed by Kate Cheney.
* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:]):
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setUIEventAttribution:]):
(-[WKWebView _uiEventAttribution]):
(-[WKWebView _setEphemeralUIEventAttribution:forApplicationWithBundleID:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::createNewPage):
* UIProcess/WebPageProxy.h:
2021-09-30 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][a11y] Connect UI process a11y tree with the web process when building with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=230255
Reviewed by Adrian Perez de Castro.
Change BindAccessibilityTree IPC message API to have an async reply. When using ATSPI the UI process replies to
the message including the object path of the AtkSocket, to be used by the web process root object as its parent
property (building the reference with the UI process unique name we get from GetState message).
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const): Encode accessibilityBusAddress.
(WebKit::WebProcessCreationParameters::decode): Decode accessibilityBusAddress.
* Shared/WebProcessCreationParameters.h:
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::bindA11y): Set the accessibilityBusAddress to the shared PlatformDisplay so that it doesn't need to be
get again.
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::bindAccessibilityTree):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::CompletionHandler<void):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::swapToProvisionalPage):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess): Set the accessibilityBusAddress parameter.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree): Call atk_object_ref_state_set() right after atk_socket_embed() to
make sure that's the first GetState message received by the web process root object. Then build the AtkSocket
path and send the async reply.
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::bindAccessibilityTree):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::accessibilityRootObject const):
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize): Create the root object and send BindAccessibilityTree to the UI process,
setting the root object parent path using the socket path received from the UI process.
* WebProcess/WebPage/wpe/WebPageWPE.cpp:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::accessibilityAtspi const):
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Create the AccessibilityAtspi instance for the given address.
2021-09-29 Ada Chan <ada.chan@apple.com>
[WebXR] Hold a foreground assertion for the duration of the immersive session
https://bugs.webkit.org/show_bug.cgi?id=230991
Reviewed by Chris Dumez.
* UIProcess/XR/PlatformXRSystem.cpp:
(WebKit::PlatformXRSystem::initializeTrackingAndRendering):
2021-09-29 Chris Dumez <cdumez@apple.com>
Add support for running service workers on the main thread
https://bugs.webkit.org/show_bug.cgi?id=230649
Reviewed by Alex Christensen.
Add support for running service workers on the main thread (off by default).
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::swServerForSession):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::shouldRunServiceWorkersOnMainThread const):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration shouldRunServiceWorkersOnMainThread]):
(-[_WKWebsiteDataStoreConfiguration setShouldRunServiceWorkersOnMainThread:]):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::shouldRunServiceWorkersOnMainThread const):
(WebKit::WebsiteDataStoreConfiguration::setShouldRunServiceWorkersOnMainThread):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2021-09-29 Alex Christensen <achristensen@webkit.org>
Add weakThis check in addition to null check added in r282881
https://bugs.webkit.org/show_bug.cgi?id=231000
<rdar://83605614>
Reviewed by Brady Eidson.
r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
NetworkResourceLoader to be deleted. It added a null check on m_networkLoad which
sometimes reads freed memory. This certainly isn't great, but luckily we have a way
to check if this object has been deleted. Let's do that.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
2021-09-29 Per Arne Vollan <pvollan@apple.com>
[macOS] Allow audio service in the WebContent process on older versions
https://bugs.webkit.org/show_bug.cgi?id=230974
<rdar://82445437>
Reviewed by Brent Fulgham.
Older versions of macOS still need access to "com.apple.audio.AudioComponentRegistrar" in the WebContent process.
* WebProcess/com.apple.WebProcess.sb.in:
2021-09-29 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] REGRESSION(r280726): registry keys enabling GPU process mode don't work
https://bugs.webkit.org/show_bug.cgi?id=230871
Reviewed by Don Olmstead.
r270175 (Bug 219294) added registry keys to enable GPU process
mode for WinCairo port. But after r280726 (Bug 228803) changed the
function signature, they didn't work.
* Shared/WebPreferencesDefaultValues.cpp:
* Shared/win/WebPreferencesDefaultValuesWin.cpp:
(WebKit::isFeatureFlagEnabled):
2021-09-29 Chris Dumez <cdumez@apple.com>
[ iOS Debug ] http/tests/xmlhttprequest/access-control-preflight-credential-sync.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=228305
<rdar://problem/81136891>
Reviewed by Alex Christensen.
When a NetworkResourceLoader for a synchronous XHR gets aborted (e.g. because the connection to
the WebProcess was severed), NetworkResourceLoader::abort() would fail to call
sendReplyToSynchronousRequest() (sendReplyToSynchronousRequest was only called in didFailLoading() and
didFinishLoading()). As a result, we would hit the following assertion in the NetworkResourceLoader
destructor later on: ASSERT(!isSynchronous() || !m_synchronousLoadData->delayedReply)
No new tests, covered by existing test that I am unskipping.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::abort):
2021-09-29 Sihui Liu <sihui_liu@apple.com>
Add a default return value in convertToExceptionCode
https://bugs.webkit.org/show_bug.cgi?id=230989
Reviewed by Chris Dumez.
To fix non-Cocoa build.
* NetworkProcess/storage/FileSystemStorageError.h:
(WebKit::convertToExceptionCode):
2021-09-29 BJ Burg <bburg@apple.com>
[Cocoa] add _WKInspectorExtension SPI to evaluate script on an extension tab
https://bugs.webkit.org/show_bug.cgi?id=230646
<rdar://problem/83420328>
Reviewed by Devin Rousso.
Add new testing API for evaluating script expressions in the context of a
tab created by _WKInspectorExtension. For the most part, this is implemented
in the same way as the -evaluateScript: method, but the script is evaluated
within the Web Inspector frontend itself rather than in the inspected page.
To avoid CSP issues, the actual evaluation is performed on subframes using a
new InspectorFrontendHost method which takes an <iframe> and script source.
Along the way, tweak Web Inspector's CSP policy to allow loading images from
custom URL schemes as specified using _WKInspectorConfiguration. This is so
that tab icons from the test-resource: scheme can be loaded in the main frame
of Web Inspector's WKWebView under testing situations.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
Add new files.
* UIProcess/API/APIInspectorExtension.h:
* UIProcess/API/APIInspectorExtension.cpp:
(API::InspectorExtension::evaluateScriptInExtensionTab):
Based on evaluateScript(). Call through to the shared extension controller.
* UIProcess/API/Cocoa/_WKInspectorExtensionPrivateForTesting.h: Added.
* UIProcess/API/Cocoa/_WKInspectorExtensionTesting.mm: Added.
(-[_WKInspectorExtension _evaluateScript:inExtensionTabWithIdentifier:completionHandler:]):
Added. Call through to the shared extension controller.
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::evaluateScriptInExtensionTab):
Based on evaluateScript(). Send IPC to the Inspector WebProcess.
* WebProcess/Inspector/WebInspectorUIExtensionController.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.messages.in:
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::evaluateScriptInExtensionTab):
Based on evaluateScriptForExtension. Call into the frontend API
which will perform the actual evaluation on the <iframe> contentWindow.
* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
Specify the list of custom protocols as allowable sources for 'img-src'.
The 'img-src' directive also includes 'file: blob: resource:' as allowable
sources, since this was the previous CSP policy defined in Main.html.
* UIProcess/Cocoa/GroupActivities/GroupActivitiesSessionNotifier.mm:
Fix UnifiedSources fallout by including a missing header.
2021-09-29 Chris Dumez <cdumez@apple.com>
Use isolated NSURLSessions for each first party registrable domain
https://bugs.webkit.org/show_bug.cgi?id=230750
<rdar://83159358>
Reviewed by Alex Christensen.
Previously would use up to 10 isolated NSURLSessions only for domains marked as prevalent
by ITP *and* that the user interacts with as first party website. We now use different
isolated NSURLSession for each top-level registrable domain, not matter their ITP status.
This significantly improves privacy.
To avoid having too many NSURLSession, we clear the ones that haven't been used in the
last 10 minutes, every time we add a new one.
* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
(WebKit::SessionSet::isolatedSession):
2021-09-29 Sihui Liu <sihui_liu@apple.com>
Replace FileSystemHandleImpl with FileSystemStorageConnection
https://bugs.webkit.org/show_bug.cgi?id=230861
<rdar://problem/83606465>
Reviewed by Youenn Fablet.
Replace FileSystemStorageHandleProxy with WebFileSystemStorageConnection.
* NetworkProcess/storage/FileSystemStorageHandle.cpp:
(WebKit::FileSystemStorageHandle::FileSystemStorageHandle):
(WebKit::FileSystemStorageHandle::isSameEntry):
(WebKit::FileSystemStorageHandle::requestCreateHandle):
(WebKit::FileSystemStorageHandle::getFileHandle):
(WebKit::FileSystemStorageHandle::getDirectoryHandle):
(WebKit::FileSystemStorageHandle::resolve):
* NetworkProcess/storage/FileSystemStorageHandle.h:
(WebKit::FileSystemStorageHandle::identifier const):
* NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp:
(WebKit::FileSystemStorageHandleRegistry::registerHandle):
(WebKit::FileSystemStorageHandleRegistry::unregisterHandle):
(WebKit::FileSystemStorageHandleRegistry::getHandle):
* NetworkProcess/storage/FileSystemStorageHandleRegistry.h:
* NetworkProcess/storage/FileSystemStorageManager.cpp:
(WebKit::FileSystemStorageManager::createHandle):
(WebKit::FileSystemStorageManager::getPath):
(WebKit::FileSystemStorageManager::getDirectory):
* NetworkProcess/storage/FileSystemStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::fileSystemGetDirectory):
(WebKit::NetworkStorageManager::isSameEntry):
(WebKit::NetworkStorageManager::getFileHandle):
(WebKit::NetworkStorageManager::getDirectoryHandle):
(WebKit::NetworkStorageManager::removeEntry):
(WebKit::NetworkStorageManager::resolve):
* NetworkProcess/storage/NetworkStorageManager.h:
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* NetworkProcess/storage/OriginStorageManager.h:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.cpp: Renamed from Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp.
(WebKit::WebFileSystemStorageConnection::create):
(WebKit::WebFileSystemStorageConnection::WebFileSystemStorageConnection):
(WebKit::WebFileSystemStorageConnection::connectionClosed):
(WebKit::WebFileSystemStorageConnection::isSameEntry):
(WebKit::WebFileSystemStorageConnection::getFileHandle):
(WebKit::WebFileSystemStorageConnection::getDirectoryHandle):
(WebKit::WebFileSystemStorageConnection::removeEntry):
(WebKit::WebFileSystemStorageConnection::resolve):
* WebProcess/WebCoreSupport/WebFileSystemStorageConnection.h: Renamed from Source/WebKit/WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h.
* WebProcess/WebCoreSupport/WebStorageConnection.cpp:
(WebKit::WebStorageConnection::persist):
(WebKit::WebStorageConnection::fileSystemGetDirectory):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::networkProcessConnectionClosed):
(WebKit::WebProcess::fileSystemStorageConnection):
* WebProcess/WebProcess.h:
2021-09-29 Per Arne <pvollan@apple.com>
Add telemetry to the Networking process sandbox
https://bugs.webkit.org/show_bug.cgi?id=230919
<rdar://problem/83641392>
Reviewed by Brent Fulgham.
Add telemetry to the Networking process sandbox on iOS and macOS.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2021-09-29 Jer Noble <jer.noble@apple.com>
Build-time optimization: forward declare more things in MediaPlayer.h and HTMLMediaElement.h
https://bugs.webkit.org/show_bug.cgi?id=230853
Reviewed by Eric Carlson.
Use new WeakPtr based client setters on TrackPrivates.
* GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
(WebKit::RemoteAudioTrackProxy::~RemoteAudioTrackProxy):
* GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy):
(WebKit::RemoteTextTrackProxy::~RemoteTextTrackProxy):
* GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
(WebKit::RemoteVideoTrackProxy::~RemoteVideoTrackProxy):
2021-09-29 Alex Christensen <achristensen@webkit.org>
Reduce allocations in DatabaseUtilities::sortedTables
https://bugs.webkit.org/show_bug.cgi?id=230933
Reviewed by Chris Dumez.
No change in behavior except no more memory allocations. What a wonderful thing.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::sortedTables):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::migrateDataToNewTablesIfNecessary):
* NetworkProcess/DatabaseUtilities.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::sortedTables):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
2021-09-29 Devin Rousso <drousso@apple.com>
Add support for sending Expected<void, E> in IPC messages
https://bugs.webkit.org/show_bug.cgi?id=230907
Reviewed by Chris Dumez.
* Platform/IPC/ArgumentCoders.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.messages.in:
* WebProcess/Inspector/WebInspectorUIExtensionController.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::registerExtension):
(WebKit::WebInspectorUIExtensionController::unregisterExtension):
(WebKit::WebInspectorUIExtensionController::showExtensionTab):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::showExtensionTab):
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector unregisterExtension:completionHandler:]):
(-[_WKInspector showExtensionTabWithIdentifier:completionHandler:]):
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(-[_WKRemoteWebInspectorViewController unregisterExtension:completionHandler:]):
(-[_WKRemoteWebInspectorViewController showExtensionTabWithIdentifier:completionHandler:]):
Replace `Expected<bool, ...>` with `Expected<void, ...>` now that it can be sent over IPC.
No change in functionality as the `bool` was never actually used (it was a hardcoded `true`).
2021-09-28 Simon Fraser <simon.fraser@apple.com>
Crash in WebKit::DisplayLink::displayLinkCallback()
https://bugs.webkit.org/show_bug.cgi?id=230917
<rdar://82528370>
Reviewed by Tim Horton.
We have evidence of a divide-by-zero crash in DisplayLink::notifyObserversDisplayWasRefreshed()
where m_currentUpdate.updatesPerSecond is zero. The only way I can see this happening
is if DisplayLink::DisplayLink() returns early, which should log. Protect against
this by initializing m_displayNominalFramesPerSecond to 60, and do another check,
with a log, in DisplayLink::addObserver() before we use m_displayNominalFramesPerSecond
for the first time.
Convert the logging to RELEASE_LOG_FAULT reports.
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::addObserver):
* UIProcess/mac/DisplayLink.h:
2021-09-28 Brent Fulgham <bfulgham@apple.com>
Remove unused "com.apple.security.exception.file*" rules from WebKit sandboxes
https://bugs.webkit.org/show_bug.cgi?id=230918
<rdar://problem/66585844>
Reviewed by Per Arne Vollan.
The Sandbox implementation provides a mechanism where apps can extend the default app
sandbox with entitled extension properties attached to their binary at signing time.
WebKit does not need or use this feature. However, the rules were imported to our custom
sandbox when we stopped using the system one. We should remove these rules since we don't
need them, and they add to the size and complexity of the sandbox rule set.
* 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:
2021-09-28 BJ Burg <bburg@apple.com>
[Cocoa] Add SPI to select a tab created by _WKInspectorExtension
https://bugs.webkit.org/show_bug.cgi?id=230580
<rdar://problem/83372851>
Reviewed by Devin Rousso.
Add a new method for selecting an extension tab in WebInspectorUI
that was previously created by using
-[_WKInspectorExtension createNewTab:tabIconURL:sourceURL:completionHandler].
This is a straightforward plumbing exercise. The API test uses the new method
to test the existing _WKInspectorExtensionDelegate callback methods for
didShowTab and didHideTab.
New API test: WKInspectorExtensionDelegate.ShowAndHideTabCallbacks.
* UIProcess/API/Cocoa/_WKInspector.mm:
(-[_WKInspector showExtensionTabWithIdentifier:completionHandler:]):
* UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(-[_WKRemoteWebInspectorViewController showExtensionTabWithIdentifier:completionHandler:]):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::showExtensionTab):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::showExtensionTab):
* WebProcess/Inspector/WebInspectorUIExtensionController.h:
* WebProcess/Inspector/WebInspectorUIExtensionController.messages.in:
2021-09-28 Brent Fulgham <bfulgham@apple.com>
Remove redundant sandbox exception rules for registering mach extensions
https://bugs.webkit.org/show_bug.cgi?id=230909
<rdar://problem/66583587>
Reviewed by Per Arne Vollan.
The Sandbox implementation offers a mechanism for apps to extend their sandbox at compile
time. WebKit does not use those extensions in its sandbox design, so we should remove those
unused rules. They are left-over from importing the global App Sandbox rules long ago, and
are not needed by WebKit.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-09-28 Kate Cheney <katherine_cheney@apple.com>
PCM: different bundleID entries will override each other
https://bugs.webkit.org/show_bug.cgi?id=230839
Reviewed by Alex Christensen.
We recently added a bundleID column to PCM tables. We want to make
sure entries with different bundleIDs do not override each other,
so we should make it a part of the unique constraint on both PCM
tables that contain it. This requires creating new tables and
migrating existing data to them. Luckily this code already exists
in the ITP database, and we can just move it to the shared
DatabaseUtilities class.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::expectedTableAndIndexQueries):
(WebKit::stripIndexQueryToMatchStoredValue): Deleted.
(WebKit::expectedTableAndIndexQueries): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries): Deleted.
(WebKit::insertDistinctValuesInTableStatement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToNewTablesIfNecessary): Deleted.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::stripIndexQueryToMatchStoredValue):
(WebKit::DatabaseUtilities::currentTableAndIndexQueries):
(WebKit::insertDistinctValuesInTableStatement):
(WebKit::DatabaseUtilities::migrateDataToNewTablesIfNecessary):
* NetworkProcess/DatabaseUtilities.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::Database):
(WebKit::PCM::Database::expectedTableAndIndexQueries):
(WebKit::PCM::Database::createUniqueIndices):
(WebKit::PCM::Database::needsUpdatedSchema):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
2021-09-28 Brent Fulgham <bfulgham@apple.com>
Explicitly deny 'system-privilege' in the sandbox profile as a hardening measure
https://bugs.webkit.org/show_bug.cgi?id=230782
<rdar://problem/66582813>
Reviewed by Per Arne Vollan.
Although we do not need 'system-privilege', the default sandbox state includes it as a convenience
for backwards-compatibility.
Update our sandboxes to tell the kernel we don't need the support, except for one case in the
Networking process.
* 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-09-28 Sihui Liu <sihui_liu@apple.com>
Make StorageManager available in Worker
https://bugs.webkit.org/show_bug.cgi?id=230675
<rdar://problem/83448115>
Reviewed by Youenn Fablet.
* WebProcess/WebCoreSupport/WebStorageConnection.cpp:
(WebKit::WebStorageConnection::getPersisted):
* WebProcess/WebCoreSupport/WebStorageConnection.h:
2021-09-28 Per Arne Vollan <pvollan@apple.com>
Enable CFPrefs direct mode in all WebKit processes
https://bugs.webkit.org/show_bug.cgi?id=230771
<rdar://problem/83510055>
Reviewed by Brent Fulgham.
We currently enable CFPrefs direct mode in the WebContent and GPU Process, and we should enable it in all WebKit processes.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::notifyPreferencesChanged):
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceMain):
(WebKit::shouldEnableCFPrefsDirectMode): Deleted.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::notifyPreferencesChanged):
* UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
(WebKit::WebAuthnProcessProxy::singletonIfCreated):
* UIProcess/WebAuthentication/WebAuthnProcessProxy.h:
* WebAuthnProcess/WebAuthnProcess.cpp:
(WebKit::WebAuthnProcess::notifyPreferencesChanged):
* WebAuthnProcess/WebAuthnProcess.h:
* WebAuthnProcess/WebAuthnProcess.messages.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
2021-09-28 Per Arne <pvollan@apple.com>
[GPUP] Add sandbox telemetry
https://bugs.webkit.org/show_bug.cgi?id=230859
<rdar://problem/83591291>
Reviewed by Brent Fulgham.
Add more sandbox telemetry to the GPU process' sandbox on iOS and macOS.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-09-28 Per Arne <pvollan@apple.com>
[macOS] Allow access to mach service for root in the Networking process
https://bugs.webkit.org/show_bug.cgi?id=230843
<rdar://problem/83576091>
Reviewed by Alexey Proskuryakov.
Allow access to the mach service com.apple.trustd for root in the Networking process on macOS.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2021-09-28 Youenn Fablet <youenn@apple.com>
Validate DeviceIdHashSaltStorage persistent data
https://bugs.webkit.org/show_bug.cgi?id=230852
<rdar://problem/83615408>
Reviewed by Eric Carlson.
Add nullptr check to decoded data.
Covered by API test.
* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
2021-09-28 Chris Dumez <cdumez@apple.com>
Move Cross-Origin-Opener-Policy handling to the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=230812
<rdar://83504842>
Reviewed by Youenn Fablet.
Implement COOP handling in the NetworkProcess, inside the NetworkResourceLoader class.
This was logic that was currently implemented at DocumentLoader-level, in the WebProcess.
* NetworkProcess/NetworkProcess.cpp:
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::doCrossOriginOpenerHandlingOfResponse):
(WebKit::toBrowsingContextGroupSwitchDecision):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::sendDidReceiveResponsePotentiallyInNewBrowsingContextGroup):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::triggerBrowsingContextGroupSwitchForNavigation):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
(WebKit::WebPageProxy::triggerBrowsingContextGroupSwitchForNavigation):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendViolationReportWhenNavigatingToCOOPResponse):
(WebKit::WebPage::sendViolationReportWhenNavigatingAwayFromCOOPResponse):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-09-28 Alex Christensen <achristensen@webkit.org>
Mostly fix Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=230868
Reviewed by Don Olmstead.
* PlatformMac.cmake:
2021-09-28 Youenn Fablet <youenn@apple.com>
applyConstraints throws OverconstrainedError if specify exact for deviceId
https://bugs.webkit.org/show_bug.cgi?id=230819
<rdar://problem/83577361>
Reviewed by Eric Carlson.
We were not setting properly the persistent device ID of remote sources.
Set values according provided device.
Test: fast/mediastream/applyConstraints-deviceId.html
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
(WebKit::RemoteRealtimeAudioSource::RemoteRealtimeAudioSource):
* WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::RemoteRealtimeVideoSource):
2021-09-27 Cameron McCormack <heycam@apple.com>
Avoid building log messages when IPCMessages log stream is off
https://bugs.webkit.org/show_bug.cgi?id=230878
<rdar://problem/83605670>
Reviewed by Alex Christensen.
* Platform/IPC/HandleMessage.h:
(IPC::logMessageImpl):
2021-09-27 Jean-Yves Avenard <jya@apple.com>
Vorbis decoder can't be instantiated - Remove workaround added in bug 228139
https://bugs.webkit.org/show_bug.cgi?id=230742
rdar://83484414
Reviewed by Eric Carlson.
This is already covered by test; however this will fail on Monterey without the updated
CoreMedia framework.
* Scripts/process-entitlements.sh: Add new required entitlement.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::initializeSandbox): Only have bug workaround on BigSur and earlier.
2021-09-27 Per Arne <pvollan@apple.com>
[iOS][GPUP] Remove access to unused mach services in sandbox
https://bugs.webkit.org/show_bug.cgi?id=230832
<rdar://problem/83573640>
Reviewed by Brent Fulgham.
Remove access to mach services on iOS in the GPU process that are unused, according to telemetry.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-09-27 BJ Burg <bburg@apple.com>
[Cocoa] backport showConsole() and showResources() for RemoteWebInspectorUI
https://bugs.webkit.org/show_bug.cgi?id=230573
<rdar://problem/83365814>
Reviewed by Devin Rousso.
These methods already exist for _WKInspector. A test will be added in
future patch that tests _WKInspectorExtensionDelegate shown/hidden callback methods.
* UIProcess/API/Cocoa/_WKInspectorIBActions.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKInspector.h.
Added. API and SPI that are shared between local and remote Web Inspector
should go in this class. Since these methods are used to implement IBActions for a
detached Web Inspector window, the protocol is named _WKInspectorIBActions.
Hoist showResources() and showConsole() to this shared protocol.
* UIProcess/API/Cocoa/_WKInspectorExtensionHost.h:
* UIProcess/API/Cocoa/_WKInspector.h: Remove methods that are
part of the _WKInspectorIBActions protocol.
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(-[_WKRemoteWebInspectorViewController showConsole]):
(-[_WKRemoteWebInspectorViewController showResources]):
Added. Call into RemoteWebInspectorUIProxy.
* UIProcess/Inspector/RemoteWebInspectorUIProxy.h:
* UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp:
(WebKit::RemoteWebInspectorUIProxy::showConsole):
(WebKit::RemoteWebInspectorUIProxy::showResources):
Added. Send an IPC message to the Inspector web process.
* WebProcess/Inspector/RemoteWebInspectorUI.h:
* WebProcess/Inspector/RemoteWebInspectorUI.messages.in:
Add new messages.
* WebProcess/Inspector/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::showConsole):
(WebKit::RemoteWebInspectorUI::showResources):
Added. Backport the implementation from WebInspectorUI.
2021-09-27 Youenn Fablet <youenn@apple.com>
iPadOS 15 / iOS 15 unable to decode VP9 stream
https://bugs.webkit.org/show_bug.cgi?id=230604
<rdar://problem/83391595>
Reviewed by Eric Carlson.
Update code to retrieve some parameters when synchronously creating the GPU process connection.
The sole parameter is currently to know the HW VP9 decoder availability.
If HW VP9 decoder is not supported by GPUProcess code, we fallback to SW libvpx.
Manually tested.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::createGPUConnectionToWebProcess):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* Shared/GPUProcessConnectionInitializationParameters.h: Added.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::getGPUProcessConnection):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::GPUProcessConnection):
* WebProcess/GPU/GPUProcessConnection.h:
(WebKit::GPUProcessConnection::create):
(WebKit::GPUProcessConnection::hasVP9HardwareDecoder const):
* WebProcess/GPU/GPUProcessConnectionInfo.h:
(WebKit::GPUProcessConnectionInfo::encode const):
(WebKit::GPUProcessConnectionInfo::decode):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::setCallbacks):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureGPUProcessConnection):
2021-09-27 Youenn Fablet <youenn@apple.com>
Make sure to reset presenting application pid in case of mediaserverd crash
https://bugs.webkit.org/show_bug.cgi?id=230822
<rdar://83474184>
Reviewed by Eric Carlson.
Add API to crash GPUProcess from WebKitTestRunner.
Make sure to forward to MediaPlayer the fact that the layer failed.
This was handled for GPUProcess crash but not for other cases like mediaserverd crashes.
* UIProcess/API/C/WKContext.cpp:
(WKContextTerminateGPUProcess):
* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::terminateForTesting):
* UIProcess/GPU/GPUProcessProxy.h:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::setDidFail):
2021-09-27 Youenn Fablet <youenn@apple.com>
Rename RemoteCaptureSampleManager::RemoteAudio thread appropriately
https://bugs.webkit.org/show_bug.cgi?id=230745
Reviewed by Eric Carlson.
No change of behavior.
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::RemoteAudio::startThread):
2021-09-27 Tim Nguyen <ntim@apple.com>
Replace Node::isInert() with RenderStyle::effectiveInert()
https://bugs.webkit.org/show_bug.cgi?id=230686
Reviewed by Antti Koivisto.
This replaces Node::isInert() in favor of RenderStyle::effectiveInert() which is more accurate. We can't use it in
Element::isFocusable(), since there's a bug with invalidation when accessing the cached computedStyle, hence
the Node::deprecatedIsInert() method.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::selectionPositionInformation):
2021-09-25 Ben Nham <nham@apple.com>
Pending preconnect key should include User-Agent
https://bugs.webkit.org/show_bug.cgi?id=230565
Reviewed by Chris Dumez.
When using an HTTPS proxy, the HTTP connection cache key used for connection coalescing in
CFNetwork includes the User-Agent (<rdar://problem/59434166>). This means we should also
include it in the preconnect cache key. Otherwise, we might delay the main resource load on
preconnect unnecessarily in cases where the User-Agent mismatches and the preconnect gets
thrown away. This can happen if (for instance) a page is force-loaded into desktop or mobile
mode on iOS, which causes a UA change after the call to decidePolicyForNavigationAction.
* NetworkProcess/NetworkLoadScheduler.cpp:
(WebKit::mainResourceLoadKey):
(WebKit::NetworkLoadScheduler::scheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::unscheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::startedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::finishedPreconnectForMainResource):
* NetworkProcess/NetworkLoadScheduler.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
2021-09-24 Lauro Moura <lmoura@igalia.com>
Non-unified partial build fixes late September edition
https://bugs.webkit.org/show_bug.cgi?id=230763
Unreviewed non-unified build fixes.
* NetworkProcess/NetworkProcess.cpp: Add missing header.
* NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp: Ditto.
* NetworkProcess/storage/FileSystemStorageManager.cpp: Ditto.
* NetworkProcess/storage/OriginStorageManager.h: Ditto.
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: Add missing header.
(WebKit::RTCDataChannelRemoteManager::detectError): WebCore namespace.
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didDetectError): Ditto.
* WebProcess/WebCoreSupport/WebStorageConnection.cpp: Add missing
header.
2021-09-24 Per Arne Vollan <pvollan@apple.com>
Clean up preference rules in sandboxes
https://bugs.webkit.org/show_bug.cgi?id=230578
<rdar://problem/83371815>
Reviewed by Brent Fulgham.
We are currently duplicating many preference domains in the sandboxes after blocking cfprefsd by using CFPrefs direct mode.
This is addressed by adopting a pre-existing macro that adds the required file access privileges in CFPrefs direct mode.
This patch also creates a sandbox include file for preferences, which can be shared among WebKit processes.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebAuthn.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
* Shared/Sandbox: Added.
* Shared/Sandbox/preferences.sb: Added.
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/com.apple.WebProcess.sb.in:
2021-09-24 Devin Rousso <drousso@apple.com>
Add typechecking `is` overloads for `std::unique_ptr`, `WTF::UniqueRef`, and `WTF::WeakPtr`
https://bugs.webkit.org/show_bug.cgi?id=230734
Reviewed by Chris Dumez.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setTextAsync):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::performActionOnElement):
(WebKit::WebPage::autofillLoginCredentials):
2021-09-24 Eric Hutchison <ehutchison@apple.com>
Unreviewed, reverting r283024.
Causes slowdown and crash on EWS
Reverted changeset:
"[WebKit2] Refactor some IPC argument encoder logic to work
with StreamConnectionEncoder"
https://bugs.webkit.org/show_bug.cgi?id=230714
https://commits.webkit.org/r283024
2021-09-24 Youenn Fablet <youenn@apple.com>
RTCDataChannelHandlerClient does not need to be ref counted
https://bugs.webkit.org/show_bug.cgi?id=230679
Reviewed by Eric Carlson.
Move to UniqueRef now that it is no longer ref counted.
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::connectToRemoteSource):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h:
2021-09-24 Per Arne Vollan <pvollan@apple.com>
Remove directory rule from sandboxes
https://bugs.webkit.org/show_bug.cgi?id=230637
<rdar://58899134>
Reviewed by Brent Fulgham.
This rule is related to UITextField, which is only used in the UI process.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-09-24 Kimmo Kinnunen <kkinnunen@apple.com>
Add utility to create CVPixelBuffers from IOSurfaces
https://bugs.webkit.org/show_bug.cgi?id=230338
Reviewed by Youenn Fablet.
The helper function moved from ImageTransferSessionVT
to free standalone function. Stop instantiating the
object and just call the function.
In both of the cases, the pixel buffer is created out of
the IOSurface and the pool is not used. In both of the cases
the size and the pixel format of the image transfer session
is the same as the input IOSurface.
* GPUProcess/webrtc/LibWebRTCCodecsProxy.h:
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::completedDecoding):
(WebKit::LibWebRTCCodecs::encodeFrame):
(WebKit::LibWebRTCCodecs::pixelBufferPool):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.h:
2021-09-24 Youenn Fablet <youenn@apple.com>
<video> element rendered incorrectly when provided with a portrait orientation stream in Safari 15
https://bugs.webkit.org/show_bug.cgi?id=229792
<rdar://problem/82776741>
Reviewed by Eric Carlson.
Helper routined used in WTR.
* Shared/API/c/cg/WKImageCG.cpp:
(WKImageCreateDataURLFromImage):
* Shared/API/c/cg/WKImageCG.h:
2021-09-24 Youenn Fablet <youenn@apple.com>
[IOS 15] Video track does not get unmuted in case of tab was inactive less than ~500 ms
https://bugs.webkit.org/show_bug.cgi?id=230538
<rdar://problem/83355705>
Reviewed by Eric Carlson.
Add support for mock capture interruption.
When receiving a notification that GPUProcess source is muted, we consider it is interrupted.
In that case, we notify the source is muted instead of calling setMuted (which would set the source as muted AND stop producing data).
It is important to not stop the source so that it can continue receiving interruption notifications.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::setMockCameraIsInterrupted):
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* UIProcess/API/C/WKPage.cpp:
(WKPageIsMockRealtimeMediaSourceCenterEnabled):
(WKPageSetMockCameraIsInterrupted):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::setMockCameraIsInterrupted):
* UIProcess/GPU/GPUProcessProxy.h:
* WebProcess/cocoa/RemoteRealtimeAudioSource.h:
* WebProcess/cocoa/RemoteRealtimeVideoSource.h:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::sourceMutedChanged):
2021-09-24 Sihui Liu <sihui_liu@apple.com>
Add initial support for File System Access API
https://bugs.webkit.org/show_bug.cgi?id=230484
rdar://83405890
Reviewed by Youenn Fablet.
Introduce FileSystemStorageManager to manage file handles. Each FileSystemStorageHandle corresponds to a
FileSystemHandle in web process.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::removeStorageManagerForSession):
* NetworkProcess/storage/FileSystemStorageError.h: Added.
(WebKit::convertToExceptionCode):
* NetworkProcess/storage/FileSystemStorageHandle.cpp: Added.
(WebKit::FileSystemStorageHandle::FileSystemStorageHandle):
(WebKit::FileSystemStorageHandle::isSameEntry):
(WebKit::FileSystemStorageHandle::requestCreateHandle):
(WebKit::FileSystemStorageHandle::getFileHandle):
(WebKit::FileSystemStorageHandle::getDirectoryHandle):
(WebKit::FileSystemStorageHandle::removeEntry):
(WebKit::FileSystemStorageHandle::resolve):
* NetworkProcess/storage/FileSystemStorageHandle.h: Added.
(WebKit::FileSystemStorageHandle::identifier const):
(WebKit::FileSystemStorageHandle::path const):
* NetworkProcess/storage/FileSystemStorageHandleIdentifier.h: Added.
* NetworkProcess/storage/FileSystemStorageHandleRegistry.cpp: Added.
(WebKit::FileSystemStorageHandleRegistry::registerHandle):
(WebKit::FileSystemStorageHandleRegistry::unregisterHandle):
(WebKit::FileSystemStorageHandleRegistry::getHandle):
* NetworkProcess/storage/FileSystemStorageHandleRegistry.h: Added.
* NetworkProcess/storage/FileSystemStorageManager.cpp: Added.
(WebKit::FileSystemStorageManager::FileSystemStorageManager):
(WebKit::FileSystemStorageManager::~FileSystemStorageManager):
(WebKit::FileSystemStorageManager::createHandle):
(WebKit::FileSystemStorageManager::getPath):
(WebKit::FileSystemStorageManager::connectionClosed):
(WebKit::FileSystemStorageManager::getDirectory):
* NetworkProcess/storage/FileSystemStorageManager.h: Added.
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::NetworkStorageManager):
(WebKit::NetworkStorageManager::~NetworkStorageManager):
(WebKit::NetworkStorageManager::close):
(WebKit::NetworkStorageManager::startReceivingMessageFromConnection):
(WebKit::NetworkStorageManager::stopReceivingMessageFromConnection):
(WebKit::NetworkStorageManager::clearStorageForTesting):
(WebKit::NetworkStorageManager::fileSystemGetDirectory):
(WebKit::NetworkStorageManager::isSameEntry):
(WebKit::NetworkStorageManager::getFileHandle):
(WebKit::NetworkStorageManager::getDirectoryHandle):
(WebKit::NetworkStorageManager::removeEntry):
(WebKit::NetworkStorageManager::resolve):
* NetworkProcess/storage/NetworkStorageManager.h:
(WebKit::NetworkStorageManager::sessionID const): Deleted.
* NetworkProcess/storage/NetworkStorageManager.messages.in:
* NetworkProcess/storage/OriginStorageManager.cpp:
(WebKit::OriginStorageManager::StorageBucket::connectionClosed):
(WebKit::OriginStorageManager::StorageBucket::typeStoragePath const):
(WebKit::OriginStorageManager::StorageBucket::fileSystemStorageManager):
(WebKit::OriginStorageManager::connectionClosed):
(WebKit::OriginStorageManager::defaultBucket):
(WebKit::OriginStorageManager::persist):
(WebKit::OriginStorageManager::fileSystemStorageManager):
* NetworkProcess/storage/OriginStorageManager.h:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.cpp: Added.
(WebKit::FileSystemStorageHandleProxy::create):
(WebKit::FileSystemStorageHandleProxy::FileSystemStorageHandleProxy):
(WebKit::FileSystemStorageHandleProxy::connectionClosed):
(WebKit::FileSystemStorageHandleProxy::isSameEntry):
(WebKit::FileSystemStorageHandleProxy::getFileHandle):
(WebKit::FileSystemStorageHandleProxy::getDirectoryHandle):
(WebKit::FileSystemStorageHandleProxy::removeEntry):
(WebKit::FileSystemStorageHandleProxy::resolve):
* WebProcess/WebCoreSupport/FileSystemStorageHandleProxy.h: Added.
* WebProcess/WebCoreSupport/WebStorageConnection.cpp:
(WebKit::WebStorageConnection::getPersisted):
(WebKit::WebStorageConnection::persist):
(WebKit::WebStorageConnection::fileSystemGetDirectory):
(WebKit::WebStorageConnection::persisted): Deleted.
* WebProcess/WebCoreSupport/WebStorageConnection.h:
2021-09-23 Wenson Hsieh <wenson_hsieh@apple.com>
[WebKit2] Refactor some IPC argument encoder logic to work with StreamConnectionEncoder
https://bugs.webkit.org/show_bug.cgi?id=230714
Reviewed by Simon Fraser.
Make it possible to use `IPC::StreamConnectionEncoder` to encode display list items (and their members) in an
IPC stream. This patch comprises two main sets of changes in `ArgumentCoders`, and `WebCoreArgumentCoders`. See
below for more details.
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<audit_token_t>::decode):
(IPC::ArgumentCoder<Monostate>::encode): Deleted.
(IPC::ArgumentCoder<Monostate>::decode): Deleted.
* Platform/IPC/ArgumentCoders.h:
(IPC::ArgumentCoder<Monostate>::encode):
(IPC::ArgumentCoder<Monostate>::decode):
Many of these `encode()` methods are currently non-templated, which means that Encoder and Decoder used here
refer solely to IPC::Encoder and IPC::Decoder (respectively) instead of other types of encoders (namely,
StreamConnectionEncoder).
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<AffineTransform>::encode): Deleted.
(IPC::ArgumentCoder<AffineTransform>::decode): Deleted.
(IPC::ArgumentCoder<TransformationMatrix>::encode): Deleted.
(IPC::ArgumentCoder<TransformationMatrix>::decode): Deleted.
(IPC::ArgumentCoder<FloatPoint>::encode): Deleted.
(IPC::ArgumentCoder<FloatPoint>::decode): Deleted.
(IPC::ArgumentCoder<FloatPoint3D>::encode): Deleted.
(IPC::ArgumentCoder<FloatPoint3D>::decode): Deleted.
(IPC::ArgumentCoder<FloatRect>::encode): Deleted.
(IPC::ArgumentCoder<FloatRect>::decode): Deleted.
(IPC::ArgumentCoder<FloatBoxExtent>::encode): Deleted.
(IPC::ArgumentCoder<FloatBoxExtent>::decode): Deleted.
(IPC::ArgumentCoder<FloatSize>::encode): Deleted.
(IPC::ArgumentCoder<FloatSize>::decode): Deleted.
(IPC::ArgumentCoder<FloatRoundedRect>::encode): Deleted.
(IPC::ArgumentCoder<FloatRoundedRect>::decode): Deleted.
(IPC::ArgumentCoder<IntPoint>::encode): Deleted.
(IPC::ArgumentCoder<IntPoint>::decode): Deleted.
(IPC::ArgumentCoder<IntRect>::encode): Deleted.
(IPC::ArgumentCoder<IntRect>::decode): Deleted.
(IPC::ArgumentCoder<IntSize>::encode): Deleted.
(IPC::ArgumentCoder<IntSize>::decode): Deleted.
(IPC::ArgumentCoder<LayoutSize>::encode): Deleted.
(IPC::ArgumentCoder<LayoutSize>::decode): Deleted.
(IPC::ArgumentCoder<LayoutPoint>::encode): Deleted.
(IPC::ArgumentCoder<LayoutPoint>::decode): Deleted.
These WebCore argument coders are also currently incompatible with StreamConnectionEncoder, since they are non-
templated (and thus only work with IPC::Encoder). Since these are all encodable as POD types, we can just use
SimpleArgumentCoder for all of these. We also add a new `DEFINE_SIMPLE_ARGUMENT_CODER` macro to make this code a
bit easier to read.
* Shared/WebCoreArgumentCoders.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<CGRect>::encode): Deleted.
(IPC::ArgumentCoder<CGRect>::decode): Deleted.
(IPC::ArgumentCoder<CGSize>::encode): Deleted.
(IPC::ArgumentCoder<CGSize>::decode): Deleted.
(IPC::ArgumentCoder<CGPoint>::encode): Deleted.
(IPC::ArgumentCoder<CGPoint>::decode): Deleted.
(IPC::ArgumentCoder<CGAffineTransform>::encode): Deleted.
(IPC::ArgumentCoder<CGAffineTransform>::decode): Deleted.
2021-09-23 Per Arne Vollan <pvollan@apple.com>
Remove access to unused services in the Networking access
https://bugs.webkit.org/show_bug.cgi?id=230715
<rdar://problem/83462947>
Reviewed by Brent Fulgham.
Telemetry is showing that some services allowed in the Networking process' sandbox are unused. These should be removed.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2021-09-23 Per Arne Vollan <pvollan@apple.com>
Remove access to unused services in the GPU process
https://bugs.webkit.org/show_bug.cgi?id=230716
<rdar://problem/83464232>
Reviewed by Brent Fulgham.
Telemetry is showing that some services allowed in the GPU process' sandbox are unused. These should be removed.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-09-23 Tim Horton <timothy_horton@apple.com>
Move more linked-on-or-after checks to WebCore::linkedOnOrAfter()
https://bugs.webkit.org/show_bug.cgi?id=230694
Reviewed by Wenson Hsieh.
* UIProcess/API/Cocoa/WKWebView.mm:
(shouldRequireUserGestureToLoadVideo):
(-[WKWebView _initializeWithConfiguration:]):
2021-09-23 Tim Horton <timothy_horton@apple.com>
shouldAllowPictureInPictureMediaPlayback should use WebCore's linkedOnOrAfter()
https://bugs.webkit.org/show_bug.cgi?id=230674
Reviewed by Simon Fraser.
* UIProcess/API/Cocoa/WKWebView.mm:
(shouldAllowPictureInPictureMediaPlayback):
Adopt the WebCore API (which supports overrides for Safari and for testing).
2021-09-23 Brent Fulgham <bfulgham@apple.com>
Remove XSS Auditor: Part 3 (Deprecate API)
https://bugs.webkit.org/show_bug.cgi?id=230661
<rdar://problem/83428911>
Reviewed by Mark Lam.
As a final step, deprecate the API now that the feature is removed. Once all clients have
removed use of the API we can remove from the framework.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetXSSAuditorEnabled):
(WKPreferencesGetXSSAuditorEnabled):
* UIProcess/API/C/WKPreferencesRef.h:
2021-09-23 Per Arne Vollan <pvollan@apple.com>
Fix incorrect mach service name in sandboxes
https://bugs.webkit.org/show_bug.cgi?id=230640
<rdar://55258216>
Reviewed by Brent Fulgham.
Authentication related rules are using incorrect service names in sandboxes.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebAuthnProcess/mac/com.apple.WebKit.WebAuthnProcess.sb.in:
2021-09-23 Jean-Yves Avenard <jya@apple.com>
Opus and Vorbis codecs aren't available on iPad.
https://bugs.webkit.org/show_bug.cgi?id=230595
rdar://problem/83382734
Vorbis and Opus are usable on platforms other than macOS and are being checked
at runtime.
Reviewed by Eric Carlson.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-09-23 Chris Lord <clord@igalia.com>
[GTK] Allow sending precise mouse wheel events in LayoutTests
https://bugs.webkit.org/show_bug.cgi?id=230541
Reviewed by Tim Horton.
Add code to be able to send precise synthetic mouse-wheel events in GTK.
* Shared/NativeWebWheelEvent.h:
* Shared/gtk/NativeWebWheelEventGtk.cpp:
(WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSynthesizeWheelEvent):
(webkitWebViewBaseSetWheelHasPreciseDeltas):
* UIProcess/API/gtk/WebKitWebViewBaseInternal.h:
2021-09-22 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, (manually) reverting r282856.
https://bugs.webkit.org/show_bug.cgi?id=230634
Caused ProcessSwap API test failures on iOS.
Reverted changest:
"Remove GenericCallback"
https://bugs.webkit.org/show_bug.cgi?id=229366
https://trac.webkit.org/changeset/282856/webkit
2021-09-22 Alex Christensen <achristensen@webkit.org>
PCM should include the bundle ID of the app from which it originated
https://bugs.webkit.org/show_bug.cgi?id=230576
<rdar://83065221>
Reviewed by Kate Cheney.
* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase const):
(WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase): Deleted.
* NetworkProcess/DatabaseUtilities.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::Database):
(WebKit::PCM::Database::insertPrivateClickMeasurement):
(WebKit::PCM::Database::privateClickMeasurementToStringForTesting const):
(WebKit::PCM::Database::attributionToStringForTesting const):
(WebKit::PCM::Database::addBundleIDColumnIfNecessary):
(WebKit::PCM::Database::columnsForTable):
(WebKit::PCM::Database::addMissingColumnToTable):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:applicationBundleID:]):
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:]): Deleted.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setEphemeralUIEventAttribution:]):
(-[WKWebView _setEphemeralUIEventAttribution:forApplicationWithBundleID:]):
2021-09-22 Alex Christensen <achristensen@webkit.org>
Move PCMDaemon to WebKit.framework and rename it to AdAttributionDaemon
https://bugs.webkit.org/show_bug.cgi?id=230516
Reviewed by Brent Fulgham.
Also, open iOS NetworkProcess's sandbox to allow connecting to it.
* Configurations/AdAttributionDaemon.xcconfig: Renamed from Tools/TestWebKitAPI/Configurations/TestPCMDaemon.xcconfig.
* Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
* Shared/EntryPointUtilities/Cocoa/Daemon/AdAttributionDaemon.c: Renamed from Tools/TestWebKitAPI/cocoa/TestPCMDaemonMain.c.
* WebKit.xcodeproj/project.pbxproj:
2021-09-22 Chris Dumez <cdumez@apple.com>
Drop makeRef() and use Ref { } instead
https://bugs.webkit.org/show_bug.cgi?id=230626
Reviewed by Alex Christensen.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
(WebKit::RemoteRenderingBackend::cacheNativeImage):
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::createH264Decoder):
(WebKit::LibWebRTCCodecsProxy::createH265Decoder):
(WebKit::LibWebRTCCodecsProxy::createVP9Decoder):
(WebKit::LibWebRTCCodecsProxy::createEncoder):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::hasStorageAccess):
(WebKit::ResourceLoadStatisticsDatabaseStore::grantStorageAccessInternal):
(WebKit::ResourceLoadStatisticsDatabaseStore::updateCookieBlocking):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::removeDataRecords):
(WebKit::ResourceLoadStatisticsStore::processStatisticsAndDataRecords):
(WebKit::ResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
(WebKit::ResourceLoadStatisticsStore::updateCacheMaxAgeCap):
(WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
(WebKit::ResourceLoadStatisticsStore::updateCookieBlockingForDomains):
(WebKit::ResourceLoadStatisticsStore::logTestingEvent):
(WebKit::ResourceLoadStatisticsStore::removeAllStorageAccess):
* NetworkProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
* NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::findPendingDownloadLocation):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::SessionStorageQuotaManager::ensureOriginStorageQuotaManager):
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::initialize):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp:
(WebKit::PCM::Store::Store):
(WebKit::PCM::Store::insertPrivateClickMeasurement):
(WebKit::PCM::Store::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
(WebKit::PCM::Store::attributePrivateClickMeasurement):
(WebKit::PCM::Store::privateClickMeasurementToStringForTesting const):
(WebKit::PCM::Store::allAttributedPrivateClickMeasurement):
(WebKit::PCM::Store::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::PCM::Store::clearPrivateClickMeasurement):
(WebKit::PCM::Store::clearPrivateClickMeasurementForRegistrableDomain):
(WebKit::PCM::Store::clearExpiredPrivateClickMeasurement):
(WebKit::PCM::Store::clearSentAttribution):
(WebKit::PCM::Store::close):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::loadWithCacheEntry):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::from):
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::open):
(WebKit::CacheStorage::Cache::retrieveRecord):
(WebKit::CacheStorage::Cache::retrieveRecords):
(WebKit::CacheStorage::Cache::put):
(WebKit::CacheStorage::Cache::updateRecordToDisk):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::initializeSize):
(WebKit::CacheStorage::Caches::readRecordsList):
(WebKit::CacheStorage::Caches::writeRecord):
(WebKit::CacheStorage::Caches::readRecord):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
* NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp:
(WebKit::NetworkCache::IOChannel::readSyncInThread):
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::NetworkStorageManager):
(WebKit::NetworkStorageManager::clearStorageForTesting):
* NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
(WebKit::NetworkMDNSRegister::registerMDNSName):
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::NetworkRTCProvider):
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::processIncomingMessage):
* Platform/IPC/HandleMessage.h:
(IPC::handleMessageSynchronous):
(IPC::handleMessageSynchronousWantsConnection):
(IPC::handleMessageAsync):
(IPC::handleMessageAsyncWantsConnection):
* Platform/IPC/MessageReceiveQueues.h:
* Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnection<Receiver>::startReceivingMessages):
* Platform/SharedMemory.cpp:
(WebKit::SharedMemory::createSharedBuffer const):
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::updateSceneState):
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::~CompositingRunLoop):
* UIProcess/API/APIContentWorld.cpp:
(API::ContentWorld::sharedWorldWithName):
* UIProcess/API/Cocoa/WKDownload.mm:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _frames:]):
* UIProcess/API/Cocoa/_WKDownload.mm:
(-[_WKDownload cancel]):
* UIProcess/API/glib/WebKitDownload.cpp:
(webkit_download_cancel):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::getBrowsingContext):
(WebKit::WebAutomationSession::switchToBrowsingContext):
(WebKit::WebAutomationSession::willShowJavaScriptDialog):
(WebKit::WebAutomationSession::simulateMouseInteraction):
(WebKit::WebAutomationSession::simulateWheelInteraction):
(WebKit::WebAutomationSession::performMouseInteraction):
(WebKit::WebAutomationSession::performKeyboardInteractions):
(WebKit::WebAutomationSession::takeScreenshot):
* UIProcess/BackgroundProcessResponsivenessTimer.cpp:
(WebKit::BackgroundProcessResponsivenessTimer::setResponsive):
* UIProcess/Cocoa/LegacyDownloadClient.mm:
(WebKit::LegacyDownloadClient::didReceiveAuthenticationChallenge):
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
(WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
(WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::beginSafeBrowsingCheck):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
* UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::DrawingAreaProxy):
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
(WebKit::WebInspectorUIExtensionControllerProxy::registerExtension):
(WebKit::WebInspectorUIExtensionControllerProxy::unregisterExtension):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
(WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::callObserverCallback):
* UIProcess/ResponsivenessTimer.cpp:
(WebKit::ResponsivenessTimer::timerFired):
(WebKit::ResponsivenessTimer::stop):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::grantRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::updateStoredRequests):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::addProcessIfPossible):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::handleSynchronousMessage):
(WebKit::WebProcessPool::processForNavigation):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createSpeechRecognitionServer):
(WebKit::WebProcessProxy::ensureSpeechRecognitionRemoteRealtimeMediaSourceManager):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::WebURLSchemeTask):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::beginAppBoundDomainCheck):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::networkProcessForSession):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem):
* WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.cpp:
(WebKit::MediaKeySystemPermissionRequestManager::sendMediaKeySystemRequest):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::recordFontUse):
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::ensureGPUProcessConnectionOnMainThreadWithLock):
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::MediaRecorderPrivate):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResource):
(WebKit::WebLoaderStrategy::schedulePluginStreamLoad):
* WebProcess/Network/webrtc/LibWebRTCNetworkManager.cpp:
(WebKit::LibWebRTCNetworkManager::StartUpdating):
(WebKit::LibWebRTCNetworkManager::networksChanged):
(WebKit::LibWebRTCNetworkManager::networkProcessCrashed):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::cancelAndForgetLoader):
* WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp:
(WebKit::SpeechRecognitionRealtimeMediaSourceManager::createSource):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPC::visitedLinkStoreID):
(WebKit::IPCTestingAPI::JSMessageListener::didReceiveMessage):
(WebKit::IPCTestingAPI::JSMessageListener::willSendMessage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScript):
(WebKit::WebPage::requestStorageAccess):
(WebKit::WebPage::requestTextRecognition):
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::showEmojiPicker):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
(WebKit::isObscuredElement):
(WebKit::elementPositionInformation):
(WebKit::WebPage::focusTextInputContextAndPlaceCaret):
(WebKit::WebPage::animationDidFinishForElement):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
(WebKit::TiledCoreAnimationDrawingArea::handleActivityStateChangeCallbacksIfNeeded):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureSpeechRecognitionRealtimeMediaSourceManager):
2021-09-22 Brady Eidson <beidson@apple.com>
Disable FTP.
<rdar://81193860> and https://bugs.webkit.org/show_bug.cgi?id=230477
Reviewed by Geoff Garen.
Covered by new API tests.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::start):
(WebKit::NetworkLoad::willPerformHTTPRedirection):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::ftpEnabled const):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
2021-09-22 Megan Gardner <megan_gardner@apple.com>
Build fix for 230521
https://bugs.webkit.org/show_bug.cgi?id=230629
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKContentViewInteraction.mm:
(toGestureType):
2021-09-22 Philippe Normand <pnormand@igalia.com>
[Flatpak SDK] Switch runtime to 21.08 SDK
https://bugs.webkit.org/show_bug.cgi?id=229919
Reviewed by Michael Catanzaro.
* Shared/RTCNetwork.h: Unified build fix, include <optional> before using std::optional<T>.
2021-09-22 Megan Gardner <megan_gardner@apple.com>
Remove unused enums.
https://bugs.webkit.org/show_bug.cgi?id=230521
Reviewed by Wenson Hsieh.
Removing enums that are not used by UIKit or WebKit.
* Platform/spi/ios/UIKitSPI.h:
* Shared/ios/GestureTypes.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(toGestureType):
(toUIWKGestureType):
2021-09-21 Jean-Yves Avenard <jya@apple.com>
Use SharedMemory for transferring appended buffers from SourceBuffer to the GPU process
https://bugs.webkit.org/show_bug.cgi?id=230329
rdar://problem/83291495
Use SharedMemory to pass SourceBuffer content to RemoteSourceBufferProxy in GPU process.
This is done by wrapping a SharedMemory into a SharedBuffer.
Reviewed by Jer Noble.
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::append):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* Platform/SharedMemory.cpp:
(WebKit::SharedMemory::createSharedBuffer const):
* Platform/SharedMemory.h:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::append):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
2021-09-21 Simon Fraser <simon.fraser@apple.com>
Change from ENABLE(RUBBER_BANDING) to HAVE(RUBBER_BANDING)
https://bugs.webkit.org/show_bug.cgi?id=230583
Reviewed by Tim Horton.
RUBBER_BANDING is not a feature we'll ever turn off on macOS, and it was only ever enabled
for that platform. However, it's also used in some cross-platform code, so
HAVE(RUBBER_BANDING) makes more sense for that use.
Also remove ENABLE(RUBBER_BANDING) #ifdefs from inside PLATFORM(MAC) code.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::updateCustomAppearance):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didAddHeaderLayer):
(WebKit::WebChromeClient::didAddFooterLayer):
2021-09-21 Ross Kirsling <ross.kirsling@sony.com>
[PlayStation] Unreviewed build fix (second attempt).
* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:
2021-09-21 Ross Kirsling <ross.kirsling@sony.com>
[PlayStation] Unreviewed build fix.
* UIProcess/API/C/playstation/WKPagePrivatePlayStation.cpp:
2021-09-21 Alex Christensen <achristensen@webkit.org>
Remove GenericCallback
https://bugs.webkit.org/show_bug.cgi?id=229366
Reviewed by Chris Dumez.
It has been replaced by sendWithAsyncReply.
This last use can't really be replaced by sendWithAsyncReply because the CallbackIDs are sent, then further encoded
in RemoteLayerTreeTransaction::encode/decode which you can't really do with a CompletionHandler. But we can replace
GenericCallback with WTF::Function.
* Shared/CallbackID.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* UIProcess/API/APIAttachment.h:
* UIProcess/API/APIIconLoadingClient.h:
* UIProcess/API/APIInspectorExtension.cpp:
* UIProcess/API/APIUIClient.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageCallAfterNextPresentationUpdate):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
* UIProcess/API/Cocoa/WKErrorInternal.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
(-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
* UIProcess/API/Cocoa/_WKInspectorExtension.mm:
* UIProcess/API/mac/WKView.mm:
(-[WKView _doAfterNextPresentationUpdate:]):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::takeScreenshot):
* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
* UIProcess/Cocoa/WebViewImpl.mm:
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::dispatchAfterEnsuringDrawing):
* UIProcess/GenericCallback.h: Removed.
* UIProcess/Inspector/WebInspectorUIExtensionControllerProxy.cpp:
* UIProcess/Inspector/mac/WKInspectorViewController.mm:
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
* UIProcess/WebContextClient.cpp:
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebFrameProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::forceRepaint):
(WebKit::WebPageProxy::callAfterNextPresentationUpdate):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
* UIProcess/WebProcessPool.h:
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::endSwipeGesture):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::~TiledCoreAnimationDrawingAreaProxy):
(WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
(WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKTextFinderClient.mm:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2021-09-21 Chris Dumez <cdumez@apple.com>
Launch the new process a bit earlier when doing a COOP process-swap
https://bugs.webkit.org/show_bug.cgi?id=230555
Reviewed by Alex Christensen.
Launch the new process a bit earlier when doing a COOP process-swap for better performance.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForResponseShared):
2021-09-21 Alex Christensen <achristensen@webkit.org>
Reduce sizeof(NetworkLoadMetrics)
https://bugs.webkit.org/show_bug.cgi?id=226982
Reviewed by Chris Dumez.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::sendResultForCacheEntry):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::additionalNetworkLoadMetricsForWebInspector):
(WebKit::NetworkDataTaskSoup::didGetHeaders):
(WebKit::NetworkDataTaskSoup::wroteHeadersCallback):
(WebKit::NetworkDataTaskSoup::wroteBodyCallback):
(WebKit::NetworkDataTaskSoup::networkEvent):
(WebKit::NetworkDataTaskSoup::didRestart):
* Shared/WebCoreArgumentCoders.h:
2021-09-21 David Kilzer <ddkilzer@apple.com>
Follow-up: WebKit::WebProcessPool should use a weak observer with CFNotificationCenter
<https://webkit.org/b/230227>
<rdar://problem/83067708>
Reviewed by Tim Horton.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
- Set m_weakObserver for all platforms at the beginning of the
method. Previously it was only set for macOS.
2021-09-21 Chris Dumez <cdumez@apple.com>
Drop makeRefPtr() and use RefPtr { } directly instead
https://bugs.webkit.org/show_bug.cgi?id=230564
Reviewed by Alex Christensen.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::addConnection):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
* Platform/IPC/Connection.cpp:
(IPC::Connection::MessagesThrottler::scheduleMessagesDispatch):
* Shared/WebHitTestResultData.cpp:
(WebKit::WebHitTestResultData::WebHitTestResultData):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::parseByteSource):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewCreateNewPage):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
(WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext):
(WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::runOpenPanel):
(WebKit::UIDelegate::UIClient::requestPointerLock):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::scheduleActivityStateUpdate):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(-[WKProcessPoolWeakObserver pool]):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::terminateUnresponsiveServiceWorkerProcesses):
* UIProcess/WebContextMenuProxy.cpp:
(WebKit::WebContextMenuProxy::useContextMenuItems):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handlePreventableTouchEvent):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::runModalJavaScriptDialog):
(WebKit::WebPageProxy::runJavaScriptAlert):
(WebKit::WebPageProxy::runJavaScriptConfirm):
(WebKit::WebPageProxy::runJavaScriptPrompt):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigation):
* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
(WebKit::WebContextMenuProxyMac::insertOrUpdateQuickLookImageItem):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
(WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
(WebKit::RemoteRenderingBackendProxy::findReusableDisplayListHandle):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(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/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::startRecording):
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::didDestroyNotification):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::declareAndWriteDragImage):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findStringMatches):
* WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCSemaphore::signal):
(WebKit::IPCTestingAPI::JSIPCSemaphore::waitFor):
(WebKit::IPCTestingAPI::JSSharedMemory::readBytes):
(WebKit::IPCTestingAPI::JSSharedMemory::writeBytes):
(WebKit::IPCTestingAPI::JSIPC::addMessageListener):
(WebKit::IPCTestingAPI::encodeRemoteRenderingBackendCreationParameters):
(WebKit::IPCTestingAPI::encodeSharedMemory):
(WebKit::IPCTestingAPI::encodeSemaphore):
(WebKit::IPCTestingAPI::encodeArgument):
(WebKit::IPCTestingAPI::JSIPC::sendMessage):
(WebKit::IPCTestingAPI::JSIPC::sendSyncMessage):
(WebKit::IPCTestingAPI::JSIPC::vmPageSize):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::addCommitHandlers):
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPage::getContentsAsString):
(WebKit::WebPage::removeDataDetectedLinks):
(WebKit::WebPage::detectDataInAllFrames):
(WebKit::WebPage::startTextManipulations):
(WebKit::WebPage::completeTextManipulation):
(WebKit::WebPage::requestTextRecognition):
(WebKit::WebPage::updateWithTextRecognitionResult):
(WebKit::WebPage::createAppHighlightInSelectedRange):
(WebKit::WebPage::setAppHighlightsVisibility):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
(WebKit::insideImageOverlay):
(WebKit::expandForImageOverlay):
(WebKit::rangeForPointInRootViewCoordinates):
(WebKit::WebPage::rootViewBounds):
(WebKit::WebPage::absoluteInteractionBounds):
(WebKit::WebPage::rootViewInteractionBounds):
(WebKit::WebPage::requestEvasionRectsAboveSelection):
(WebKit::dataDetectorImageOverlayPositionInformation):
(WebKit::selectionPositionInformation):
(WebKit::populateCaretContext):
(WebKit::WebPage::positionInformation):
(WebKit::WebPage::performActionOnElement):
(WebKit::WebPage::shrinkToFitContent):
(WebKit::WebPage::updateVisibleContentRects):
(WebKit::WebPage::updateSelectionWithDelta):
(WebKit::WebPage::requestDocumentEditingContext):
(WebKit::WebPage::animationDidFinishForElement):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::addCommitHandlers):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
2021-09-21 Megan Gardner <megan_gardner@apple.com>
Remove unused selection parameter.
https://bugs.webkit.org/show_bug.cgi?id=230519
Reviewed by Wenson Hsieh.
The direction of movement of the selection is not actually used to determine which direction to extend to a
word boundary, so do not pass it in. In preparation of being able to condense these enums into one.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::rangeAtWordBoundaryForPosition):
(WebKit::WebPage::updateSelectionWithTouches):
2021-09-21 David Kilzer <ddkilzer@apple.com>
Rename {checked,dynamic}_ns_cast<> to {checked,dynamic}_objc_cast<>
<https://webkit.org/b/230508>
<rdar://problem/83323145>
Reviewed by Brent Fulgham.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::extractWebProcessPool):
- Update for rename.
* Shared/Cocoa/ArgumentCodersCocoa.mm:
* Shared/mac/ObjCObjectGraph.mm:
* UIProcess/API/Cocoa/NSAttributedString.mm:
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
- Also fix *SoftLink.h header order.
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
* UIProcess/ios/WKContentViewInteraction.mm:
* WebProcess/cocoa/WebProcessCocoa.mm:
- Import <wtf/cocoa/TypeCastsCocoa.h> for future move of
WTF::dynamic_objc_cast<> from RetainPtr.h to that header.
2021-09-21 Michael Catanzaro <mcatanzaro@gnome.org>
REGRESSION(241918@main): [WPE][GTK] New test is timing out on bots
https://bugs.webkit.org/show_bug.cgi?id=230556
Reviewed by Alex Christensen.
Switch WebKitWebContext to use both ResourceLoaderIdentifier and WebPageProxyIdentifier as
the key for tracking outstanding tasks, since the ResourceLoaderIdentifier is not unique.
Rename WebURLSchemeTask::identifier to WebURLSchemeTask::resourceLoaderID because this is
really only one component of the ID for the WebURLSchemeTask, and cannot be used on its own
to identify the WebURLSchemeTask. It must always be paired with the WebPageProxyIdentifier.
This fixes WPE/GTK TestWebKitWebContext /webkit/WebKitWebContext/uri-scheme
* UIProcess/API/glib/WebKitWebContext.cpp:
* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::taskCompleted):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::WebURLSchemeTask):
(WebKit::WebURLSchemeTask::willPerformRedirection):
(WebKit::WebURLSchemeTask::didPerformRedirection):
(WebKit::WebURLSchemeTask::didReceiveResponse):
(WebKit::WebURLSchemeTask::didReceiveData):
(WebKit::WebURLSchemeTask::didComplete):
* UIProcess/WebURLSchemeTask.h:
(WebKit::WebURLSchemeTask::resourceLoaderID const):
(WebKit::WebURLSchemeTask::identifier const): Deleted.
2021-09-21 Per Arne <pvollan@apple.com>
Remove preference write access to AX media domain
https://bugs.webkit.org/show_bug.cgi?id=230574
<rdar://58899152>
Reviewed by Brent Fulgham.
This has been brokered to the UI process, so there should no longer be any need to write to the AX media domain in WebKit processes.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-09-21 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo] jquery/offset.html is randomly failing an assertion in DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers
https://bugs.webkit.org/show_bug.cgi?id=230531
Reviewed by Don Olmstead.
DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers shouldn't
be called while LayerTreeHost is paused by pauseRendering().
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
(WebKit::LayerTreeHost::layerFlushTimerFired):
(WebKit::LayerTreeHost::pauseRendering):
(WebKit::LayerTreeHost::resumeRendering):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h: Added m_isSuspended.
2021-09-21 Youenn Fablet <youenn@apple.com>
NetworkRTCUDPSocketCocoaConnections should handle NAT64 IP addresses correctly
https://bugs.webkit.org/show_bug.cgi?id=230552
<rdar://83297256>
Reviewed by Alex Christensen.
When opening a UDP socket, check whether it is a NAT64 IPv4 address.
In that case, we cannot bind it like we used to do with the sockets API.
Instead use "0.0.0.0".
Manually tested.
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::isNat64IPAddress):
(WebKit::computeHostAddress):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
* NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h:
* Platform/spi/Cocoa/NWSPI.h: Renamed from Source/WebKit/Platform/spi/Cocoa/NWParametersSPI.h.
* WebKit.xcodeproj/project.pbxproj:
2021-09-21 Jer Noble <jer.noble@apple.com>
[iOS] Enable MSE in WKWebViews by default on iPad
https://bugs.webkit.org/show_bug.cgi?id=230426
Reviewed by Tim Horton.
Add a default value getter for the MediaSourceEnabled preference.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultMediaSourceEnabled):
* Shared/WebPreferencesDefaultValues.h:
* Shared/ios/WebPreferencesDefaultValuesIOS.mm:
(WebKit::defaultMediaSourceEnabled):
2021-09-21 Alex Christensen <achristensen@webkit.org>
Use typed identifier for WebSocketChannel identifiers
https://bugs.webkit.org/show_bug.cgi?id=230486
Reviewed by Youenn Fablet.
* WebProcess/Network/WebSocketChannel.h:
2021-09-21 Youenn Fablet <youenn@apple.com>
Ensure that capture attribution works even for URLS without hostnames
https://bugs.webkit.org/show_bug.cgi?id=230479
<rdar://81832853>
Reviewed by Eric Carlson.
Some URLs allow to call getUserMedia but do not have origins, like custom scheme URLs.
In that case, the attribution status call was failing previously as we were not able to get a visible name to provide.
We mimick what we are doing for the default prompt by using the visible application name if the origin is not available.
Since we do the system attribution in GPUProcess, we now send the visible name to GPUProcess when creating it.
Manually tested.
We do not have system status attributon on MacOS or simulator so we cannot test it automatically.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcess.h:
(WebKit::GPUProcess::applicationVisibleName const):
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:
(WebKit::GPUConnectionToWebProcess::setCaptureAttributionString):
* UIProcess/Cocoa/GPUProcessProxyCocoa.mm:
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/Cocoa/MediaPermissionUtilities.mm:
(WebKit::applicationVisibleNameFromOrigin):
(WebKit::applicationVisibleName):
(WebKit::alertMessageText):
* UIProcess/MediaPermissionUtilities.h:
2021-09-20 Chris Dumez <cdumez@apple.com>
Avoid doing a second server pre-connect after a process-swap
https://bugs.webkit.org/show_bug.cgi?id=230517
Reviewed by Geoffrey Garen.
Avoid doing a second server pre-connect after a process-swap. It is unnecessary as we've already
asked the network process to do so before process-swapping.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
2021-09-20 Megan Gardner <megan_gardner@apple.com>
Remove unused gesture code.
https://bugs.webkit.org/show_bug.cgi?id=230515
Reviewed by Wenson Hsieh.
* Shared/ios/GestureTypes.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(toGestureType):
(toUIWKGestureType):
2021-09-20 Eric Carlson <eric.carlson@apple.com>
[Cocoa] Videos sometimes don't render when loaded in the GPU process
https://bugs.webkit.org/show_bug.cgi?id=230495
rdar://83205407
Reviewed by Jer Noble.
The media players choose what type of video output to create based on whether
or not the renderer can support accelerated rendering. We were only pushing
this state to the GPU process when the renderer changed to require backing, but
that state was lost if that transition happened before the AVFoundation-backed
media player was created. Change this to push the current state from the web process
when a remote media player is created, and again whenever its readyState changes.
We haven't figured out how to reliably reproduce this, so https://webkit.org/b/230500
tracks figuring that out and creating a test.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): Set m_renderingCanBeAccelerated
from the configuration.
(WebKit::RemoteMediaPlayerProxy::prepareToPlay): Add logging.
(WebKit::RemoteMediaPlayerProxy::prepareForRendering): Ditto.
(WebKit::RemoteMediaPlayerProxy::setPageIsVisible): Ditto.
(WebKit::RemoteMediaPlayerProxy::acceleratedRenderingStateChanged): Ditto.
(WebKit::RemoteMediaPlayerProxy::mediaPlayerReadyStateChanged): Ditto.
* GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: Add renderingCanBeAccelerated.
(WebKit::RemoteMediaPlayerProxyConfiguration::encode const):
(WebKit::RemoteMediaPlayerProxyConfiguration::decode): Decode it.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::readyStateChanged): Call acceleratedRenderingStateChanged
if the state has changed.
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged): Remember
the state.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): Pass the accelerated
rendering state with the configuration.
2021-09-20 Ross Kirsling <ross.kirsling@sony.com>
Unreviewed build fix for WinCairo with ENABLE_EXPERIMENTAL_FEATURES off.
* NetworkProcess/NetworkSession.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::createNewPage):
2021-09-20 Chris Dumez <cdumez@apple.com>
Unreviewed, rebaseline webkitpy test after r282755.
* Scripts/webkit/tests/TestWithCVPixelBufferMessageReceiver.cpp:
(WebKit::TestWithCVPixelBuffer::didReceiveMessage):
(WebKit::TestWithCVPixelBuffer::didReceiveSyncMessage):
2021-09-20 Alex Christensen <achristensen@webkit.org>
WebKit might load custom URI scheme request content multiple times
https://bugs.webkit.org/show_bug.cgi?id=229116
Reviewed by Brady Eidson.
Use a ResourceLoaderIdentifier and a WebPageProxyIdentifier as keys in WebURLSchemeHandler.
This also makes it so that we don't need a new one per page on Cocoa platforms.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::startTask):
(WebKit::WebURLSchemeHandler::processForTaskIdentifier const):
(WebKit::WebURLSchemeHandler::stopAllTasksForPage):
(WebKit::WebURLSchemeHandler::stopTask):
(WebKit::WebURLSchemeHandler::taskCompleted):
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didComplete):
2021-09-20 Michael Catanzaro <mcatanzaro@gnome.org>
Use ObjectIdentifier for WebURLSchemeHandler
https://bugs.webkit.org/show_bug.cgi?id=230462
Reviewed by Alex Christensen.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Shared/URLSchemeTaskParameters.cpp:
(WebKit::URLSchemeTaskParameters::decode):
* Shared/URLSchemeTaskParameters.h:
(): Deleted.
* Shared/WebPageCreationParameters.h:
* Shared/WebURLSchemeHandlerIdentifier.h: Copied from Source/WebKit/Shared/URLSchemeTaskParameters.h.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stopURLSchemeTask):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::WebURLSchemeHandler):
(WebKit::generateWebURLSchemeHandlerIdentifier): Deleted.
* UIProcess/WebURLSchemeHandler.h:
(WebKit::WebURLSchemeHandler::identifier const):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::registerURLSchemeHandler):
(WebKit::WebPage::urlSchemeTaskWillPerformRedirection):
(WebKit::WebPage::urlSchemeTaskDidPerformRedirection):
(WebKit::WebPage::urlSchemeTaskDidReceiveResponse):
(WebKit::WebPage::urlSchemeTaskDidReceiveData):
(WebKit::WebPage::urlSchemeTaskDidComplete):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
(WebKit::WebURLSchemeHandlerProxy::create):
(WebKit::WebURLSchemeHandlerProxy::identifier const):
(): Deleted.
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2021-09-20 Chris Dumez <cdumez@apple.com>
Stop using makeRef(*this) / makeRefPtr(this)
https://bugs.webkit.org/show_bug.cgi?id=230464
Reviewed by Alex Christensen.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::initialize):
(WebKit::RemoteGraphicsContextGL::displayWasReconfigured):
* GPUProcess/media/RemoteAudioSourceProviderProxy.cpp:
(WebKit::RemoteAudioSourceProviderProxy::createRingBuffer):
* GPUProcess/media/RemoteMediaResource.cpp:
(WebKit::RemoteMediaResource::responseReceived):
* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::removeCodedFrames):
* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::close):
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
(WebKit::RemoteSampleBufferDisplayLayerManager::close):
(WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
(WebKit::RemoteSampleBufferDisplayLayerManager::releaseLayer):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::postTask):
(WebKit::WebResourceLoadStatisticsStore::destroyResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::populateMemoryStoreFromDisk):
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccessEphemeral):
(WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::WebIDBServer):
(WebKit::WebIDBServer::getOrigins):
(WebKit::WebIDBServer::closeAndDeleteDatabasesModifiedSince):
(WebKit::WebIDBServer::closeAndDeleteDatabasesForOrigins):
(WebKit::WebIDBServer::renameOrigin):
(WebKit::WebIDBServer::addConnection):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::registerTemporaryBlobFilePaths):
(WebKit::WebIDBServer::close):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::preconnectTo):
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFilesForIndexedDB):
(WebKit::NetworkConnectionToWebProcess::takeAllMessagesForPort):
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::resume):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::findPendingDownloadLocation):
(WebKit::NetworkProcess::createWebIDBServer):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
* NetworkProcess/NetworkSocketStream.cpp:
(WebKit::NetworkSocketStream::sendData):
(WebKit::NetworkSocketStream::sendHandshake):
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::add):
(WebKit::StorageManagerSet::remove):
(WebKit::StorageManagerSet::removeConnection):
(WebKit::StorageManagerSet::handleLowMemoryWarning):
(WebKit::StorageManagerSet::suspend):
(WebKit::StorageManagerSet::getSessionStorageOrigins):
(WebKit::StorageManagerSet::deleteSessionStorage):
(WebKit::StorageManagerSet::deleteSessionStorageForOrigins):
(WebKit::StorageManagerSet::getLocalStorageOrigins):
(WebKit::StorageManagerSet::deleteLocalStorageModifiedSince):
(WebKit::StorageManagerSet::deleteLocalStorageForOrigins):
(WebKit::StorageManagerSet::getLocalStorageOriginDetails):
(WebKit::StorageManagerSet::renameOrigin):
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::readCache):
(WebKit::CacheStorage::Engine::fetchDirectoryEntries):
(WebKit::CacheStorage::CompletionHandler<void):
(WebKit::CacheStorage::Engine::clearCachesForOriginFromDirectories):
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::storeOrigin):
(WebKit::CacheStorage::Caches::initializeSize):
(WebKit::CacheStorage::Caches::clear):
(WebKit::CacheStorage::Caches::readCachesFromDisk):
(WebKit::CacheStorage::Caches::writeCachesToDisk):
(WebKit::CacheStorage::Caches::writeRecord):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
(WebKit::NetworkCache::Cache::store):
(WebKit::NetworkCache::Cache::traverse):
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read):
(WebKit::NetworkCache::IOChannel::write):
* NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp:
(WebKit::NetworkCache::IOChannel::readSyncInThread):
* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::synchronize):
(WebKit::NetworkCache::Storage::remove):
(WebKit::NetworkCache::Storage::finishReadOperation):
(WebKit::NetworkCache::Storage::finishWriteOperation):
(WebKit::NetworkCache::Storage::traverse):
(WebKit::NetworkCache::Storage::clear):
(WebKit::NetworkCache::Storage::shrink):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::resume):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::clearDiskCache):
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::curlDidSendData):
(WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
(WebKit::NetworkDataTaskCurl::curlDidReceiveBuffer):
(WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
(WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
(WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse):
(WebKit::NetworkDataTaskSoup::authenticate):
(WebKit::NetworkDataTaskSoup::continueAuthenticate):
(WebKit::NetworkDataTaskSoup::continueHTTPRedirection):
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createServerTCPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
(WebKit::NetworkRTCProvider::createResolver):
(WebKit::NetworkRTCProvider::stopResolver):
(WebKit::NetworkRTCProvider::closeListeningSockets):
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp:
(WebKit::RTCDataChannelRemoteManagerProxy::registerConnectionToWebProcess):
(WebKit::RTCDataChannelRemoteManagerProxy::unregisterConnectionToWebProcess):
* Platform/IPC/Connection.cpp:
(IPC::Connection::invalidate):
(IPC::Connection::sendMessage):
(IPC::Connection::waitForMessage):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::postConnectionDidCloseOnConnectionWorkQueue):
(IPC::Connection::connectionDidClose):
(IPC::Connection::dispatchDidReceiveInvalidMessage):
(IPC::Connection::enqueueIncomingMessage):
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::open):
(IPC::Connection::initializeSendSource):
* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::sendOutputMessage):
* Platform/IPC/win/ConnectionWin.cpp:
(IPC::Connection::invokeReadEventHandler):
(IPC::Connection::invokeWriteEventHandler):
* 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/TestWithSuperclassMessageReceiver.cpp:
(WebKit::TestWithSuperclass::didReceiveMessage):
(WebKit::TestWithSuperclass::didReceiveSyncMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::invalidate):
(WebKit::ThreadedCompositor::suspend):
(WebKit::ThreadedCompositor::resume):
(WebKit::ThreadedCompositor::forceRepaint):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::startOnMainThread):
(WebKit::MediaFormatReader::parseByteSource):
* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::lookupContentRuleList):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::compileContentRuleList):
(API::ContentRuleListStore::removeContentRuleList):
(API::ContentRuleListStore::getContentRuleListSource):
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::cookiesForURL):
(API::HTTPCookieStore::setCookies):
* UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::checkIconURLAndSetPageURLIfNeeded):
(WebKit::IconDatabase::loadIconForPageURL):
(WebKit::IconDatabase::setIconForPageURL):
(WebKit::IconDatabase::clear):
* UIProcess/Automation/SimulatedInputDispatcher.cpp:
(WebKit::SimulatedInputDispatcher::transitionToNextKeyFrame):
(WebKit::SimulatedInputDispatcher::transitionToNextInputSourceState):
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::getBrowsingContexts):
(WebKit::WebAutomationSession::getBrowsingContext):
(WebKit::WebAutomationSession::createBrowsingContext):
(WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
(WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext):
(WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
(WebKit::WebAutomationSession::exitFullscreenWindowForPage):
(WebKit::WebAutomationSession::willShowJavaScriptDialog):
(WebKit::WebAutomationSession::resolveChildFrameHandle):
(WebKit::WebAutomationSession::resolveParentFrameHandle):
(WebKit::WebAutomationSession::simulateMouseInteraction):
(WebKit::WebAutomationSession::simulateTouchInteraction):
(WebKit::WebAutomationSession::simulateWheelInteraction):
(WebKit::WebAutomationSession::performMouseInteraction):
(WebKit::WebAutomationSession::performKeyboardInteractions):
(WebKit::WebAutomationSession::performInteractionSequence):
(WebKit::WebAutomationSession::cancelInteractionSequence):
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
* UIProcess/Cocoa/SOAuthorization/SOAuthorizationSession.mm:
(WebKit::SOAuthorizationSession::dismissViewController):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::DeviceIdHashSaltStorage):
(WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk):
(WebKit::DeviceIdHashSaltStorage::storeHashSaltToDisk):
(WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDisk):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::cancel):
(WebKit::DownloadProxy::willSendRequest):
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::gpuProcessExited):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::join):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSeekTo):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePlay):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinatePause):
(WebKit::RemoteMediaSessionCoordinatorProxy::coordinateSetTrack):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::networkProcessDidTerminate):
* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::prompt):
* UIProcess/WebContextMenuProxy.cpp:
(WebKit::WebContextMenuProxy::useContextMenuItems):
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::forceRepaint):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
(WebKit::WebPageProxy::willSubmitForm):
(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::getWindowFrame):
(WebKit::WebPageProxy::getWindowFrameWithCallback):
(WebKit::WebPageProxy::printFrame):
(WebKit::WebPageProxy::didChooseFilesForOpenPanelWithImageTranscoding):
(WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
(WebKit::WebPageProxy::requestStorageSpace):
(WebKit::WebPageProxy::getLoadDecisionForIcon):
(WebKit::WebPageProxy::dispatchActivityStateUpdateForTesting):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::terminateServiceWorkers):
(WebKit::WebProcessPool::processForNavigationInternal):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::didBecomeUnresponsive):
(WebKit::WebProcessProxy::didFinishLaunching):
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
(WebKit::WebProcessProxy::requestTermination):
(WebKit::WebProcessProxy::didExceedCPULimit):
* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::willPerformRedirection):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::ensureAppBoundDomains const):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::acquireAsync):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::getShareMenuItem):
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
(WebKit::WebContextMenuProxyMac::useContextMenuItems):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::windowAndViewFramesChanged):
(WebKit::WebPageProxy::pdfSaveToPDF):
(WebKit::WebPageProxy::pdfOpenWithPreview):
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::didClose):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::startRendering):
(WebKit::RemoteAudioDestinationProxy::stopRendering):
* WebProcess/GPU/media/RemoteAudioSourceProviderManager.cpp:
(WebKit::RemoteAudioSourceProviderManager::addProvider):
(WebKit::RemoteAudioSourceProviderManager::removeProvider):
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::removeCodedFrames):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didFinishResourceLoad):
(WebKit::WebResourceLoader::didFailResourceLoad):
* WebProcess/Network/WebSocketChannel.cpp:
(WebKit::WebSocketChannel::sendMessage):
(WebKit::WebSocketChannel::close):
(WebKit::WebSocketChannel::fail):
(WebKit::WebSocketChannel::didClose):
(WebKit::WebSocketChannel::resume):
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::pluginThreadAsyncCall):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
(WebKit::PDFPlugin::pdfLog):
(WebKit::PDFPlugin::receivedNonLinearizedPDFSentinel):
(WebKit::PDFPlugin::getResourceBytesAtPosition):
(WebKit::PDFPlugin::tryRunScriptsInPDFDocument):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::Stream::start):
* WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):
(WebKit::EventDispatcher::gestureEvent):
(WebKit::EventDispatcher::touchEvent):
(WebKit::EventDispatcher::dispatchWheelEventViaMainThread):
* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::suspendForProcessSwap):
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPage::drawPagesForPrinting):
(WebKit::WebPage::elementDidBlur):
(WebKit::WebPage::requestStorageAccess):
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
(WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
(WebKit::WebURLSchemeTaskProxy::didReceiveData):
(WebKit::WebURLSchemeTaskProxy::didComplete):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::didFinishContentChangeObserving):
(WebKit::WebPage::didFinishLoadingImageForElement):
(WebKit::WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded):
* WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::addSource):
(WebKit::RemoteCaptureSampleManager::removeSource):
* WebProcess/cocoa/RemoteRealtimeAudioSource.cpp:
(WebKit::RemoteRealtimeAudioSource::createRemoteMediaSource):
* WebProcess/cocoa/RemoteRealtimeVideoSource.cpp:
(WebKit::RemoteRealtimeVideoSource::createRemoteMediaSource):
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::exitVideoFullscreenForVideoElement):
(WebKit::VideoFullscreenManager::requestVideoContentLayer):
(WebKit::VideoFullscreenManager::returnVideoContentLayer):
(WebKit::VideoFullscreenManager::didSetupFullscreen):
(WebKit::VideoFullscreenManager::willExitFullscreen):
(WebKit::VideoFullscreenManager::didEnterFullscreen):
(WebKit::VideoFullscreenManager::didExitFullscreen):
(WebKit::VideoFullscreenManager::didCleanupFullscreen):
2021-09-20 Chris Dumez <cdumez@apple.com>
Fix race in RemoteRenderingBackend::allowsExitUnderMemoryPressure()
https://bugs.webkit.org/show_bug.cgi?id=229870
<rdar://82459484>
Reviewed by Simon Fraser.
RemoteRenderingBackend::allowsExitUnderMemoryPressure() gets called on the main thread while
RemoteResourceCache is always modified on a work queue. Introduce a std::atomic<bool> on
the RemoteResourceCache that RemoteRenderingBackend::allowsExitUnderMemoryPressure() can
safely query from the main thread.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::updateRenderingResourceRequest):
(WebKit::RemoteRenderingBackend::allowsExitUnderMemoryPressure const):
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::RemoteResourceCache):
(WebKit::RemoteResourceCache::cacheImageBuffer):
(WebKit::RemoteResourceCache::cacheNativeImage):
(WebKit::RemoteResourceCache::maybeRemoveResource):
(WebKit::RemoteResourceCache::updateHasActiveDrawables):
* GPUProcess/graphics/RemoteResourceCache.h:
(WebKit::RemoteResourceCache::hasActiveDrawables const):
2021-09-19 Wenson Hsieh <wenson_hsieh@apple.com>
Teach `WebKit::createShareableBitmap` to snapshot video elements
https://bugs.webkit.org/show_bug.cgi?id=230468
Reviewed by Tim Horton.
`createShareableBitmap` currently only returns a non-null image bitmap for image renderers that have cached
images; notably, this omits video elements. For use in future patches, we should allow this helper function to
handle video elements by snapshotting the current frame of the video.
* WebProcess/WebCoreSupport/ShareableBitmapUtilities.cpp:
(WebKit::createShareableBitmap):
2021-09-17 Alex Christensen <achristensen@webkit.org>
Use ObjectIdentifier for ResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=230278
Reviewed by Michael Catanzaro.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
(WebKit::NetworkConnectionToWebProcess::resolveBlobReferences):
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
(WebKit::NetworkConnectionToWebProcess::loadPing):
(WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
(WebKit::NetworkConnectionToWebProcess::preconnectTo):
(WebKit::NetworkConnectionToWebProcess::isResourceLoadFinished):
(WebKit::NetworkConnectionToWebProcess::didFinishPreconnection):
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
(WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
(WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
(WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
(WebKit::NetworkConnectionToWebProcess::prioritizeResourceLoads):
(WebKit::NetworkConnectionToWebProcess::takeNetworkResourceLoader):
* NetworkProcess/NetworkConnectionToWebProcess.h:
(WebKit::NetworkConnectionToWebProcess::getNetworkLoadInformationResponse):
(WebKit::NetworkConnectionToWebProcess::getNetworkLoadIntermediateInformation):
(WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
(WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformation):
(WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
(WebKit::NetworkConnectionToWebProcess::removeNetworkLoadInformation):
(WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::prepareLoadForWebProcessTransfer):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoadMap.cpp:
(WebKit::NetworkResourceLoadMap::add):
(WebKit::NetworkResourceLoadMap::remove):
(WebKit::NetworkResourceLoadMap::take):
(WebKit::NetworkResourceLoadMap::get const):
* NetworkProcess/NetworkResourceLoadMap.h:
(WebKit::NetworkResourceLoadMap::contains const):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::transferToNewWebProcess):
(WebKit::escapeIDForJSON):
(WebKit::logBlockedCookieInformation):
(WebKit::logCookieInformationInternal):
(WebKit::NetworkResourceLoader::logCookieInformation):
* NetworkProcess/NetworkResourceLoader.h:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* Shared/URLSchemeTaskParameters.cpp:
(WebKit::URLSchemeTaskParameters::decode):
* Shared/URLSchemeTaskParameters.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::prepareLoadForWebProcessTransfer):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
(WebKit::WebPageProxy::stopURLSchemeTask):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::startTask):
(WebKit::WebURLSchemeHandler::processForTaskIdentifier const):
(WebKit::WebURLSchemeHandler::stopAllTasksForPage):
(WebKit::WebURLSchemeHandler::stopTask):
(WebKit::WebURLSchemeHandler::removeTaskFromPageMap):
* UIProcess/WebURLSchemeHandler.h:
* UIProcess/WebURLSchemeTask.h:
(WebKit::WebURLSchemeTask::identifier const):
* WebProcess/InjectedBundle/API/APIInjectedBundlePageResourceLoadClient.h:
(API::InjectedBundle::ResourceLoadClient::didInitiateLoadForResource):
(API::InjectedBundle::ResourceLoadClient::willSendRequestForFrame):
(API::InjectedBundle::ResourceLoadClient::didReceiveResponseForResource):
(API::InjectedBundle::ResourceLoadClient::didReceiveContentLengthForResource):
(API::InjectedBundle::ResourceLoadClient::didFinishLoadForResource):
(API::InjectedBundle::ResourceLoadClient::didFailLoadForResource):
(API::InjectedBundle::ResourceLoadClient::shouldCacheResponse):
(API::InjectedBundle::ResourceLoadClient::shouldUseCredentialStorage):
* WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
(WebKit::InjectedBundlePageResourceLoadClient::didInitiateLoadForResource):
(WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
(WebKit::InjectedBundlePageResourceLoadClient::didReceiveResponseForResource):
(WebKit::InjectedBundlePageResourceLoadClient::didReceiveContentLengthForResource):
(WebKit::InjectedBundlePageResourceLoadClient::didFinishLoadForResource):
(WebKit::InjectedBundlePageResourceLoadClient::didFailLoadForResource):
(WebKit::InjectedBundlePageResourceLoadClient::shouldCacheResponse):
(WebKit::InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage):
* WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didReceiveMessage):
(WebKit::NetworkProcessConnection::didFinishPingLoad):
(WebKit::NetworkProcessConnection::didFinishPreconnection):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Network/NetworkProcessConnection.messages.in:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
(WebKit::WebLoaderStrategy::remove):
(WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
(WebKit::WebLoaderStrategy::startPingLoad):
(WebKit::WebLoaderStrategy::didFinishPingLoad):
(WebKit::WebLoaderStrategy::preconnectTo):
(WebKit::WebLoaderStrategy::didFinishPreconnection):
(WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
(WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
(WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
(WebKit::WebLoaderStrategy::prioritizeResourceLoads):
(WebKit::WebLoaderStrategy::generateLoadIdentifier): Deleted.
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/Network/WebResourceInterceptController.cpp:
(WebKit::WebResourceInterceptController::isIntercepting const):
(WebKit::WebResourceInterceptController::beginInterceptingResponse):
(WebKit::WebResourceInterceptController::continueResponse):
(WebKit::WebResourceInterceptController::interceptedResponse):
(WebKit::WebResourceInterceptController::defer):
* WebProcess/Network/WebResourceInterceptController.h:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::messageSenderDestinationID const):
(WebKit::WebResourceLoader::didReceiveResponse):
* WebProcess/Network/WebResourceLoader.h:
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::assignIdentifierToInitialRequest):
(WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
(WebKit::WebFrameLoaderClient::shouldUseCredentialStorage):
(WebKit::WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
(WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
(WebKit::WebFrameLoaderClient::dispatchDidReceiveResponse):
(WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
(WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
(WebKit::WebFrameLoaderClient::dispatchDidFailLoading):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
(WebKit::WebFrameLoaderClient::willCacheResponse const):
(WebKit::WebFrameLoaderClient::sendH2Ping):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::convertMainResourceLoadToDownload):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addConsoleMessage):
(WebKit::WebPage::addResourceRequest):
(WebKit::WebPage::removeResourceRequest):
(WebKit::WebPage::urlSchemeTaskWillPerformRedirection):
(WebKit::WebPage::urlSchemeTaskDidPerformRedirection):
(WebKit::WebPage::urlSchemeTaskDidReceiveResponse):
(WebKit::WebPage::urlSchemeTaskDidReceiveData):
(WebKit::WebPage::urlSchemeTaskDidComplete):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::addConsoleMessage):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
(WebKit::WebURLSchemeHandlerProxy::taskDidPerformRedirection):
(WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse):
(WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData):
(WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
(WebKit::WebURLSchemeHandlerProxy::removeTask):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
* WebProcess/WebPage/WebURLSchemeTaskProxy.h:
(WebKit::WebURLSchemeTaskProxy::identifier const):
2021-09-17 Kate Cheney <katherine_cheney@apple.com>
Remove unnecessary ITP memory store code
https://bugs.webkit.org/show_bug.cgi?id=229512
<rdar://problem/82644309>
Reviewed by John Wilander.
No new tests. Confirmed by existing tests.
Remove ITP Memory store. This is the first part of a two part operation,
which removes the ResourceLoadStatisticsMemoryStore class. The next
step will be reducing ResourceLoadStatisticsStore and
ResourceLoadStatisticsDatabaseStore to one single ResourceLoadStatisticsStore class.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::populateFromMemoryStore): Deleted.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: Removed.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-09-17 Chris Dumez <cdumez@apple.com>
Unreviewed build fix.
* Shared/Cocoa/AuxiliaryProcessCocoa.mm:
2021-09-17 Cameron McCormack <heycam@apple.com>
Preserve color space when creating ImageBuffers for ImageBitmaps
https://bugs.webkit.org/show_bug.cgi?id=229022
<rdar://problem/81828459>
Reviewed by Sam Weinig.
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::validateConfiguration): Factor out some
loging into DestinationColorSpace::asRGB.
2021-09-17 Chris Dumez <cdumez@apple.com>
Unreviewed, reverting r282011.
This causes GPUProcess main thread hangs on memory pressure
Reverted changeset:
"Fix race in
RemoteRenderingBackend::allowsExitUnderMemoryPressure()"
https://bugs.webkit.org/show_bug.cgi?id=229870
https://commits.webkit.org/r282011
2021-09-17 Per Arne Vollan <pvollan@apple.com>
[GPUP] Update AX settings on preference updates
https://bugs.webkit.org/show_bug.cgi?id=230409
Reviewed by Chris Fleizach.
We should update AX settings in the GPUP process on preference updates, like we do in the WebContent process. To address this,
move associated code from the WebProcess class to the AuxiliaryProcess class.
* GPUProcess/GPUProcess.h:
* GPUProcess/cocoa/GPUProcessCocoa.mm:
(WebKit::GPUProcess::notifyPreferencesChanged):
(WebKit::GPUProcess::dispatchSimulatedNotificationsForPreferenceChange):
* Shared/AuxiliaryProcess.h:
(WebKit::AuxiliaryProcess::dispatchSimulatedNotificationsForPreferenceChange):
* Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::AuxiliaryProcess::preferenceDidUpdate):
(WebKit::AuxiliaryProcess::handlePreferenceChange):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::dispatchSimulatedNotificationsForPreferenceChange):
(WebKit::WebProcess::handlePreferenceChange):
(WebKit::WebProcess::notifyPreferencesChanged):
(WebKit::dispatchSimulatedNotificationsForPreferenceChange): Deleted.
(WebKit::handlePreferenceChange): Deleted.
2021-09-17 Chris Dumez <cdumez@apple.com>
Crash under RemoteMediaPlayerManager::getSupportedTypes()
https://bugs.webkit.org/show_bug.cgi?id=230410
Reviewed by Eric Carlson.
The code would do a null dereference of m_supportedTypesCache if the IPC to the GPUProcess
failed, which could happen in the event of the GPUProcess crash or jetsam.
* WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp:
(WebKit::RemoteMediaPlayerMIMETypeCache::addSupportedTypes):
(WebKit::RemoteMediaPlayerMIMETypeCache::isEmpty const):
(WebKit::RemoteMediaPlayerMIMETypeCache::supportedTypes):
* WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h:
2021-09-17 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][a11y] Add a build option to enable ATSPI
https://bugs.webkit.org/show_bug.cgi?id=230254
Reviewed by Adrian Perez de Castro.
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize): Add ATK ifdef.
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMain): Disable ATK/GTK accessibility support in the WebProcess when using ATSPI.
2021-09-17 Tim Horton <timothy_horton@apple.com>
Replaying WKCGCommandsContext results in a doubly-scaled backing store
https://bugs.webkit.org/show_bug.cgi?id=230386
Reviewed by Wenson Hsieh.
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::create):
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display):
WKCGCommandsContextCreate() expects the bounds in logical coordinates, so
we don't need to use calculateBackendSize().
This also means that the workaround no longer needs to work around the
missing scale; only the flip is missing.
2021-09-16 Youenn Fablet <youenn@apple.com>
Make WebProcess use a RefPtr of LibWebRTCNetwork
https://bugs.webkit.org/show_bug.cgi?id=230342
Reviewed by Eric Carlson.
No change of behavior, ref counted object should use RefPtr<>, not unique_ptr.
* WebProcess/Network/webrtc/LibWebRTCNetwork.h:
(WebKit::LibWebRTCNetwork::create):
* WebProcess/Network/webrtc/WebRTCMonitor.cpp:
(WebKit::WebRTCMonitor::networksChanged):
(WebKit::WebRTCMonitor::sendOnMainThread): Deleted.
* WebProcess/Network/webrtc/WebRTCMonitor.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::libWebRTCNetwork):
* WebProcess/WebProcess.h:
2021-09-16 David Kilzer <ddkilzer@apple.com>
WebKit::WebProcessPool should use a weak observer with CFNotificationCenter
<https://webkit.org/b/230227>
<rdar://problem/83067708>
Reviewed by Darin Adler.
To fix the bug, implement an Objective-C class named
WKProcessPoolWeakObserver which contains an instance variable
holding a WeakPtr<WebProcessPool>, and tell CFNotificationCenter
to hold a weak reference to WKProcessPoolWeakObserver.
Since WKProcessPoolWeakObserver is self-contained within the
source file, it uses the NS_DIRECT_MEMBERS attribute since it
does not require the overhead of dynamic Objective-C method
dispatch.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(-[WKProcessPoolWeakObserver initWithWeakPtr:]): Add.
(-[WKProcessPoolWeakObserver pool]): Add.
- Implement WKProcessPoolWeakObserver class.
- Note that init methods can never be marked as NS_DIRECT, and
@property statements can't use NS_DIRECT in their declaration,
so the @property is declared in a category which uses
NS_DIRECT_MEMBERS.
(WebKit::extractWebProcessPool): Add.
- Static helper method for extracting RefPtr<WebProcessPool>
from type-punned WKProcessPoolWeakObserver.
(WebKit::WebProcessPool::backlightLevelDidChangeCallback):
(WebKit::WebProcessPool::accessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::mediaAccessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::colorPreferencesDidChangeCallback):
(WebKit::WebProcessPool::remoteWebInspectorEnabledCallback):
- Clean up function parameter list.
- Use extractWebProcessPool() helper method to get a
RefPtr<WebProcessPool> from `observer`.
(WebKit::WebProcessPool::addCFNotificationObserver): Add.
(WebKit::WebProcessPool::removeCFNotificationObserver): Add.
- Private helper methods to reduce duplicate code.
- Use m_weakObserver for CFNotificationCenter observer and
include _CFNotificationObserverIsObjC to fix the bug.
(WebKit::WebProcessPool::registerNotificationObservers):
- Make use of new addCFNotificationObserver() helper method.
- Fixes use of static_cast<CFStringRef> to make code ready for
ARC by using a __bridge cast or removing the static_cast when
CFSTR() is used.
(WebKit::WebProcessPool::unregisterNotificationObservers):
- Make use of new removeCFNotificationObserver() helper method.
* UIProcess/WebProcessPool.h:
- Add m_weakObserver instance variable to hold the
WKProcessPoolWeakObserver object.
(WebKit::WebProcessPool::addCFNotificationObserver): Add.
(WebKit::WebProcessPool::removeCFNotificationObserver): Add.
- Add declarations for new helper methods.
(WebKit::WebProcessPool::backlightLevelDidChangeCallback):
(WebKit::WebProcessPool::accessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::mediaAccessibilityPreferencesChangedCallback):
(WebKit::WebProcessPool::colorPreferencesDidChangeCallback):
(WebKit::WebProcessPool::remoteWebInspectorEnabledCallback):
- Clean up function parameter list.
2021-09-16 Cameron McCormack <heycam@apple.com>
Support patterns with a wide gamut source painting into a display-p3 canvas
https://bugs.webkit.org/show_bug.cgi?id=229023
<rdar://problem/81828466>
Reviewed by Sam Weinig.
Patterns are sent to the GPU process using ShareableBitmaps created
from ImageBuffers. Ensure we pass along the pattern source color space
to ShareableBitmap::create.
Tests: imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html
imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBuffer):
2021-09-16 Cameron McCormack <heycam@apple.com>
Support drawImage with a wide gamut image painting into a display-p3 canvas
https://bugs.webkit.org/show_bug.cgi?id=229021
<rdar://problem/81828450>
Reviewed by Sam Weinig.
ShareableBitmap is used to share image data used by drawImage() calls,
from the Web process to the GPU process. This change makes
ShareableBitmap create a CGBitmap with a color space matching the
source NativeImage, if that is an RGB-based color space, or extended
sRGB otherwise. This allows us to pass Adobe RGB, Display P3, etc.
images to the GPU process without needing to convert color space,
while still allowing for example CMYK JPEGs to be drawn correctly.
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::create):
(WebKit::ShareableBitmap::createShareable):
* Shared/ShareableBitmap.h:
* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::validateConfiguration):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::validateConfiguration): Map the requested
color space into one appropriate for the CGBitmap.
(WebKit::colorSpace):
* Shared/win/ShareableBitmapDirect2D.cpp:
(WebKit::ShareableBitmap::validateConfiguration):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::createShareableBitmapFromNativeImage): Pass in the color
space of the NativeImage.
2021-09-16 Chris Dumez <cdumez@apple.com>
Stringify process termination reason in dispatchProcessDidTerminate logging
https://bugs.webkit.org/show_bug.cgi?id=230361
Reviewed by Geoffrey Garen.
* UIProcess/WebPageProxy.cpp:
(WebKit::processTerminationReasonToString):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):
2021-09-16 Chris Dumez <cdumez@apple.com>
Add violations reporting support for Cross-Origin-Embedder-Policy
https://bugs.webkit.org/show_bug.cgi?id=230269
Reviewed by Youenn Fablet.
Add support for COEP inheritance violation reporting:
- https://html.spec.whatwg.org/multipage/origin.html#check-a-navigation-response's-adherence-to-its-embedder-policy
- https://html.spec.whatwg.org/multipage/origin.html#check-a-global-object's-embedder-policy
- https://html.spec.whatwg.org/multipage/origin.html#queue-a-cross-origin-embedder-policy-inheritance-violation
Add support for COEP CORP violation reporting:
- https://fetch.spec.whatwg.org/#cross-origin-resource-policy-check
- https://fetch.spec.whatwg.org/#queue-a-cross-origin-embedder-policy-corp-violation-report
Add support for Fetch destination="iframe" because the COEP test relied on it:
- https://fetch.spec.whatwg.org/#concept-request-destination
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::performCORPCheck):
(WebKit::NetworkLoadChecker::validateResponse):
(WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::resourceLoadInfo):
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
* NetworkProcess/NetworkResourceLoader.h:
* Scripts/webkit/messages.py:
(headers_for_type):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendCOEPPolicyInheritenceViolation):
(WebKit::WebPage::sendCOEPCORPViolation):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-09-16 Tim Horton <timothy_horton@apple.com>
Adjust ARKIT_INLINE_PREVIEW* compile time flags
https://bugs.webkit.org/show_bug.cgi?id=230332
Reviewed by Sam Weinig.
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* UIProcess/Cocoa/ModelElementControllerCocoa.mm:
* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
* UIProcess/ModelElementController.cpp:
* UIProcess/ModelElementController.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didAttachToRunningProcess):
(WebKit::WebPageProxy::resetState):
* 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:
* UIProcess/ios/WKModelInteractionGestureRecognizer.h:
* UIProcess/ios/WKModelInteractionGestureRecognizer.mm:
* UIProcess/ios/WKModelView.h:
* UIProcess/ios/WKModelView.mm:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setWebsiteDataStoreParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetWebsiteDataStoreParameters):
Adopt the new name.
2021-09-16 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] test animations/steps-transform-rendering-updates.html fails
https://bugs.webkit.org/show_bug.cgi?id=230307
Reviewed by Carlos Alberto Lopez Perez.
ThreadedDisplayRefreshMonitor is not setting isScheduled back to false when it's fired. That causes
hasBeenRescheduled to be true and handleDisplayRefreshMonitorUpdate() is called with force repaint option, so we
end up flushing layers on every display refresh update.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
2021-09-15 Chris Dumez <cdumez@apple.com>
Implement network process crash recovery for BroadcastChannel
https://bugs.webkit.org/show_bug.cgi?id=230236
Reviewed by Alex Christensen.
Have the WebBroadcastChannelRegistry register its BroadcastChannels with the network
process after a network process crash. This is useful so that cross-WebProcess
communication can keep happening via existing BroadcastChannel after a network process
crash.
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp:
(WebKit::WebBroadcastChannelRegistry::networkProcessCrashed):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::networkProcessConnectionClosed):
2021-09-15 Devin Rousso <drousso@apple.com>
[Payment Request] Clean up some WKA hooks
https://bugs.webkit.org/show_bug.cgi?id=230182
<rdar://problem/78824639>
Reviewed by Tim Horton.
* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::merge):
(WebKit::PaymentAuthorizationPresenter::completePaymentMethodSelection):
(WebKit::PaymentAuthorizationPresenter::completeShippingContactSelection):
(WebKit::PaymentAuthorizationPresenter::completeShippingMethodSelection):
(WebKit::PaymentAuthorizationPresenter::completeCouponCodeChange):
* Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::merge):
(WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest):
Instead of using `#define`, create actual functions so that the code in WKA is cleaner.
2021-09-15 Michael Catanzaro <mcatanzaro@gnome.org>
[WPE][GTK] Silence -Wswitch warning enumeration value ‘ExceededProcessCountLimit’ not handled in switch
https://bugs.webkit.org/show_bug.cgi?id=230280
Reviewed by Darin Adler.
* UIProcess/API/glib/WebKitNavigationClient.cpp:
2021-09-15 Tim Horton <timothy_horton@apple.com>
Remove the "Replace WebKitAdditions in Framework Headers" build phase
https://bugs.webkit.org/show_bug.cgi?id=230300
Reviewed by Wenson Hsieh.
* WebKit.xcodeproj/project.pbxproj:
* mac/replace-webkit-additions-includes.py: Removed.
As Wenson pointed out in bug 230198, this build phase is currently unused.
It's also wasting a quarter of the WebKit-only null build time, so let's
just remove it and hope we never need it again (but if we do, it's in the history!).
This gets us down to 11 seconds on the same benchmark mentioned in r282367.
2021-09-14 Don Olmstead <don.olmstead@sony.com>
Non-unified build fixes, mid September 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=230110
Unreviewed non-unified build fixes.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PCM::NetworkLoader::start):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h:
* NetworkProcess/storage/OriginStorageManager.h:
2021-09-14 John Wilander <wilander@apple.com>
Rename RESOURCE_LOAD_STATISTICS to INTELLIGENT_TRACKING_PREVENTION
https://bugs.webkit.org/show_bug.cgi?id=230279
<rdar://problem/83118683>
Reviewed by Darin Adler.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::updateClientSideCookiesAgeCap):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
(WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
(WebKit::NetworkConnectionToWebProcess::clearPageSpecificData):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::restrictRequestReferrerToOriginIfNeeded):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::retrieveCacheEntryInternal):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
(WebKit::NetworkResourceLoader::sendResultForCacheEntry):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::~NetworkSession):
(WebKit::NetworkSession::invalidateAndCancel):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::storeRedirect):
* NetworkProcess/cache/NetworkCacheEntry.cpp:
* NetworkProcess/cache/NetworkCacheEntry.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
* 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:task:_schemeUpgraded:completionHandler:]):
(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
(WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
(WebKit::NetworkDataTaskCurl::blockCookies):
(WebKit::NetworkDataTaskCurl::unblockCookies):
(WebKit::NetworkDataTaskCurl::shouldBlockCookies):
* NetworkProcess/curl/NetworkSessionCurl.cpp:
(WebKit::NetworkSessionCurl::NetworkSessionCurl):
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::createRequest):
* Shared/ResourceLoadStatisticsParameters.h:
(WebKit::ResourceLoadStatisticsParameters::encode const):
(WebKit::ResourceLoadStatisticsParameters::decode):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/WebProcessDataStoreParameters.h:
(WebKit::WebProcessDataStoreParameters::encode const):
(WebKit::WebProcessDataStoreParameters::decode):
* Shared/WebsiteData/WebsiteData.cpp:
(WebKit::WebsiteData::encode const):
(WebKit::WebsiteData::decode):
(WebKit::WebsiteData::isolatedCopy const):
* Shared/WebsiteData/WebsiteData.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageLoadedSubresourceDomains):
(WKPageClearLoadedSubresourceDomains):
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreRemoveITPDataForDomain):
(WKWebsiteDataStoreDoesStatisticsDomainIDExistInDatabase):
(WKWebsiteDataStoreSetResourceLoadStatisticsEnabled):
(WKWebsiteDataStoreIsStatisticsEphemeral):
(WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
(WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
(WKWebsiteDataStoreSetStatisticsLastSeen):
(WKWebsiteDataStoreSetStatisticsMergeStatistic):
(WKWebsiteDataStoreSetStatisticsExpiredStatistic):
(WKWebsiteDataStoreSetStatisticsPrevalentResource):
(WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
(WKWebsiteDataStoreDumpResourceLoadStatistics):
(WKWebsiteDataStoreIsStatisticsPrevalentResource):
(WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
(WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
(WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
(WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
(WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
(WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
(WKWebsiteDataStoreIsStatisticsOnlyInDatabaseOnce):
(WKWebsiteDataStoreSetStatisticsGrandfathered):
(WKWebsiteDataStoreIsStatisticsGrandfathered):
(WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
(WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
(WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
(WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
(WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
(WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
(WKWebsiteDataStoreSetStatisticsCrossSiteLoadWithLinkDecoration):
(WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
(WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
(WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
(WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
(WKWebsiteDataStoreSetStatisticsIsRunningTest):
(WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
(WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
(WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
(WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
(WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
(WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
(WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
(WKWebsiteDataStoreStatisticsDeleteCookiesForTesting):
(WKWebsiteDataStoreStatisticsHasLocalStorage):
(WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
(WKWebsiteDataStoreStatisticsHasIsolatedSession):
(WKWebsiteDataStoreSetResourceLoadStatisticsShouldDowngradeReferrerForTesting):
(WKWebsiteDataStoreSetResourceLoadStatisticsShouldBlockThirdPartyCookiesForTesting):
(WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyWebsiteDataRemovalModeForTesting):
(WKWebsiteDataStoreSetResourceLoadStatisticsToSameSiteStrictCookiesForTesting):
(WKWebsiteDataStoreSetResourceLoadStatisticsFirstPartyHostCNAMEDomainForTesting):
(WKWebsiteDataStoreSetResourceLoadStatisticsThirdPartyCNAMEDomainForTesting):
(WKWebsiteDataStoreStatisticsResetToConsistentState):
(WKWebsiteDataStoreGetAllStorageAccessEntries):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _seedResourceLoadStatisticsForTestingWithFirstParty:thirdParty:shouldScheduleNotification:completionHandler:]):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsDebugMode]):
(-[WKWebsiteDataStore _setResourceLoadStatisticsDebugMode:]):
(-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
(-[WKWebsiteDataStore _loadedSubresourceDomainsFor:completionHandler:]):
(-[WKWebsiteDataStore _clearLoadedSubresourceDomainsFor:]):
(-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
(-[WKWebsiteDataStore _scheduleCookieBlockingUpdate:]):
(-[WKWebsiteDataStore _logUserInteraction:completionHandler:]):
(-[WKWebsiteDataStore _setPrevalentDomain:completionHandler:]):
(-[WKWebsiteDataStore _getIsPrevalentDomain:completionHandler:]):
(-[WKWebsiteDataStore _clearPrevalentDomain:completionHandler:]):
(-[WKWebsiteDataStore _clearResourceLoadStatistics:]):
(-[WKWebsiteDataStore _getResourceLoadStatisticsDataSummary:]):
(-[WKWebsiteDataStore _isRelationshipOnlyInDatabaseOnce:thirdParty:completionHandler:]):
(-[WKWebsiteDataStore _isRegisteredAsSubresourceUnderFirstParty:thirdParty:completionHandler:]):
(-[WKWebsiteDataStore _statisticsDatabaseHasAllTables:]):
(-[WKWebsiteDataStore _processStatisticsAndDataRecords:]):
(-[WKWebsiteDataStore _setThirdPartyCookieBlockingMode:onlyOnSitesWithoutUserInteraction:completionHandler:]):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/Network/NetworkProcessProxy.cpp:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
* UIProcess/WebProcessProxy.h:
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataRecord.cpp:
(WebKit::WebsiteDataRecord::isolatedCopy const):
* UIProcess/WebsiteData/WebsiteDataRecord.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::fetchDataAndApply):
(WebKit::WebsiteDataStore::removeData):
(WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
(WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
(WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled const):
(WebKit::WebsiteDataStore::resourceLoadStatisticsDebugMode const):
(WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
(WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
(WebKit::WebsiteDataStore::isResourceLoadStatisticsEphemeral const):
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::detachedFromParent2):
(WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
* WebProcess/WebCoreSupport/WebResourceLoadObserver.h:
* WebProcess/WebPage/WebCookieJar.cpp:
(WebKit::WebCookieJar::cookies const):
(WebKit::WebCookieJar::setCookies):
(WebKit::WebCookieJar::cookiesEnabled const):
(WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
(WebKit::WebCookieJar::getRawCookies const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::setWebsiteDataStoreParameters):
(WebKit::WebProcess::setResourceLoadStatisticsEnabled):
(WebKit::WebProcess::clearResourceLoadStatistics):
(WebKit::WebProcess::flushResourceLoadStatistics):
(WebKit::WebProcess::seedResourceLoadStatisticsForTesting):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
2021-09-14 Michael Catanzaro <mcatanzaro@gnome.org>
Fix -Wredundant-move warnings
https://bugs.webkit.org/show_bug.cgi?id=230282
Reviewed by Alex Christensen.
* Platform/IPC/ArgumentCoders.cpp:
(IPC::ArgumentCoder<CString>::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::decode):
2021-09-14 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Avoid computing post-layout EditorState data unless necessary
https://bugs.webkit.org/show_bug.cgi?id=230204
<rdar://problem/83078713>
Reviewed by Devin Rousso.
Add a new codepath on macOS that allows us to entirely avoid post-layout EditorState computation in the case
where it's not needed for anything; in particular, unless the text touch bar may be presented or the UI delegate
implements the `-webView:didChangeFontAttributes:` method, the post-layout portion of EditorState is not needed
at all.
See below for more details.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
Plumb a bit indicating whether user interaction is required in order to show the text touch bar. See
`WebPage::shouldAvoidComputingPostLayoutDataForEditorState` below for more details.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
(WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
When computing `EditorState.isContentEditable`, use VisibleSelection's `hasEditableStyle` method instead of
`isContentEditable`. Unlike the latter, the former does not trigger style resolution.
(WebKit::WebPage::didStartPageTransition):
Make a slight adjustment to only set the `m_hasEverFocusedElementDueToUserInteractionSincePageTransition` bit if
the user is actually interacting with text form control or editable element. This allows us to still avoid
computing post-layout editor state data in cases where the user has clicked on non-editable elements on the
page, such that text editing controls in the touch bar are still not being shown.
(WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
(WebKit::WebPage::sendEditorStateUpdate):
Don't bother scheduling another post-layout EditorState in the case where post-layout data is missing, but we're
avoiding post-layout data computation altogether due to `shouldAvoidComputingPostLayoutDataForEditorState`
returning `true`.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::requiresPostLayoutDataForEditorState const):
(WebKit::WebPage::shouldAvoidComputingPostLayoutDataForEditorState const):
(WebKit::WebPage::platformNeedsLayoutForEditorState const): Deleted.
Rename this to `requiresPostLayoutDataForEditorState`, to avoid some confusion with the new method,
`shouldAvoidComputingPostLayoutDataForEditorState`. The former is a way for platforms to indicate that post-
layout data *must* be included, even if layout is not up to date yet upon computing the EditorState. The latter
is a way for platforms to indicate that we can completely avoid all post-layout editor state computation,
regardless of whether or not layout is up to date.
By default, if both of the above methods return `false`, we compute and include post-layout data only if layout
is up-to-date when computing the EditorState, and schedule a subsequent "full" EditorState update after the
next rendering update in the case where layout was *not* up-to-date already (indicated by the EditorState's
`isMissingPostLayoutData` flag).
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requiresPostLayoutDataForEditorState const):
(WebKit::WebPage::platformNeedsLayoutForEditorState const): Deleted.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::shouldAvoidComputingPostLayoutDataForEditorState const):
Only return `true` here if the user interaction requirements for showing text editing controls on the touch bar
have not been met, and the UI delegate method for observing font attributes is also not implemented by the
client.
2021-09-14 Fujii Hironori <Hironori.Fujii@sony.com>
Enable IPCMessages debug logging for non-Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=230081
<rdar://problem/82939596>
Reviewed by Don Olmstead.
* Platform/IPC/MessageArgumentDescriptions.h: Added some #if to
align with the generated MessageArgumentDescriptions.cpp.
2021-09-14 Chris Dumez <cdumez@apple.com>
[Hardening] Validate IDBValue's blob paths in WebIDBServer::putOrAdd()
https://bugs.webkit.org/show_bug.cgi?id=230233
<rdar://79562514>
Reviewed by Brady Eidson.
When the SerializedScriptValue contains BlobURLs, IDBTransaction::putOrAddOnServer()
calls SerializedScriptValue::writeBlobsToDiskForIndexedDB() before sending the
WebIDBServer::PutOrAdd IPC to the network process. writeBlobsToDiskForIndexedDB()
sends a NetworkProcessConnection::writeBlobsToTemporaryFilesForIndexedDB IPC to the
network process and the network process will write the blobs to temporary files and
then return the file paths to those temporary files to the WebProcess. The file paths
are then stored inside the IDBValue object that gets sent in the WebIDBServer::PutOrAdd
IPC.
This patch hardens our IPC by validating in WebIDBServer::PutOrAdd() that the IDBValue's
Blob file paths were indeed file paths previously created by the network process on behalf
of the WebProcess sending the IPC. If it is not, we ignore the IPC.
* NetworkProcess/IndexedDB/WebIDBServer.cpp:
(WebKit::WebIDBServer::putOrAdd):
(WebKit::WebIDBServer::removeConnection):
(WebKit::WebIDBServer::registerTemporaryBlobFilePaths):
* NetworkProcess/IndexedDB/WebIDBServer.h:
* NetworkProcess/IndexedDB/WebIDBServer.messages.in:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFilesForIndexedDB):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::writeBlobsToTemporaryFilesForIndexedDB):
* WebProcess/FileAPI/BlobRegistryProxy.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::writeBlobsToTemporaryFilesForIndexedDB):
* WebProcess/Network/NetworkProcessConnection.h:
2021-09-14 Carlos Garcia Campos <cgarcia@igalia.com>
REGRESSION(r274929): [CoordinatedGraphics] DrawingAreaCoordinatedGraphics::createDisplayRefreshMonitor is no longer used
https://bugs.webkit.org/show_bug.cgi?id=230214
Reviewed by Adrian Perez de Castro.
That means we use the right display refresh monitor in the threaded compositor but a different one for rendering
update scheduler.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::displayRefreshMonitorFactory const): Remove platform ifdef, DrawingArea
unconditionally inherits from DisplayRefreshMonitorFactory and the default implementation of
createDisplayRefreshMonitor() returns nullptr.
2021-09-13 Chris Dumez <cdumez@apple.com>
[WK2] Reduce amount of IPC needed by BroadcastChannel
https://bugs.webkit.org/show_bug.cgi?id=230181
Reviewed by Alex Christensen.
Reduce amount of IPC needed by BroadcastChannel for both registration / unregistration
and communication. Each WebBroadcastChannelRegistry in the WebProcess now maintains
a map of BroadcastChannels within the WebProcess. As a result, we are able to dispatch
messages to other BroadcastChannels within the same process without going via the
NetworkProcess.
Also, the NetworkBroadcastChannelRegistry on the NetworkProcess side no longer needs
to store individual BroadcastChannelIdentifiers. It merely needs to know which
WebProcesses have one or more BroadcastChannels for a given ClientOrigin / name.
When NetworkBroadcastChannelRegistry::postMessage() is called, we no longer send
IPC to the source process in case there are other BroadcastChannels than the source
with the given ClientOrigin / name in that process. Also, if there is more than
one BroadcastChannel for the given ClientOrigin / name within a given destination
WebProcess, we now send a single IPC message instead of sending one per BroadcastChannel.
* NetworkProcess/NetworkBroadcastChannelRegistry.cpp:
(WebKit::NetworkBroadcastChannelRegistry::registerChannel):
(WebKit::NetworkBroadcastChannelRegistry::unregisterChannel):
(WebKit::NetworkBroadcastChannelRegistry::postMessage):
(WebKit::NetworkBroadcastChannelRegistry::removeConnection):
* NetworkProcess/NetworkBroadcastChannelRegistry.h:
* NetworkProcess/NetworkBroadcastChannelRegistry.messages.in:
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp:
(WebKit::WebBroadcastChannelRegistry::registerChannel):
(WebKit::WebBroadcastChannelRegistry::unregisterChannel):
(WebKit::WebBroadcastChannelRegistry::postMessage):
(WebKit::WebBroadcastChannelRegistry::postMessageLocally):
(WebKit::WebBroadcastChannelRegistry::postMessageToRemote):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h:
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.messages.in:
2021-09-13 Wenson Hsieh <wenson_hsieh@apple.com>
Refactor -[WKWebViewConfiguration _setRequiresUserActionForEditingControlsManager:] to use API::PageConfiguration
https://bugs.webkit.org/show_bug.cgi?id=230238
rdar://83078713
Reviewed by Tim Horton.
Move the `_requiresUserActionForEditingControlsManager` bit out of WebViewImpl and into API::PageConfiguration.
This makes it easier to introduce state in WebPage that keeps track of whether or not user action is required
for showing text editing controls on the touch bar, since we can fetch the (unchanging) state off of
API::PageConfiguration, and propagate it to the web process via WebPageCreationParameters.
No change in behavior.
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::copy const):
* UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::requiresUserActionForEditingControlsManager const):
(API::PageConfiguration::setRequiresUserActionForEditingControlsManager):
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _requiresUserActionForEditingControlsManager]):
(-[WKWebViewConfiguration _setRequiresUserActionForEditingControlsManager:]):
Call into API::PageConfiguration instead.
* UIProcess/API/mac/WKView.mm:
(-[WKView _requiresUserActionForEditingControlsManager]): Deleted.
(-[WKView _setRequiresUserActionForEditingControlsManager:]): Deleted.
Additionally delete this private method on WKView, which was only used by Safari on macOS, back before Safari
used WKWebView. There are currently no internal clients of this SPI method.
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::setRequiresUserActionForEditingControlsManager): Deleted.
(WebKit::WebViewImpl::requiresUserActionForEditingControlsManager const): Deleted.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::requiresUserActionForEditingControlsManager const):
Turn this into a helper method that just asks the API::PageConfiguration.
(WebKit::WebViewImpl::updateTouchBar):
2021-09-13 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] -toggleAutomaticSpellingCorrection: menu item validation shouldn't require post-layout editor state
https://bugs.webkit.org/show_bug.cgi?id=230205
Reviewed by Darin Adler.
In preparation for https://webkit.org/b/230204, refactor code on macOS that determines whether or not the
"Correct Spelling Automatically" menu bar item should be enabled, such that it doesn't require post-layout
editor state data. This is requisite to avoiding post-layout editor state computation altogether on macOS, when
the touch bar is either unavailable, or hasn't ever been shown in the context of text editing. See below for
more details.
We also take this opportunity to remove support for the unused _WKSelectionAttributeAtStartOfSentence SPI value
in _WKSelectionAttributes, which was originally intended for use in Mail compose in WebKit2 but seems to have
been obviated by the ability to swipe horizontally on the custom input accessory view in Mail compose to switch
between text candidates and the text formatting options.
* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
(WebKit::operator<<):
Remove the `atStartOfSentence` bit on EditorState's post-layout data that was only used to implement the
_WKSelectionAttributeAtStartOfSentence SPI flag value, and also move the `canEnableAutomaticSpellingCorrection`
bit out of post-layout data, and into the EditorState struct. Importantly, computing this bit does not require
or trigger layout, and this refactoring will allow us to completely forgo post-layout data on configurations
that do not require it (i.e. when the text touch bar is not active).
* Shared/EditorState.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(selectionAttributes):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Remove an unused value, _WKSelectionAttributeAtStartOfSentence, in the _WKSelectionAttributes SPI flag.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::validateUserInterfaceItem):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::getPlatformEditorState const):
2021-09-13 Alex Christensen <achristensen@webkit.org>
Add unit test that uses PCM daemon
https://bugs.webkit.org/show_bug.cgi?id=230191
Reviewed by Chris Dumez.
I make a way to specify what mach service to connect to,
then I temporarily register an executable with launchd to provide that mach service,
then I run the test communicating with that executable.
* NetworkProcess/NetworkSession.cpp:
(WebKit::managerOrProxy):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp:
(WebKit::PCM::Connection::Connection):
(WebKit::PCM::Connection::send const):
(WebKit::PCM::Connection::sendWithReply const):
(WebKit::PCM::Connection::connectionToDaemon): Deleted.
(WebKit::PCM::Connection::send): Deleted.
(WebKit::PCM::Connection::sendWithReply): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::managerPointer):
(WebKit::PCM::initializePCMStorageInDirectory):
(WebKit::PCM::daemonManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::sendMessage const):
(WebKit::PCM::ManagerProxy::sendMessageWithReply const):
(WebKit::PCM::ManagerProxy::ManagerProxy):
(WebKit::PCM::sendMessage): Deleted.
(WebKit::PCM::sendMessageWithReply): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm:
(WebKit::PCM::Connection::Connection):
(WebKit::PCM::Connection::initializeConnectionIfNeeded const):
(WebKit::PCM::Connection::send const):
(WebKit::PCM::Connection::sendWithReply const):
(WebKit::PCM::Connection::connectionToDaemon): Deleted.
(WebKit::PCM::Connection::send): Deleted.
(WebKit::PCM::Connection::sendWithReply): Deleted.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::startListeningForMachServiceConnections):
(WebKit::registerScheduledActivityHandler):
(WebKit::PCMDaemonMain):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration pcmMachServiceName]):
(-[_WKWebsiteDataStoreConfiguration setPCMMachServiceName:]):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::setPCMMachServiceName):
(WebKit::WebsiteDataStoreConfiguration::pcmMachServiceName const):
2021-09-13 Tim Horton <timothy_horton@apple.com>
Postprocess framework headers in parallel
https://bugs.webkit.org/show_bug.cgi?id=230198
Reviewed by Wenson Hsieh.
* mac/postprocess-framework-headers.sh:
Previously, the framework header postprocessing step operated serially
on each of our 665 framework headers; not doing a particularly large
amount of work on any, but still, 20 wall clock ms * 665 headers is
a good chunk of time.
Instead, run them in parallel and wait on the result.
On a 10 core machine, this better than halves the time of a WebKit-only
null build (from 36 seconds to 15).
This is definitely not an ideal solution; we're still wasting a ton
of time launching processes; it's likely possible to get further wins
here; on the other hand, header postprocessing only takes 2 seconds now.
2021-09-13 Chris Dumez <cdumez@apple.com>
Relax BroadcastChannel origin partitioning if iframe has storage access
https://bugs.webkit.org/show_bug.cgi?id=230164
Reviewed by Alex Christensen.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::hasPageLevelStorageAccess const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
2021-09-13 Chris Dumez <cdumez@apple.com>
Crash under WebPage::runJavaScript()
https://bugs.webkit.org/show_bug.cgi?id=230223
<rdar://80172436>
Reviewed by Brady Eidson.
The resolveFunction() was capturing `frame = makeRef(frame)` and then calling `frame->coreFrame()->script()`.
This would lead to a null dereference crash in the case where the core frame gets destroyed before the JS
promise gets resolved. Protecting the WebFrame does not keep the core Frame alive as WebFrame::m_coreFrame
is merely a WeakPtr. To address the issue, the lambda now also protects the core frame and uses it to get
the script controller.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScript):
2021-09-13 Per Arne Vollan <pvollan@apple.com>
Send preference updates to the GPU process
https://bugs.webkit.org/show_bug.cgi?id=230159
<rdar://81049367>
Reviewed by Brent Fulgham.
Like the WebContent process, the GPU process should also receive preference updates since it is blocking the preference service in the sandbox.
The common code to set a preference is being moved to the AuxiliaryProcess base class, so that also the GPU process can make use of it. When
the UI process is sending preference update messages to all the WebContent processes, it will now also send to the GPU process.
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* GPUProcess/cocoa/GPUProcessCocoa.mm:
(WebKit::GPUProcess::notifyPreferencesChanged):
* Shared/AuxiliaryProcess.h:
* Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::AuxiliaryProcess::decodePreferenceValue):
(WebKit::AuxiliaryProcess::setPreferenceValue):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::notifyPreferencesChanged):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::handlePreferenceChange):
(WebKit::WebProcess::notifyPreferencesChanged):
(WebKit::setPreferenceValue): Deleted.
2021-09-13 Tyler Wilcock <tyler_w@apple.com>
AX: Make PDFs loaded via <embed> accessible
https://bugs.webkit.org/show_bug.cgi?id=229556
Reviewed by Chris Fleizach and Andres Gonzalez.
This patch makes PDFs loaded in `<embed>` elements accessible to
clients by exposing the underlying `WKPDFPluginAccessibilityObject`
created by PDF plugins.
Full-frame PDF accessibility support (e.g. file:///path/to/example.pdf) was
implemented in https://bugs.webkit.org/show_bug.cgi?id=170589, but this
wasn't sufficient for PDFs loaded in `<embed>`s.
This patch only implements `<embed>` PDF support for Mac - iOS support will
need to follow in a separate patch.
* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFPluginAccessibilityObject initWithPDFPlugin:andElement:]):
Change this method to also accept the `HTMLPlugInElement` that the plugin
originates from.
(-[WKPDFPluginAccessibilityObject parent]):
Added. Returns the cached parent if present, otherwises tries to cache
the parent in the form of the `HTMLPlugInElement` that the plugin
originates from.
(-[WKPDFPluginAccessibilityObject setParent:]): Added.
(-[WKPDFPluginAccessibilityObject accessibilityAttributeValue:]):
Query against newly added `parent` getter when fulfilling attribute
value requests.
(-[WKPDFPluginAccessibilityObject ALLOW_DEPRECATED_IMPLEMENTATIONS_END]):
(-[WKPDFPluginAccessibilityObject accessibilityHitTestIntPoint:]): Added.
(-[WKPDFPluginAccessibilityObject accessibilityHitTest:]):
Changed to convert `NSPoint` to `WebCore::IntPoint` and call
`accessibilityHitTestIntPoint`.
(WebKit::PDFPlugin::create):
Add parameter to accept the `HTMLPlugInElement` that the plugin
originates from.
(WebKit::PDFPlugin::PDFPlugin):
Add parameter to accept the `HTMLPlugInElement` that the plugin
originates from.
(WebKit::PDFPlugin::accessibilityHitTest const): Added.
(-[WKPDFPluginAccessibilityObject initWithPDFPlugin:]): Deleted.
* WebProcess/Plugins/Plugin.h:
(WebKit::Plugin::accessibilityHitTest const): Added.
(WebKit::Plugin::accessibilityObject const): Change the return type to
`id` as that is more common practice.
* WebProcess/Plugins/PluginView.h:
Add `id accessibilityHitTest` and change `accessibilityObject()`
to return `id`.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::accessibilityObject const): Change return type to
`id`.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
Pass the originating `pluginElement` to `PDFPlugin::create`.
2021-09-13 Wenson Hsieh <wenson_hsieh@apple.com>
Followup to r282320 - avoid a potential memory leak
https://bugs.webkit.org/show_bug.cgi?id=230187
<rdar://problem/81436658>
Reviewed by Myles C. Maxfield.
Use `adoptCF` to prevent leaking the last resort font descriptor.
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::createCTFont):
2021-09-13 David Kilzer <ddkilzer@apple.com>
Linker warnings for WKWebViewConfiguration.limitsNavigationsToAppBoundDomains property methods
<https://webkit.org/b/230190>
Reviewed by Kate Cheney.
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration limitsNavigationsToAppBoundDomains]):
(-[WKWebViewConfiguration setLimitsNavigationsToAppBoundDomains:]):
- Move methods from category WKWebViewConfiguration (WKPrivate) to
@implementation WKWebViewConfiguration to fix the warnings.
2021-09-12 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Drawing the rounded system ui font into canvas causes a crash
https://bugs.webkit.org/show_bug.cgi?id=230187
<rdar://problem/81436658>
Reviewed by Wenson Hsieh.
It turns out that r281792 didn't do the right thing. It was trying to differentiate between
system fonts and installed fonts by looking at various values in the font's attribute dictionary.
However, the right way to do this is to treat the dictionary as opaque, and let
kCTFontOptionsSystemUIFont do the heavy lifting to make sure the font round-trips properly.
Test: fast/text/canvas-fonts.html
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::createCTFont):
(IPC::findFontDescriptor):
2021-09-12 David Kilzer <ddkilzer@apple.com>
REGRESSION (r280758): WebKit project won't open in Xcode 11.4
Unreviewed Xcode project fix.
* WebKit.xcodeproj/project.pbxproj:
- Change objectVersion back to 52. There was no need to make
this change in the original patch, and other projects use even
older values for objectVersion. Found by `git bisect`.
2021-09-11 Wenson Hsieh <wenson_hsieh@apple.com>
Remove support for -[WKWebView _needsSiteSpecificViewportQuirks]
https://bugs.webkit.org/show_bug.cgi?id=230193
Reviewed by Tim Horton.
This SPI is no longer needed; for the brief moment it existed, it was only used to allow Safari's lowered bar
(which previously overlapped page content) to additionally apply obscured bottom insets on a handful of
webpages.
This method has no internal clients (including Safari).
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _needsSiteSpecificViewportQuirks]): 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-09-11 David Kilzer <ddkilzer@apple.com>
CFNotificationCenterAddObserver() should use weak observers
<https://webkit.org/b/230168>
<rdar://problem/82987695>
Reviewed by Darin Adler.
* UIProcess/API/Cocoa/WKWebView.mm:
(hardwareKeyboardAvailabilityChangedCallback):
- Use RetainPtr to store `observer` for the duration of the
function, and add an early return if it is nil.
(-[WKWebView _initializeWithConfiguration:]):
- Use _CFNotificationObserverIsObjC to fix the bug.
- Extract local variables and change notificationName cast to be
ARC-ready. Remove notificationName from autoreleasePool.
(-[WKWebView dealloc]):
- Extract local variable and change notificationName cast to be
ARC-ready. Remove notificationName from autoreleasePool.
2021-09-11 Philippe Normand <pnormand@igalia.com>
[GLIB] MediaSession is not enabled
https://bugs.webkit.org/show_bug.cgi?id=217991
<rdar://problem/70740119>
Reviewed by Michael Catanzaro.
Pass Application name and unique ID from the UIProcess to the WebProcess in WPE and GTK
ports. The Bubblewrap launcher was also adapted to allow DBus MPRIS name ownership in the
sandboxed WebProcess.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):
* UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
(WebKit::applicationId):
(WebKit::createFlatpakInfo):
(WebKit::XDGDBusProxyLauncher::launch):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-09-10 Chris Dumez <cdumez@apple.com>
Implement navigation reporting for Cross-Origin-Opener-Policy
https://bugs.webkit.org/show_bug.cgi?id=230046
Reviewed by Alex Christensen.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
Now that we may abort expired loaders that are cached on the NetworkSession
(because awaiting transfer to another web process connection), we would hit
this assertion because the loader is not associated with this connection
anymore at the point it is adopted. For this reason, I silenced this
assertion.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::CachedNetworkResourceLoader::expirationTimerFired):
Abort the loader before destroying it to avoid hitting an assertion in the
destructor (loaders cannot be loading at the point they are destroyed).
2021-09-10 Stephan Szabo <stephan.szabo@sony.com>
[PlayStation] Support running applications with ENABLE_STATIC_JSC=ON
https://bugs.webkit.org/show_bug.cgi?id=230170
Reviewed by Ross Kirsling.
Updating loading code to not load libJavaScriptCore shared library
if we are using a static version.
* NetworkProcess/EntryPoint/playstation/NetworkProcessMain.cpp:
* WebProcess/EntryPoint/playstation/WebProcessMain.cpp:
2021-09-10 Per Arne <pvollan@apple.com>
[macOS] Close XPC connection before entering the WP sandbox
https://bugs.webkit.org/show_bug.cgi?id=230120
<rdar://82097909>
Reviewed by Tim Horton.
On macOS, close XPC connection before entering the WebContent process' sandbox.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeSandboxParameters):
2021-09-10 Per Arne Vollan <pvollan@apple.com>
[macOS] Use macro to close XPC connection
https://bugs.webkit.org/show_bug.cgi?id=230120
<rdar://82097909>
Reviewed by Brent Fulgham.
On macOS, use macro to close XPC connection before entering the sandbox.
* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::initializeSandboxParameters):
2021-09-10 Alex Christensen <achristensen@webkit.org>
Add infrastructure to allow TLS during PCM tests
https://bugs.webkit.org/show_bug.cgi?id=230137
Reviewed by Chris Dumez.
We were using NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost but that doesn't work when we are in a daemon,
where there is no NetworkSession or NetworkSessionCocoa. We needed a new SPI for setting the test TLS certificates wherever
the networking is being done.
I also found that we were unnecessarily pinging example.com when running these unit tests. I added an early return to prevent that
when running tests with a local server.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setAllowsAnySSLCertificateForWebSocket):
(WebKit::NetworkProcess::allowTLSCertificateChainForLocalPCMTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::allowTLSCertificateChainForLocalPCMTesting):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp:
(WebKit::PCM::Decoder::~Decoder):
(WebKit::PCM::Decoder::decodeFixedLengthReference):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::allowTLSCertificateChainForLocalPCMTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp:
(WebKit::PCM::messageTypeSendsReply):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp:
(WebKit::PCM::ManagerProxy::allowTLSCertificateChainForLocalPCMTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PCM::NetworkLoader::allowTLSCertificateChainForLocalPCMTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h:
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm:
(allowedLocalTestServerTrust):
(trustsServerForLocalTests):
(-[WKNetworkSessionDelegateAllowingOnlyNonRedirectedJSON URLSession:task:didReceiveChallenge:completionHandler:]):
(WebKit::PCM::NetworkLoader::allowTLSCertificateChainForLocalPCMTesting):
(WebKit::PCM::NetworkLoader::start):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
* NetworkProcess/ios/NetworkProcessIOS.mm:
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost): Deleted.
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost): Deleted.
* Platform/IPC/ArgumentCoders.h:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:
(WebKit::startListeningForMachServiceConnections):
* Shared/WebCoreArgumentCoders.h:
* Shared/cf/ArgumentCodersCF.cpp:
* Shared/cf/ArgumentCodersCF.h:
* Shared/curl/WebCoreArgumentCodersCurl.cpp:
* Shared/glib/ArgumentCodersGLib.cpp:
* Shared/glib/ArgumentCodersGLib.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::CertificateInfo>::encode):
(IPC::ArgumentCoder<WebCore::CertificateInfo>::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<SerializedPlatformDataCueValue>::decodePlatformData):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _allowTLSCertificateChain:forHost:]):
(-[WKWebsiteDataStore _trustServerForLocalPCMTesting:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_allow_tls_certificate_for_host):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::allowSpecificHTTPSCertificateForHost):
(WebKit::WebsiteDataStore::allowTLSCertificateChainForLocalPCMTesting):
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-09-10 Youenn Fablet <youenn@apple.com>
Use RTCErrorEvent for data channel error event
https://bugs.webkit.org/show_bug.cgi?id=230090
Reviewed by Eric Carlson.
Add support for transfered data chnnel by piping error info to the transfered data channel.
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp:
(WebKit::RTCDataChannelRemoteManagerProxy::detectError):
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h:
* NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in:
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp:
(WebKit::RTCDataChannelRemoteManager::detectError):
(WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::connectToSource):
(WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didDetectError):
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h:
* WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in:
2021-09-09 Alex Christensen <achristensen@webkit.org>
Modernize CertificateInfo decoder
https://bugs.webkit.org/show_bug.cgi?id=230125
Reviewed by Chris Dumez.
Return std::optional instead of bool.
* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:
* Shared/cf/ArgumentCodersCF.cpp:
(IPC::ArgumentCoder<RetainPtr<CFTypeRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFArrayRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFBooleanRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFDataRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFDateRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFDictionaryRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFNumberRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFStringRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CFURLRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<CGColorSpaceRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<SecCertificateRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<SecKeychainItemRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<SecAccessControlRef>>::decode):
(IPC::ArgumentCoder<RetainPtr<SecTrustRef>>::decode):
* Shared/cf/ArgumentCodersCF.h:
* Shared/curl/WebCoreArgumentCodersCurl.cpp:
(IPC::ArgumentCoder<CertificateInfo>::decode):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<WebCore::CertificateInfo>::decode):
* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder<CertificateInfo>::decode):
2021-09-09 Ben Nham <nham@apple.com>
Preconnected socket is sometimes not used for initial request
https://bugs.webkit.org/show_bug.cgi?id=229686
Reviewed by Alex Christensen.
In the previous release, we preconnected to the main resource origin early in page load from
UIProcess to save ~10-15 ms per page load (https://bugs.webkit.org/show_bug.cgi?id=204992).
The savings comes from the fact that there's some latency in initiating the request in
WebProcess and waiting for the nav delegate reply in UIProcess. We hide that latency by
having the eventual main resource request reuse the early preconnected socket.
However, this optimization doesn't work for connections to known HTTP/1.1 origins due to
CFNetwork's in-memory cache of known HTTP/1.1 origins. If an origin is in this cache, and
a preconnect is still in flight, then the network stack will go wide immediately and issue
the main resource request on a new socket rather than trying to wait for the preconnect to
finish and reuse the preconnected socket. Thus the preconneted socket just goes to waste.
This can also cause issues with single-threaded web servers that serve only one request at
a time, as the main resource request can get head-of-line blocked by the preconnect that
is wasted.
To work around this, this patch tracks a small number of known HTTP/1.1 origins in memory.
If there is a pending preconnect to an HTTP/1.1 origin and a main resource request to that
origin comes in, then we block the request from going out until the preconnect finishes.
This allows the main resource request to utilize the preconnected socket.
This is worth ~1.25%-2.5% on PLT5 depending on device.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didCompleteWithError):
* NetworkProcess/NetworkLoadScheduler.cpp:
(WebKit::NetworkLoadScheduler::schedule):
(WebKit::NetworkLoadScheduler::unschedule):
(WebKit::NetworkLoadScheduler::scheduleLoad):
(WebKit::NetworkLoadScheduler::unscheduleLoad):
(WebKit::NetworkLoadScheduler::scheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::unscheduleMainResourceLoad):
(WebKit::NetworkLoadScheduler::startedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::finishedPreconnectForMainResource):
(WebKit::NetworkLoadScheduler::maybePrunePreconnectInfo):
(WebKit::NetworkLoadScheduler::isOriginHTTP1X):
(WebKit::NetworkLoadScheduler::updateOriginProtocolInfo):
* NetworkProcess/NetworkLoadScheduler.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::preconnectTo):
* NetworkProcess/PreconnectTask.cpp:
(WebKit::PreconnectTask::PreconnectTask):
(WebKit::PreconnectTask::setTimeout):
(WebKit::PreconnectTask::start):
* NetworkProcess/PreconnectTask.h:
2021-09-09 Wenson Hsieh <wenson_hsieh@apple.com>
[Mac Catalyst] Korean characters do not combine correctly in editable fields in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=230122
rdar://79062204
Reviewed by Devin Rousso.
When using Korean input method (e.g. 2-set Korean) to type into editable input fields in WKWebView on Catalyst,
character combination is broken. While this is partly due to a WebKit-specific UIKit bug (see rdar://82938391),
this is also broken due to the fact that WKContentView reports a UIWKAutocorrectionContext with a
`contextBeforeSelection` that starts with a newline (\n); this causes UIKit to believe that the text selection
range when a single character has been typed is `NSRange { 2, 0 }` instead of `NSRange { 1, 0 }`, due to the
extra newline. This subsequently causes character combination logic to proceed with a range that is off by one
character, which leads to characters not being combined (or the wrong characters being combined).
To address this, we simply avoid including the leading newline in the case where the starting position for the
"context before selection" is exactly at the first position inside the editable root.
Test: AutocorrectionTests.AutocorrectionContextDoesNotIncludeNewlineInTextField
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::autocorrectionContext):
Also drive-by fix a typo in "minContextLenght" while I'm here, and rename `currentPosition` to
`contextStartPosition`, to better describe the purpose of this local variable.
2021-09-09 Fujii Hironori <Hironori.Fujii@sony.com>
Enable IPCMessages debug logging for non-Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=230081
Reviewed by Alex Christensen.
r282177 temporarily disabled IPCMessages debug logging for
non-Cocoa ports because the generated
MessageArgumentDescriptions.cpp couldn't compile for them. Then,
r282190 fixed the problem. Enable it.
* Platform/IPC/HandleMessage.h:
(IPC::logMessageImpl): Reverted the change of r282177 to enable the logging.
(IPC::logReply): Ditto.
* Scripts/webkit/messages.py:
(generate_message_argument_description_implementation):
ENABLE(IPC_TESTING_API) isn't enabled for non-Cocoa ports yet.
Changed the condition.
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Updated
this test expectation.
2021-09-09 Alex Christensen <achristensen@webkit.org>
Add PrivateClickMeasurement daemon
https://bugs.webkit.org/show_bug.cgi?id=230052
Reviewed by Chris Dumez.
This adds the infrastructure to use a daemon instead of the network process to handle PrivateClickMeasurement.
It does not start using the daemon yet, so there is no change in behavior.
I made a new class PCM::ManagerInterface which can either be a PrivateClickMeasurementManager or a PCM::ManagerProxy,
which would send messages to the daemon instead of doing the work locally.
I implemented the encoding and decoding of parameters using some of the IPC encoding templates.
I have an entry point for an executable but no executable yet.
I have verified that EventAttribution unit tests pass when using the daemon, so the infrastructure is good.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
(WebKit::pcmStoreDirectory): Deleted.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::privateClickMeasurement):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.cpp: Added.
(WebKit::PCM::Connection::connectionToDaemon):
(WebKit::PCM::Connection::send):
(WebKit::PCM::Connection::sendWithReply):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementConnection.h: Added.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.cpp: Added.
(WebKit::PCM::DaemonClient::loadFromNetwork):
(WebKit::PCM::DaemonClient::broadcastConsoleMessage):
(WebKit::PCM::DaemonClient::featureEnabled const):
(WebKit::PCM::DaemonClient::debugModeEnabled const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDaemonClient.h: Added.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.cpp: Added.
(WebKit::PCM::Decoder::bufferIsLargeEnoughToContainBytes const):
(WebKit::PCM::Decoder::decodeFixedLengthData):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDecoder.h: Added.
(WebKit::PCM::Decoder::Decoder):
(WebKit::PCM::Decoder::operator>>):
(WebKit::PCM::Decoder::bufferIsLargeEnoughToContain const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.cpp: Added.
(WebKit::PCM::Encoder::encodeFixedLengthData):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementEncoder.h: Added.
(WebKit::PCM::Encoder::operator<<):
(WebKit::PCM::Encoder::encode):
(WebKit::PCM::Encoder::takeBuffer):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.cpp: Added.
(WebKit::PCM::MessageInfo::toStringForTesting::encodeReply):
(WebKit::PCM::manager):
(WebKit::PCM::handlePCMMessage):
(WebKit::PCM::handlePCMMessageWithReply):
(WebKit::PCM::decodeMessageAndSendToManager):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerInterface.h: Added.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.cpp: Added.
(WebKit::PCM::sendMessage):
(WebKit::PCM::ReplyCaller<>::callReply):
(WebKit::PCM::ReplyCaller<String>::callReply):
(WebKit::PCM::sendMessageWithReply):
(WebKit::PCM::ManagerProxy::storeUnattributed):
(WebKit::PCM::ManagerProxy::handleAttribution):
(WebKit::PCM::ManagerProxy::clear):
(WebKit::PCM::ManagerProxy::clearForRegistrableDomain):
(WebKit::PCM::ManagerProxy::migratePrivateClickMeasurementFromLegacyStorage):
(WebKit::PCM::ManagerProxy::toStringForTesting const):
(WebKit::PCM::ManagerProxy::setOverrideTimerForTesting):
(WebKit::PCM::ManagerProxy::setTokenPublicKeyURLForTesting):
(WebKit::PCM::ManagerProxy::setTokenSignatureURLForTesting):
(WebKit::PCM::ManagerProxy::setAttributionReportURLsForTesting):
(WebKit::PCM::ManagerProxy::markAllUnattributedAsExpiredForTesting):
(WebKit::PCM::ManagerProxy::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::PCM::ManagerProxy::setEphemeralMeasurementForTesting):
(WebKit::PCM::ManagerProxy::setPCMFraudPreventionValuesForTesting):
(WebKit::PCM::ManagerProxy::startTimerImmediatelyForTesting):
(WebKit::PCM::ManagerProxy::destroyStoreForTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManagerProxy.h: Added.
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementDaemonConnectionCocoa.mm: Added.
(WebKit::PCM::Connection::Connection):
(WebKit::PCM::Connection::connectionToDaemon):
(WebKit::PCM::dictionaryFromMessage):
(WebKit::PCM::Connection::send):
(WebKit::PCM::Connection::sendWithReply):
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.h: Added.
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementXPCUtilities.mm: Added.
(WebKit::PCM::addVersionAndEncodedMessageToDictionary):
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* Platform/IPC/ArgumentCoder.h:
* Platform/IPC/ArgumentCoders.cpp:
(IPC::decodeStringText):
(IPC::ArgumentCoder<String>::decode):
* Platform/IPC/ArgumentCoders.h:
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.h: Added.
* Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm: Added.
(WebKit::peers):
(WebKit::CompletionHandler<void):
(WebKit::connectionEventHandler):
(WebKit::startListeningForMachServiceConnections):
(WebKit::registerScheduledActivityHandler):
(WebKit::enterSandbox):
(WebKit::PCMDaemonMain):
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-09-09 Sihui Liu <sihui_liu@apple.com>
Address post-commit comments on r282130 (Add basic support for Storage API)
https://bugs.webkit.org/show_bug.cgi?id=230059
Reviewed by Youenn Fablet.
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::localOriginStorageManager):
2021-09-09 Chris Dumez <cdumez@apple.com>
Implement a WebProcess cap
https://bugs.webkit.org/show_bug.cgi?id=230067
<rdar://79479244>
Reviewed by Geoffrey Garen.
Implement a WebProcess cap to avoid getting into a state where we run out of resources and crash in various ways.
The current limit is 400 and can be changed via an SPI. The limit is per UIProcess (not per process pool).
When we try and launch a new WebProcess and the limit has been reached, we terminate the least recently used
WebProcess to avoid going over the limit.
* Shared/ProcessTerminationReason.h:
* UIProcess/API/C/WKAPICast.h:
(WebKit::toAPI):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _setWebProcessCountLimit:]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::wkProcessTerminationReason):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::loadSimulatedRequest):
(WebKit::WebPageProxy::loadAlternateHTML):
(WebKit::WebPageProxy::loadWebArchiveData):
(WebKit::WebPageProxy::reload):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::shouldReloadAfterProcessTermination):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::setProcessCountLimit):
(WebKit::WebProcessProxy::create):
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::addProvisionalPageProxy):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
(WebKit::WebProcessProxy::establishServiceWorkerContext):
(WebKit::WebProcessProxy::markProcessAsRecentlyUsed):
* UIProcess/WebProcessProxy.h:
2021-09-09 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the Mac Catalyst build after r282191
https://bugs.webkit.org/show_bug.cgi?id=230037
* WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
Update some logic that's guarded by ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING) to use "->" for accessing methods on
Ref and CheckedRef, rather than ".".
(WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
(WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
2021-09-09 Youenn Fablet <youenn@apple.com>
Categorize WebRTC TCP nw connections like done for WebRTC UDP nw connections
https://bugs.webkit.org/show_bug.cgi?id=229801
Reviewed by Eric Carlson.
Move NetworkRTCUDPSocketCocoa tracker related code to its own routine in NetworkRTCUtilitiesCocoa.
Make use of that routine in NetworkRTCTCPSocketCocoa.
To do so, we need to pass more information when creating a client TCP socket from WebProcess to NetworkProcess.
Manually tested.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket):
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
(WebKit::isKnownTracker): Deleted.
* NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h:
* NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm:
(WebKit::setNWParametersTrackerOptions):
(WebKit::isKnownTracker):
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::RTCSocketFactory::CreateClientTcpSocket):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2021-09-08 Ryosuke Niwa <rniwa@webkit.org>
Deploy CheckedRef on FocusController
https://bugs.webkit.org/show_bug.cgi?id=230037
Reviewed by Wenson Hsieh.
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameFocus):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKAccessibilityFocusedObject):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::focusPluginElement):
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::changeWordCase):
* WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
(WebKit::TextCheckingControllerProxy::rangeAndOffsetRelativeToSelection):
(WebKit::TextCheckingControllerProxy::replaceRelativeToSelection):
(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation):
(WebKit::WebPage::performDictionaryLookupOfCurrentSelection):
(WebKit::WebPage::insertDictatedTextAsync):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::showFindIndicatorInSelection):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
(WebKit::WebPage::changeFontAttributes):
(WebKit::WebPage::changeFont):
(WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
(WebKit::WebPage::executeEditingCommand):
(WebKit::WebPage::setEditable):
(WebKit::WebPage::increaseListLevel):
(WebKit::WebPage::decreaseListLevel):
(WebKit::WebPage::changeListType):
(WebKit::WebPage::setBaseWritingDirection):
(WebKit::WebPage::isEditingCommandEnabled):
(WebKit::WebPage::contextMenuForKeyEvent):
(WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome):
(WebKit::WebPage::validateCommand):
(WebKit::WebPage::requestFontAttributesAtSelectionStart):
(WebKit::WebPage::centerSelectionInVisibleArea):
(WebKit::WebPage::insertNewlineInQuotedContent):
(WebKit::WebPage::viewWillStartLiveResize):
(WebKit::WebPage::viewWillEndLiveResize):
(WebKit::WebPage::setInitialFocus):
(WebKit::WebPage::getSelectionOrContentsAsString):
(WebKit::WebPage::advanceToNextMisspelling):
(WebKit::WebPage::hasRichlyEditableSelection const):
(WebKit::WebPage::changeSpellingToWord):
(WebKit::WebPage::uppercaseWord):
(WebKit::WebPage::lowercaseWord):
(WebKit::WebPage::capitalizeWord):
(WebKit::WebPage::clearSelection):
(WebKit::WebPage::restoreSelectionInFocusedEditableElement):
(WebKit::WebPage::handleAlternativeTextUIResult):
(WebKit::WebPage::setCompositionForTesting):
(WebKit::WebPage::hasCompositionForTesting):
(WebKit::WebPage::confirmCompositionForTesting):
(WebKit::WebPage::setTextAsync):
(WebKit::WebPage::insertTextAsync):
(WebKit::WebPage::hasMarkedText):
(WebKit::WebPage::getMarkedRangeAsync):
(WebKit::WebPage::getSelectedRangeAsync):
(WebKit::WebPage::characterIndexForPointAsync):
(WebKit::WebPage::firstRectForCharacterRangeAsync):
(WebKit::WebPage::setCompositionAsync):
(WebKit::WebPage::confirmCompositionAsync):
(WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
(WebKit::WebPage::didEndUserTriggeredSelectionChanges):
(WebKit::WebPage::sendEditorStateUpdate):
(WebKit::WebPage::flushPendingEditorStateUpdate):
(WebKit::WebPage::insertAttachment):
(WebKit::WebPage::createAppHighlightInSelectedRange):
(WebKit::WebPage::restoreAppHighlightsAndScrollToIndex):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::FindController::didFindString):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformWillPerformEditingCommand):
(WebKit::WebPage::getSelectionContext):
(WebKit::WebPage::updateSelectionAppearance):
(WebKit::WebPage::generateSyntheticEditingCommand):
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::didConcludeEditDrag):
(WebKit::WebPage::clearSelectionAfterTapIfNeeded):
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::clearSelection):
(WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture):
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::selectWithTwoTouches):
(WebKit::WebPage::extendSelection):
(WebKit::WebPage::platformDidSelectAll):
(WebKit::WebPage::selectWordBackward):
(WebKit::WebPage::moveSelectionByOffset):
(WebKit::WebPage::startAutoscrollAtPosition):
(WebKit::WebPage::requestEvasionRectsAboveSelection):
(WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
(WebKit::WebPage::storeSelectionForAccessibility):
(WebKit::WebPage::getRectsAtSelectionOffsetWithText):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPage::setFocusedFrameBeforeSelectingTextAtLocation):
(WebKit::WebPage::setSelectionRange):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):
(WebKit::WebPage::requestDictationContext):
(WebKit::WebPage::replaceSelectedText):
(WebKit::WebPage::replaceDictatedText):
(WebKit::WebPage::requestAutocorrectionData):
(WebKit::WebPage::applyAutocorrectionInternal):
(WebKit::WebPage::autocorrectionContext):
(WebKit::focusedElementPositionInformation):
(WebKit::nextAssistableElement):
(WebKit::WebPage::focusedElementInformation):
(WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
(WebKit::WebPage::insertTextPlaceholder):
(WebKit::WebPage::updateSelectionWithDelta):
(WebKit::WebPage::requestDocumentEditingContext):
(WebKit::WebPage::focusTextInputContextAndPlaceCaret):
(WebKit::WebPage::animationDidFinishForElement):
2021-09-08 Fujii Hironori <Hironori.Fujii@sony.com>
generated MessageArgumentDescriptions.cpp can't compile for non-Cocoa ports due to missing headers
https://bugs.webkit.org/show_bug.cgi?id=230075
Reviewed by Ryosuke Niwa.
The generated MessageArgumentDescriptions.cpp unconditionally
included platform specific headers, for example
<WebCore/CAAudioStreamDescription.h>.
generate_message_argument_description_implementation generates the
#includes, it should take receiver.condition into account.
* CMakeLists.txt:
(GENERATE_MESSAGE_SOURCES): Added MessageArgumentDescriptions.cpp to compile.
* Scripts/webkit/messages.py:
(generate_message_argument_description_implementation):
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
2021-09-08 Tim Horton <timothy_horton@apple.com>
WKWebView specific bug: WKWebView as the contents of a SceneKit/ARKit node doesn't work (UIWebView works)
https://bugs.webkit.org/show_bug.cgi?id=203060
<rdar://problem/82899923>
Reviewed by Dean Jackson.
SceneKit's snapshotter cannot handle CAMachPort-as-layer-contents.
If we get parented in a SceneKit snapshotting window, map all existing
surfaces, and prefer using actual IOSurfaces instead of CAMachPort from then on.
* UIProcess/Cocoa/PageClientImplCocoa.h:
* UIProcess/Cocoa/PageClientImplCocoa.mm:
(WebKit::PageClientImplCocoa::windowKind):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::webViewDidMoveToWindow):
* UIProcess/WebPageProxy.h:
* UIProcess/WindowKind.h: Added.
Keep track of the kind of window we're currently in (the only special
case at the moment is the SceneKit snapshotting window, but you could
easily imagine us caring about others).
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::windowKindDidChange):
* UIProcess/PageClient.h:
(WebKit::PageClient::windowKind):
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::windowKindDidChange):
Map CAMachPorts to IOSurfaces when we move into a SceneKit snapshotting window.
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::layerContentsType const):
(WebKit::RemoteLayerTreeHost::updateLayerTree):
Prefer IOSurface if we're already in a SceneKit snapshotting window.
Also factor this code out and improve the comments.
2021-09-08 Fujii Hironori <Hironori.Fujii@sony.com>
REGRESSION(r282115): undefined reference to `IPC::messageArgumentDescriptions(IPC::MessageName)' in Debug build
https://bugs.webkit.org/show_bug.cgi?id=230064
Unreviewed build fix.
Debug build of non-Cocoa ports were broken since r282115 started
to use IPC::messageArgumentDescriptions for debug logging.
However, MessageArgumentDescriptions.cpp has a long-standing
compilation problem for non-Cocoa ports.
Temporarily disabled the debug logging for non-Cocoa ports by
using ENABLE(IPC_TESTING_API) macro. I'll revert this change after
I will fix the fundamental problem of messages.py.
* Platform/IPC/HandleMessage.h:
(IPC::logMessageImpl):
(IPC::logReply):
2021-09-08 Sihui Liu <sihui_liu@apple.com>
Remove unnecessary WTF:: in WebsiteDataStore files
https://bugs.webkit.org/show_bug.cgi?id=230036
Reviewed by Darin Adler.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::defaultApplicationCacheDirectory):
(WebKit::WebsiteDataStore::defaultCacheStorageDirectory):
(WebKit::WebsiteDataStore::defaultNetworkCacheDirectory):
(WebKit::WebsiteDataStore::defaultAlternativeServicesDirectory):
(WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
(WebKit::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
(WebKit::WebsiteDataStore::defaultLocalStorageDirectory):
(WebKit::WebsiteDataStore::defaultMediaKeysStorageDirectory):
(WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
(WebKit::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
(WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
(WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
(WebKit::WebsiteDataStore::defaultModelElementCacheDirectory):
(WebKit::WebsiteDataStore::tempDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
(WebKit::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::defaultMediaCacheDirectory):
(WebKit::WebsiteDataStore::defaultAlternativeServicesDirectory):
(WebKit::WebsiteDataStore::defaultJavaScriptConfigurationDirectory):
(WebKit::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-09-08 Peng Liu <peng.liu6@apple.com>
[macOS] -[WKFullScreenWindowController exitFullScreenImmediately] does not exit fullscreen immediately
https://bugs.webkit.org/show_bug.cgi?id=230024
Reviewed by Jer Noble.
A WebContent process may ask the `WKFullScreenWindowController` in
the UI process to exit fullscreen immediately without walking through
the normal exit fullscreen sequence, and the WebContent process won't
expect any IPC message related to fullscreen to come back from the
UI process. If the UI process sends an IPC message to the WebContent
process and expects the response from the WebContent process (e.g., in
`WebPageProxy::forceRepaint()`), the UI process will be stuck.
That will happen when a tab navigates to the previous page while a video
element in the current page is playing in fullscreen. The reason is that
`-[WKFullScreenWindowController exitFullScreen]` is called before
`-[WKFullScreenWindowController exitFullScreenImmediately]`.
`-[WKFullScreenWindowController exitFullScreen]` changes `_fullScreenState`
to `WaitingToExitFullScreen`, so `-[WKFullScreenWindowController exitFullScreenImmediately]`
will return early. This patch fixes this issue by changing the early return condition.
In addition, `-[WKFullScreenWindowController exitFullScreenImmediately]`
does not really exit fullscreen immediately. Instead, it calls
`-[WKFullScreenWindowController finishedExitFullScreenAnimation:]`,
which always calls `WebPageProxy::forceRepaint()` and expects a response
from the WebContet process. This patch fixes this issue as well.
Tested manually.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController exitFullScreenImmediately]):
Update the early return condition to make sure the UI process will proceed
to exit fullscreen unless the current state is `NotInFullScreen`.
(-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
The `completed` parameter was not used. This patch renames it to `immediately` to
indicate whether `WKFullScreenWindowController` wants to exit fullscreen immediately.
(-[WKFullScreenWindowController close]):
Clean up this function after revising `-[WKFullScreenWindowController exitFullScreenImmediately]`.
(-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
Update the argument according to the change of `-[WKFullScreenWindowController finishedExitFullScreenAnimation:]`.
(-[WKFullScreenWindowController windowDidExitFullScreen:]): Ditto.
2021-09-08 Sihui Liu <sihui_liu@apple.com>
Remove responsiveness timer in NetworkProcessProxy::getNetworkProcessConnection
https://bugs.webkit.org/show_bug.cgi?id=230016
rdar://problem/80760179
Reviewed by Chris Dumez.
We've seen evidence that network process may be blocked in initializeNetworkProcess. Since we have a 3-second
responsiveness timer in NetworkProcessProxy::getNetworkProcessConnection, blocked network process will be killed
and a new network process will be launched for getting connection. However, the new network process may get
stuck in initializeNetworkProcess too. In this case, web process will crash for not being able to get network
process connection.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
* UIProcess/WebsiteData/WebsiteDataStore.cpp: change RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE to
RELEASE_LOG_ERROR as the message is not printed in non-debug build.
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
2021-09-08 Sihui Liu <sihui_liu@apple.com>
Regression (r282130): [ macOS iOS wk2 ] imported/w3c/web-platform-tests/storage/persisted.https.any.html is failing
https://bugs.webkit.org/show_bug.cgi?id=230053
<rdar://problem/82879548>
Reviewed by Chris Dumez.
Add SPI to clear storage states for testing.
Covered by existing tests.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::clearStorage):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::clearStorageForTesting):
* NetworkProcess/storage/NetworkStorageManager.h:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreClearStorage):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::clearStorage):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::clearStorage):
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-09-08 Per Arne <pvollan@apple.com>
Remove unneeded call on startup of WebContent process
https://bugs.webkit.org/show_bug.cgi?id=230022
<rdar://problem/82838000>
Reviewed by Darin Adler.
There is no need to call CGSShutdownServerConnections during startup of the WebContent process on macOS,
since we already have asserted that there are no open connections at this point.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeProcess):
2021-09-08 Jean-Yves Avenard <jya@apple.com>
Safari TP 131 audio canPlayType() reports false negatives
https://bugs.webkit.org/show_bug.cgi?id=229799
rdar://problem/82776747
Reviewed by Youenn Fablet.
* Shared/WebPreferencesDefaultValues.cpp:
* Shared/WebPreferencesDefaultValues.h: Remove no longer used method.
2021-09-07 Sihui Liu <sihui_liu@apple.com>
Add basic support for Storage API
https://bugs.webkit.org/show_bug.cgi?id=229925
Reviewed by Darin Adler.
Set up basic infrastructure for StorageManager.
UI process sets the directory for StorageMananager with datastore configuration.
Network process manages storage with NetworkStorageManager (per Session). It has multiple OriginStorageManagers
for managing storage of different origins, and each OriginStorageManager has a default StorageBucket.
Web process can get and set persist property of each bucket by sending messages to network process.
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::addStorageManagerForSession):
(WebKit::NetworkProcess::removeStorageManagerForSession):
(WebKit::NetworkProcess::destroySession):
(WebKit::NetworkProcess::connectionToWebProcessClosed):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/storage/NetworkStorageManager.cpp: Added.
(WebKit::NetworkStorageManager::create):
(WebKit::NetworkStorageManager::NetworkStorageManager):
(WebKit::NetworkStorageManager::startReceivingMessageFromConnection):
(WebKit::NetworkStorageManager::stopReceivingMessageFromConnection):
(WebKit::encode):
(WebKit::originPath):
(WebKit::NetworkStorageManager::localOriginStorageManager):
(WebKit::NetworkStorageManager::persisted):
(WebKit::NetworkStorageManager::persist):
* NetworkProcess/storage/NetworkStorageManager.h: Added.
(WebKit::NetworkStorageManager::sessionID const):
* NetworkProcess/storage/NetworkStorageManager.messages.in: Added.
* NetworkProcess/storage/OriginStorageManager.cpp: Added.
(WebKit::OriginStorageManager::StorageBucket::StorageBucket):
(WebKit::OriginStorageManager::StorageBucket::mode const):
(WebKit::OriginStorageManager::StorageBucket::setMode):
(WebKit::OriginStorageManager::OriginStorageManager):
(WebKit::OriginStorageManager::persist):
* NetworkProcess/storage/OriginStorageManager.h: Added.
(WebKit::OriginStorageManager::persisted const):
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* Sources.txt:
* UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.cpp:
(WKWebsiteDataStoreConfigurationCopyGeneralStorageDirectory):
(WKWebsiteDataStoreConfigurationSetGeneralStorageDirectory):
* UIProcess/API/C/WKWebsiteDataStoreConfigurationRef.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration generalStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration setGeneralStorageDirectory:]):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::generalStorageDirectory const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::WebsiteDataStoreConfiguration):
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::generalStorageDirectory const):
(WebKit::WebsiteDataStoreConfiguration::setGeneralStorageDirectory):
* UIProcess/WebsiteData/playstation/WebsiteDataStorePlayStation.cpp:
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
* UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
* UIProcess/glib/WebsiteDataStoreGLib.cpp:
(WebKit::WebsiteDataStore::defaultGeneralStorageDirectory):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebStorageConnection.cpp: Added.
(WebKit::WebStorageConnection::create):
(WebKit::WebStorageConnection::persisted):
(WebKit::WebStorageConnection::persist):
(WebKit::WebStorageConnection::connection):
* WebProcess/WebCoreSupport/WebStorageConnection.h: Added.
* WebProcess/WebCoreSupport/WebStorageProvider.h: Added.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
2021-09-07 Alex Christensen <achristensen@webkit.org>
Replace PrivateClickMeasurementNetworkLoader::start with an implementation that doesn't need NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=230015
This fixes the internal build after r282110.
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm:
(WebKit::PCM::NetworkLoader::start):
(processPCMRequest): Deleted.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(processPCMRequest):
(WebKit::setPCMDataCarriedOnRequest):
2021-09-07 Cameron McCormack <heycam@apple.com>
Add an IPCMessages channel to log all IPC messages
https://bugs.webkit.org/show_bug.cgi?id=229664
<rdar://problem/82511640>
Reviewed by Alex Christensen.
This adds a new IPCMessages log channel, to which all IPC message names,
arguments, and return values are logged. To avoid performance impacts
when not logging, these are only enabled in debug builds.
ValueOrDefault is used when writing out each message argument to (1)
avoid having to add operator<<(TextStream&) defintions for all
argument types right now, and (2) to alleviate the need to add such a
definition when adding new IPC messages. The string "..." is output
for types with no operator<< defined.
The remote and local process IDs are included in the log message. The
remote process ID is only readily accessible on OS(DARWIN), as we can
grab it from the XPC connection. But not all IPC::Connections are
created for XPC connections. For example, the Web -> GPU process
connection is created by the UI process on behalf of the Web process,
and the IPC::Connection::Identifier does not have an XPC service
handle in it. So for now, we omit the remote process ID. (We'd need
to thread it through messages like CreateGPUConnectionToWebProcess
to have it available.)
Since we need the IPC::Connection object for logging now, all of the
handleMessage* functions take a connection, and the messages.py code
generator is updated accordingly.
* Platform/IPC/HandleMessage.h:
(IPC::textStreamForLogging):
(IPC::logMessageImpl):
(IPC::logMessage):
(IPC::logReply):
(IPC::handleMessage):
(IPC::handleMessageWantsConnection):
(IPC::handleMessageSynchronous):
(IPC::handleMessageSynchronousWantsConnection):
(IPC::handleMessageAsync):
(IPC::handleMessageAsyncWantsConnection):
* Platform/Logging.h:
* Scripts/webkit/messages.py:
(async_message_statement):
(sync_message_statement):
* Scripts/webkit/tests/TestWithCVPixelBufferMessageReceiver.cpp:
(WebKit::TestWithCVPixelBuffer::didReceiveMessage):
(WebKit::TestWithCVPixelBuffer::didReceiveSyncMessage):
* 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::didReceiveMessage):
* Scripts/webkit/tests/TestWithoutAttributesMessageReceiver.cpp:
(WebKit::TestWithoutAttributes::didReceiveMessage):
(WebKit::TestWithoutAttributes::didReceiveSyncMessage):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::didReceiveMessage):
2021-09-07 Per Arne <pvollan@apple.com>
Fix incorrect preprocess guard in WebContent sandbox
https://bugs.webkit.org/show_bug.cgi?id=230025
<rdar://82721734>
Reviewed by Brent Fulgham.
Fix incorrect macOS version guard.
* WebProcess/com.apple.WebProcess.sb.in:
2021-09-07 Alex Christensen <achristensen@webkit.org>
Replace PrivateClickMeasurementNetworkLoader::start with an implementation that doesn't need NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=230015
Reviewed by John Wilander.
This is needed to run this code in a process that doesn't have NetworkSession, which is a class tied closely to WKWebsiteDataStore.
This replaces it with a simple implementation that does the same things:
1. Uses an ephemeral stateless session that doesn't accept cookies or use credentials.
2. Does not allow redirects.
3. Only accepts JSON mime types.
4. Calls processPCMRequest
We still need to call NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost to get tests to pass.
Covered by existing tests.
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::addPrivateClickMeasurementNetworkLoader): Deleted.
(WebKit::NetworkSession::removePrivateClickMeasurementNetworkLoader): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
(WebKit::PCM::Client::~Client):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp:
(WebKit::PCM::ClientImpl::loadFromNetwork): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PCM::NetworkLoader::start):
(WebKit::generateNetworkLoadParameters): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::start): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::PrivateClickMeasurementNetworkLoader): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::~PrivateClickMeasurementNetworkLoader): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::fail): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::cancel): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::willSendRedirectedRequest): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::didReceiveResponse): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::didReceiveBuffer): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::didFinishLoading): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::didFailLoading): Deleted.
(WebKit::PrivateClickMeasurementNetworkLoader::didComplete): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h:
(): Deleted.
* NetworkProcess/PrivateClickMeasurement/cocoa/PrivateClickMeasurementNetworkLoaderCocoa.mm: Added.
(processPCMRequest):
(-[WKNetworkSessionDelegateAllowingOnlyNonRedirectedJSON URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
(-[WKNetworkSessionDelegateAllowingOnlyNonRedirectedJSON URLSession:dataTask:didReceiveResponse:completionHandler:]):
(-[WKNetworkSessionDelegateAllowingOnlyNonRedirectedJSON URLSession:task:didReceiveChallenge:completionHandler:]):
(WebKit::PCM::taskMap):
(WebKit::PCM::statelessSessionWithoutRedirects):
(WebKit::PCM::NetworkLoader::start):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(processPCMRequest): Deleted.
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-09-07 Alex Christensen <achristensen@webkit.org>
Simplify PrivateClickMeasurementManager interface
https://bugs.webkit.org/show_bug.cgi?id=230014
Reviewed by John Wilander.
ResourceRequest serialization is excessive and complicated.
Let's just serialize the parts we need instead.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::handlePrivateClickMeasurementConversion):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::handleAttribution):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
2021-09-07 Chris Dumez <cdumez@apple.com>
Implement origin partitioning (top-origin/frame-origin) for BroadcastChannel
https://bugs.webkit.org/show_bug.cgi?id=229814
Reviewed by Alex Christensen.
Implement origin partitioning (top-origin/frame-origin) for BroadcastChannel to address privacy
concerns, as discussed here:
- https://github.com/whatwg/html/issues/5803
* NetworkProcess/NetworkBroadcastChannelRegistry.cpp:
(WebKit::NetworkBroadcastChannelRegistry::registerChannel):
(WebKit::NetworkBroadcastChannelRegistry::unregisterChannel):
(WebKit::NetworkBroadcastChannelRegistry::postMessage):
(WebKit::NetworkBroadcastChannelRegistry::removeConnection):
* NetworkProcess/NetworkBroadcastChannelRegistry.h:
* NetworkProcess/NetworkBroadcastChannelRegistry.messages.in:
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp:
(WebKit::WebBroadcastChannelRegistry::registerChannel):
(WebKit::WebBroadcastChannelRegistry::unregisterChannel):
(WebKit::WebBroadcastChannelRegistry::postMessage):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h:
2021-09-07 Wenson Hsieh <wenson_hsieh@apple.com>
Post-layout `EditorState` updates should be scheduled using `RenderingUpdateScheduler`
https://bugs.webkit.org/show_bug.cgi?id=229905
Reviewed by Simon Fraser.
Use `Page::scheduleRenderingUpdate` rather than `DrawingArea::triggerRenderingUpdate` to ensure that we schedule
a layer tree flush when sending a full post-layout `EditorState` update to the UI process. On macOS, the latter
method on DrawingArea will immediately install a runloop observer for the next CA commit, while the former only
does so after a zero-delay timer fires, courtesy of RenderingUpdateScheduler.
This prevents us from triggering unnecessary layer tree flushes in the case where the selection changes
frequently during a single rendering update; in particular, in Speedometer 2 on macOS, this decreases the total
number of rendering updates performed over the course of the benchmark by roughly 30%.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scheduleFullEditorStateUpdate):
2021-09-07 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, early September 2021 edition
https://bugs.webkit.org/show_bug.cgi?id=229983
Unreviewed non-unified build fixes.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h: Add missing
WebCore/PrivateClickMeasurement.h header.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp:
(WebKit::PCM::ClientImpl::loadFromNetwork): Sprinkle missing WebCore:: namespace prefixes.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h: Add missing
wtf/WeakPtr.h header.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp: Add
missing WebCore/RuntimeApplicationChecks.h header.
2021-09-06 Dmitry Kalinkin <dmitry.kalinkin+webkit@gmail.com>
Fix WebKitGTK build on MacOS
https://bugs.webkit.org/show_bug.cgi?id=225850
Reviewed by Michael Catanzaro.
Define HAVE_AUDIT_TOKEN only for Cocoa backend.
Streamline other conditionals for consistency between headers and implementations.
* NetworkProcess/ServiceWorker/WebSWOriginStore.cpp:
(WebKit::WebSWOriginStore::sendStoreHandle):
* Platform/IPC/unix/ConnectionUnix.cpp:
* Platform/IPC/IPCSemaphore.h:
* Platform/SharedMemory.h:
* UIProcess/VisitedLinkStore.cpp:
(WebKit::VisitedLinkStore::sendStoreHandleToProcess):
2021-09-06 Youenn Fablet <youenn@apple.com>
Implement libwebrtc network manager GetMdnsResponder
https://bugs.webkit.org/show_bug.cgi?id=229757
Reviewed by Eric Carlson.
Implement RTCNetworkManager API in LibWebRTCNetworkManager to handle per-document mDNS registrations.
Move part of WebRTCMonitor to LibWebRTCNetworkManager.
LibWebRTCNetworkManager is a WebRTCMonitor observer to get the list of networks.
Since libwebrtc is now doing the mDNS registration, we need to return a mDNS name even if registration failed.
We update WebMDNSRegister and NetworkMDNSRegister accordingly.
* NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
(WebKit::registerMDNSNameCallback):
(WebKit::NetworkMDNSRegister::registerMDNSName):
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/webrtc/LibWebRTCNetworkManager.cpp: Added.
(WebKit::LibWebRTCNetworkManager::getOrCreate):
(WebKit::LibWebRTCNetworkManager::LibWebRTCNetworkManager):
(WebKit::LibWebRTCNetworkManager::~LibWebRTCNetworkManager):
(WebKit::LibWebRTCNetworkManager::unregisterMDNSNames):
(WebKit::LibWebRTCNetworkManager::StartUpdating):
(WebKit::LibWebRTCNetworkManager::StopUpdating):
(WebKit::LibWebRTCNetworkManager::GetMdnsResponder const):
(WebKit::LibWebRTCNetworkManager::networksChanged):
(WebKit::LibWebRTCNetworkManager::networkProcessCrashed):
(WebKit::LibWebRTCNetworkManager::CreateNameForAddress):
(WebKit::LibWebRTCNetworkManager::RemoveNameForAddress):
* WebProcess/Network/webrtc/LibWebRTCNetworkManager.h: Added.
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createPeerConnection):
(WebKit::LibWebRTCProvider::disableNonLocalhostConnections):
* WebProcess/Network/webrtc/LibWebRTCProvider.h:
* WebProcess/Network/webrtc/WebMDNSRegister.cpp:
(WebKit::WebMDNSRegister::finishedRegisteringMDNSName):
(WebKit::WebMDNSRegister::registerMDNSName):
* WebProcess/Network/webrtc/WebMDNSRegister.h:
* WebProcess/Network/webrtc/WebMDNSRegister.messages.in:
* WebProcess/Network/webrtc/WebRTCMonitor.cpp:
(WebKit::WebRTCMonitor::startUpdating):
(WebKit::WebRTCMonitor::stopUpdating):
(WebKit::WebRTCMonitor::networksChanged):
(WebKit::WebRTCMonitor::networkProcessCrashed):
* WebProcess/Network/webrtc/WebRTCMonitor.h:
(WebKit::WebRTCMonitor::addObserver):
(WebKit::WebRTCMonitor::removeObserver):
(WebKit::WebRTCMonitor::didReceiveNetworkList const):
(WebKit::WebRTCMonitor::networkList const):
(WebKit::WebRTCMonitor::ipv4 const):
(WebKit::WebRTCMonitor::ipv6 const):
2021-09-05 Simon Fraser <simon.fraser@apple.com>
Use a strongly typed identifier for authentication challenge IDs
https://bugs.webkit.org/show_bug.cgi?id=229890
Reviewed by Anders Carlsson.
Add AuthenticationChallengeIdentifier and use it to replace uint64_t values that
represent authentication challenge identifiers.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::addChallengeToChallengeMap):
(WebKit::AuthenticationManager::shouldCoalesceChallenge const):
(WebKit::AuthenticationManager::coalesceChallengesMatching const):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
(WebKit::AuthenticationManager::completeAuthenticationChallenge):
(WebKit::generateAuthenticationChallengeID): Deleted.
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/AuthenticationManager.messages.in:
* Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::initializeConnection):
* Shared/IdentifierTypes.h:
* UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
(WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
* UIProcess/Authentication/AuthenticationChallengeProxy.h:
(WebKit::AuthenticationChallengeProxy::create):
* UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
(WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Downloads/DownloadProxy.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
2021-09-03 Stephan Szabo <stephan.szabo@sony.com>
Fix for debug mode on MSVC after r281998
https://bugs.webkit.org/show_bug.cgi?id=229894
Unreviewed build fix for wincairo debug.
No new tests, build fix only.
Pull the #if out from inside the ASSERT.
* NetworkProcess/NetworkResourceLoader.cpp:
2021-09-03 Kate Cheney <katherine_cheney@apple.com>
Safari’s Privacy Report window is completely blank
https://bugs.webkit.org/show_bug.cgi?id=229847
<rdar://problem/80974688>
Reviewed by Chris Dumez.
We should not wait for an IPC reply on a cached web process, because
it will cause long hangs.
In order to test this I added a new SPI to update the
cachedProcessSuspensionDelay (the usual timeout is 30 seconds). I also
moved the initial suspension timer call to be after the responsiveness
check, otherwise the cached process will be resumed very soon.
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _setCachedProcessSuspensionDelayForTesting:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::setCachedProcessSuspensionDelayForTesting):
(WebKit::WebProcessCache::addProcess):
(WebKit::WebProcessCache::CachedProcess::CachedProcess):
(WebKit::WebProcessCache::CachedProcess::startSuspensionTimer):
* UIProcess/WebProcessCache.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::sendResourceLoadStatisticsDataImmediately):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setCachedProcessSuspensionDelayForTesting):
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-09-03 Alex Christensen <achristensen@webkit.org>
Simplify PCM::Client interface
https://bugs.webkit.org/show_bug.cgi?id=229887
Reviewed by Kate Cheney.
NetworkLoadParameters is a heavy object to have on an interface like this.
We really only need a URL, a RefPtr<JSON::Object> from which the HTTP method can be inferred
from whether it's null or not, and PcmDataCarried to give to processPCMRequest.
The NetworkLoadParameters generation is only needed in a networking implementation that uses NetworkSession,
so I moved it to PrivateClickMeasurementNetworkLoader::start.
I moved the debugModeEnabled calls to the callers of loadFromNetwork to simplify the interface and to
keep the responsibility for that in PrivateClickMeasurementManager instead of the loadFromNetwork function,
which should be simple and just take what it gets and give it to the network.
No change in behavior. Just moving things around.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp:
(WebKit::PCM::ClientImpl::loadFromNetwork):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
(WebKit::generateNetworkLoadParameters): Deleted.
(WebKit::generateNetworkLoadParametersForHttpPost): Deleted.
(WebKit::generateNetworkLoadParametersForHttpGet): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::generateNetworkLoadParameters):
(WebKit::PrivateClickMeasurementNetworkLoader::start):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h:
2021-09-03 Devin Rousso <drousso@apple.com>
[Web App Manifest] Always fetch the first manifest if provided
https://bugs.webkit.org/show_bug.cgi?id=229059
<rdar://problem/82148333>
Reviewed by Brent Fulgham.
Before this patch, WebKit only fetched/parsed/applied/etc. the web app manifest when
`-[WKWebView _getApplicationManifestWithCompletionHandler:]` was called. This patch makes
WebKit do all that as soon as a `<link rel="manifest">` (with a valid URL) is encountered.
This allows manifests that have specified a `"theme_color"` to actually have an effect.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::finishedLoadingApplicationManifest): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::~WebPage):
(WebKit::WebPage::getApplicationManifest):
(WebKit::WebPage::didFinishLoadingApplicationManifest):
Simplify the way that the UIProcess communicates with the WebProcess (and between WebKit and
WebCore). There's no need to have a `HashMap` of callbacks since each document can only have
at most one web app manifest. Furthermore, instead of having a `HashMap` in both WebKit and
WebCore, just pass along the `CompletionHandler` to the `DocumentLoader` for a single list
of completion callbacks (a list is needed because it's possible for a client to invoke
`-[WKWebView _getApplicationManifestWithCompletionHandler:]` multiple times).
2021-09-03 Per Arne <pvollan@apple.com>
[GPUP] Temporarily allow access to power logging service
https://bugs.webkit.org/show_bug.cgi?id=229878
<rdar://82441564>
Reviewed by Brent Fulgham.
Temporarily allow access to power logging service in GPUP on macOS.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
2021-09-03 Chris Dumez <cdumez@apple.com>
Fix race in RemoteRenderingBackend::allowsExitUnderMemoryPressure()
https://bugs.webkit.org/show_bug.cgi?id=229870
<rdar://82459484>
Reviewed by David Kilzer.
RemoteRenderingBackend::m_remoteResourceCache should only be used safely from RemoteRenderingBackend's work queue.
RemoteRenderingBackend::allowsExitUnderMemoryPressure() gets called on the main thread so we need to make sure we
dispatch to RemoteRenderingBackend's work queue before accessing m_remoteResourceCache.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::allowsExitUnderMemoryPressure const):
2021-09-03 Alex Christensen <achristensen@webkit.org>
Clean up PrivateClickMeasurementManager interface
https://bugs.webkit.org/show_bug.cgi?id=229840
Reviewed by Kate Cheney.
Notably, PrivateClickMeasurementManager::store is now private, which makes it possible to use
the interface and have the store in a different process.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::simulateResourceLoadStatisticsSessionRestart):
(WebKit::NetworkProcess::firePrivateClickMeasurementTimerImmediately): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::~NetworkSession):
(WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediatelyForTesting):
(WebKit::NetworkSession::firePrivateClickMeasurementTimerImmediately): Deleted.
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::~PrivateClickMeasurementManager):
(WebKit::PrivateClickMeasurementManager::migratePrivateClickMeasurementFromLegacyStorage):
(WebKit::PrivateClickMeasurementManager::startTimerImmediatelyForTesting):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h:
2021-09-03 Jer Noble <jer.noble@apple.com>
Buffer large media XHRs in the NetworkProcess to reduce IPC overhead
https://bugs.webkit.org/show_bug.cgi?id=229813
<rdar://82406803>
Reviewed by Alex Christensen.
When playing back media through MSE, a significant amount of CPU time is spent sending
small chunks of loaded media across the XPC boundary, on the order of 16kb at a time out
of a 1-3MB resource. This large number of small XPC messages, each with a fixed cost, causes
a relatively large CPU overhead. Media loaded directly through a HTMLMediaElement already
is coalesced in the NetworkProcess on a 50ms timer.
Buffer all loads of large media resources, performed over fetch() or XHR, when those resources
have an expected length of more than 1MB, by coalescing them on the same 50ms timer as we use
for HTMLMediaElement-generated loads.
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveResponse):
* NetworkProcess/NetworkResourceLoader.h:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::maximumBufferingTime):
* WebProcess/Network/WebLoaderStrategy.h:
2021-09-03 Stephan Szabo <stephan.szabo@sony.com>
Fix for debug mode with ENABLE_SERVICE_WORKER=OFF after r281706
https://bugs.webkit.org/show_bug.cgi?id=229845
Reviewed by Alex Christensen.
Put m_serviceWorkerFetchTask check into #if.
No new tests, is a build fix for having service workers off.
* NetworkProcess/NetworkResourceLoader.cpp:
2021-09-03 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] editing/caret/ios/caret-in-overflow-area.html is failing
https://bugs.webkit.org/show_bug.cgi?id=229830
rdar://82190832
Reviewed by Tim Horton.
See Tools/ChangeLog for more details.
* Platform/spi/ios/TextInputSPI.h:
2021-09-03 David Kilzer <ddkilzer@apple.com>
RemoteVideoSample needs CVPixelBufferRef to be kept alive, but relies on caller to retain it
<https://webkit.org/b/229806>
<rdar://problem/82684479>
Reviewed by Darin Adler.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::encodeFrame):
- Pass converted CVPixelBufferRef to
RemoteVideoSample::create(). A similar change in an earlier
patch for Bug 229661 caused test failures.
2021-09-03 Youenn Fablet <youenn@apple.com>
Enable WebRTC relay for SafariViewController
https://bugs.webkit.org/show_bug.cgi?id=229768
Reviewed by Eric Carlson.
Use source application bundle identifier instead of attributed bundle identifier for nw_parameters_set_source_application_by_bundle_id.
Use attributed bundle identifier for nw_parameters_set_attributed_bundle_identifier.
Make sure to not set token data in case application bundle identifier is available.
This allows the OS to decide whether to relay the nw_connections or not.
Introduce a helper routine to share more code between UDP and TCP sockets.
Manually tested as testing relay would require non-localhost connections
and an application bundle identifier that would be known by the OS.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::NetworkRTCProvider):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
(WebKit::NetworkRTCProvider::applicationBundleIdentifier const):
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
* NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h: Added.
* NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.mm: Added.
(WebKit::setNWParametersApplicationIdentifiers):
* Platform/spi/Cocoa/NWParametersSPI.h:
* WebKit.xcodeproj/project.pbxproj:
2021-09-03 Said Abou-Hallawa <said@apple.com>
Add a layout test to detect memory leaks when drawing images to a detached canvas
https://bugs.webkit.org/show_bug.cgi?id=229790
Reviewed by Darin Adler.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
(WebKit::RemoteResourceCacheProxy::imagesCount const):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::remoteImagesCountForTesting const):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::remoteImagesCountForTesting const):
* WebProcess/WebPage/WebPage.h:
2021-09-02 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r280767): Caret color is black after pasting rich text in Mail compose in dark mode
https://bugs.webkit.org/show_bug.cgi?id=229808
rdar://82600990
Reviewed by Tim Horton.
Partially revert one of the changes in r280767 that makes caret-color follow the immediate container node of the
selection caret, rather than the focused element (which it previously used). This was effectively a drive-by fix
for a FIXME about allowing `caret-color` to match child containers inside the root editable container element.
While this matches behavior on macOS, this change also causes the caret color to become black when pasting rich
text copied in dark mode, since we write `caret-color: rgb(0, 0, 0);` to the pasteboard when copying the editing
style for rich text.
In the short term, we should restore old (pre-r280767) `caret-color` on iOS; in the slightly longer term, I've
filed bug #229809 to track unifying macOS and iOS caret-color behavior, with respect to nested editable
container nodes.
To retain the fix for rdar://81674787 without exhibiting the above bug, we use the selection's root editable
container (rather than `m_focusedElement`, which was used prior to r280767).
Test: editing/caret/ios/caret-color-in-nested-editable-containers.html
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
Also adjust this logic so that we only attempt the tree-walk to find the root editable element if the selection
has editable style.
2021-09-02 Alex Christensen <achristensen@webkit.org>
Gracefully recover from WebAuthnProcess crashes
https://bugs.webkit.org/show_bug.cgi?id=229828
<rdar://82682650>
Reviewed by Chris Dumez.
When a WebAuthn process closes, it can't be connected with again, which causes persistent web process "crashes".
Let's start a new process when this happens instead.
* UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _webAuthnProcessIdentifier]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
* UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
(WebKit::sharedProcess):
(WebKit::WebAuthnProcessProxy::singleton):
(WebKit::WebAuthnProcessProxy::webAuthnProcessCrashed):
2021-09-02 Chris Dumez <cdumez@apple.com>
[ BigSur arm64 Debug EWS ] ASSERTION FAILED: m_uncommittedState.state == State::Provisional
https://bugs.webkit.org/show_bug.cgi?id=229769
<rdar://problem/82645706>
Reviewed by Alex Christensen.
I am unable to reproduce the crash but we know that we're crashing when committing the load
after a process-swap, because the WebPageProxy doesn't know that a provisional load is going
on. One possible explanation for this, and the most likely one is that the WebPageProxy got
a DidFailProvisionalLoadForFrame IPC from the current process while the provisional load is
proceeding in the new provisional process. We had logic in WebPageProxy::didFailProvisionalLoadForFrame()
to try and discard such IPC but the check was relying on the navigationID and was therefore
fragile. I updated the check in didFailProvisionalLoadForFrame() to ignore all
DidFailProvisionalLoadForFrame IPCs for the main frame from the current process when there
is a ProvisionalPageProxy, without relying on the navigationID. This should be more robust
and will hopefully fix this flaky crash.
No new tests, unskipped existing tests.
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
* UIProcess/WebPageProxy.h:
2021-09-02 Alex Christensen <achristensen@webkit.org>
Move PrivateClickMeasurementManager and PrivateClickMeasurementNetworkLoader into PrivateClickMeasurement directory
https://bugs.webkit.org/show_bug.cgi?id=229835
Reviewed by Tim Horton.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp.
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.h.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.cpp: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurementNetworkLoader.cpp.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementNetworkLoader.h: Renamed from Source/WebKit/NetworkProcess/PrivateClickMeasurementNetworkLoader.h.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-09-02 Per Arne <pvollan@apple.com>
[iOS] Gather logs for IOKit class
https://bugs.webkit.org/show_bug.cgi?id=228784
Reviewed by Brent Fulgham.
Add telemetry for an IOKit class on iOS.
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-09-02 Aditya Keerthi <akeerthi@apple.com>
[iOS] Simplify date picker logic for datetime-local inputs
https://bugs.webkit.org/show_bug.cgi?id=229773
Reviewed by Darin Adler.
Currently, the date picker logic for getting/setting the value of a
datetime-local input relies on the numeric value of input. This
logic differs from logic for date, time, and month inputs, where we use
the string value of the input. This patch simplifies the code by using
string values for all the date/time input types.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
* UIProcess/ios/WebPageProxyIOS.mm:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker initWithView:datePickerMode:]):
Set the format string for datetime-local inputs, matching the spec.
(-[WKDateTimePicker _sanitizeInputValueForFormatter:]):
Sanitize datetime-local values to remove seconds and milliseconds
information. UIKit does not support anything beyond minute granularity.
(-[WKDateTimePicker dateFormatterForPicker]):
(-[WKDateTimePicker _dateChanged]):
Always use setValueAsString, matching the other date/time inputs.
Time zone conversion before sending the date back to the web process
is no longer needed.
(-[WKDateTimePicker setDateTimePickerToInitialValue]):
Time zone conversion when retrieving the date from the web process is no
longer needed.
(-[WKDateTimePicker controlBeginEditing]):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
2021-09-02 Peng Liu <peng.liu6@apple.com>
[MSE][GPUP] SourceBufferPrivateAVFObjC does not work properly when audio and video exchange their track IDs
https://bugs.webkit.org/show_bug.cgi?id=229617
Reviewed by Jer Noble.
Fix the bug in updating the hash map by creating a new one instead of
updating the hash map in-place.
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::updateTrackIds):
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegment):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:
2021-09-02 Alex Christensen <achristensen@webkit.org>
Introduce PCM::Client for PrivateClickMeasurementManager
https://bugs.webkit.org/show_bug.cgi?id=229789
Reviewed by Kate Cheney.
This makes it so that PrivateClickMeasurementManager can run in environments other than the NetworkProcess.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClient.h: Added.
(WebKit::PCM::Client::~Client):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.cpp: Added.
(WebKit::PCM::ClientImpl::ClientImpl):
(WebKit::PCM::ClientImpl::loadFromNetwork):
(WebKit::PCM::ClientImpl::broadcastConsoleMessage):
(WebKit::PCM::ClientImpl::featureEnabled const):
(WebKit::PCM::ClientImpl::debugModeEnabled const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementClientImpl.h: Added.
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::handleAttribution):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl):
(WebKit::PrivateClickMeasurementManager::featureEnabled const):
(WebKit::PrivateClickMeasurementManager::debugModeEnabled const):
* NetworkProcess/PrivateClickMeasurementManager.h:
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-09-02 Chris Dumez <cdumez@apple.com>
[COOP] Cross origin isolation doesn't happen when going from an HTTP URL to a HTTPS one with COOP+COEP
https://bugs.webkit.org/show_bug.cgi?id=229745
<rdar://problem/82630927>
Reviewed by Alex Christensen.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::processResponse):
2021-09-02 Tim Nguyen <ntim@apple.com>
Add more inert checks for selection-related functionality
https://bugs.webkit.org/show_bug.cgi?id=229728
Reviewed by Antti Koivisto.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::selectionPositionInformation):
2021-09-01 Alex Christensen <achristensen@webkit.org>
Move PCM::Store ownership from WebResourceLoadStatisticsStore to PrivateClickMeasurementManager
https://bugs.webkit.org/show_bug.cgi?id=229770
Reviewed by Kate Cheney.
Now that PrivateClickMeasurement storage is separate from ResourceLoadStatistics storage, they don't need to know about each other.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::create):
(WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
(WebKit::pcmStoreDirectory): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::pcmStoreDirectory):
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::~NetworkSession):
(WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
(WebKit::NetworkSession::recreateResourceLoadStatisticStore):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::privateClickMeasurementToStringForTesting const):
(WebKit::PCM::Database::attributionToStringForTesting const):
(WebKit::PCM::Database::privateClickMeasurementToStringForTesting): Deleted.
(WebKit::PCM::Database::attributionToStringForTesting): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp:
(WebKit::PCM::Store::postTask const):
(WebKit::PCM::Store::postTaskReply const):
(WebKit::PCM::Store::privateClickMeasurementToStringForTesting const):
(WebKit::PCM::Store::postTask): Deleted.
(WebKit::PCM::Store::postTaskReply): Deleted.
(WebKit::PCM::Store::privateClickMeasurementToStringForTesting): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h:
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::PrivateClickMeasurementManager):
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::clearSentAttribution):
(WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
(WebKit::PrivateClickMeasurementManager::clear):
(WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain):
(WebKit::PrivateClickMeasurementManager::clearExpired):
(WebKit::PrivateClickMeasurementManager::toStringForTesting const):
(WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting):
(WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
* NetworkProcess/PrivateClickMeasurementManager.h:
(WebKit::PrivateClickMeasurementManager::store):
(WebKit::PrivateClickMeasurementManager::store const):
2021-09-01 Alex Christensen <achristensen@webkit.org>
Remove _statisticsDatabaseColumnsForTable and related unused test functions
https://bugs.webkit.org/show_bug.cgi?id=229771
Reviewed by Kate Cheney.
This removes some code that was used for tests until r281779
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::columnsForTable): Deleted.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::statisticsDatabaseColumnsForTable): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::statisticsDatabaseColumnsForTable): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _statisticsDatabaseColumnsForTable:completionHandler:]): Deleted.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::statisticsDatabaseColumnsForTable): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::statisticsDatabaseColumnsForTable): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.h:
2021-09-01 David Kilzer <ddkilzer@apple.com>
[WebRTC] Leak or over-release of CFPixelBufferRef returned from webrtc::createPixelBufferFromFrame()
<https://webkit.org/b/229661>
<rdar://problem/82507827>
Reviewed by Eric Carlson.
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::encodeFrame):
- Use adoptCF() to prevent a leak since
webrtc::createPixelBufferFromFrame() always returns a +1
retained CVPixelBufferRef now.
- Change the functor to return a +1 retained CVPixelBufferRef.
- Reuse `pixelBuffer` to store the converted CVPixelBufferRef
since this object needs to be kept alive until after the
send() method is called.
2021-09-01 Chris Dumez <cdumez@apple.com>
Add support for ServiceWorkerGlobalScope.serviceWorker
https://bugs.webkit.org/show_bug.cgi?id=229720
Reviewed by Youenn Fablet.
Add support for ServiceWorkerGlobalScope.serviceWorker:
- https://w3c.github.io/ServiceWorker/#dom-serviceworkerglobalscope-serviceworker
Also add support for the "parsed" initial ServiceWorkerState:
- https://w3c.github.io/ServiceWorker/#enumdef-serviceworkerstate
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
* NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:
2021-09-01 Tomoki Imai <Tomoki.Imai@sony.com>
[CoordinatedGraphics] Schedule rendering after setLayerTreeStateIsFrozen(false) in non-AC mode
https://bugs.webkit.org/show_bug.cgi?id=229749
We should schedule another rendering when the setLayerTreeStateIsFrozen(false) is called.
In some rare cases, the browser only shows the white page after the page transition,
because the rendering is skipped while the layer tree is frozen and there was no guarantee that there is
another rendering after setLayerTreeStateIsFrozen(false).
Reviewed by Carlos Garcia Campos.
Tested by manual.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::setLayerTreeStateIsFrozen): Schedule another rendering when the layer tree becomes unfrozen.
2021-08-31 Lauro Moura <lmoura@igalia.com>
Non-unified build partial fixes, late late August 2021
https://bugs.webkit.org/show_bug.cgi?id=229741
Unreviewed non-unified build fixes.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
Add missing header.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
Add missing header.
(WebKit::PCM::Database::attributePrivateClickMeasurement): Namespace
some names.
(WebKit::PCM::Database::removeUnattributed): Ditto.
(WebKit::PCM::Database::clearPrivateClickMeasurement): Ditto.
(WebKit::PCM::Database::clearSentAttribution): Ditto.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
Add missing header.
2021-08-31 Chris Dumez <cdumez@apple.com>
Enable SharedArrayBuffer support when COOP/COEP headers are used
https://bugs.webkit.org/show_bug.cgi?id=229559
<rdar://problem/82391945>
Reviewed by Alex Christensen.
Make sure window.crossOriginIsolated returns true when COOP=same-origin and
COEP=require-corp are used. Also make sure that cross-origin-isolates pages
are allowed to use SharedArrayBuffer.
When the WebProcess determines it needs to switch browsing context group it
now sends a NeedsBrowsingContextGroupSwitch::YesWithoutCrossOriginIsolation /
NeedsBrowsingContextGroupSwitch::YesWithCrossOriginIsolation enum value to
the UIProcess with the DecidePolicyForResponse IPC instead of a simple
boolean. We send YesWithoutCrossOriginIsolation when the navigation
destination will be cross-origin-isolated due to COOP=same-origin and
COEP=require-corp. In the UIProcess, when YesWithCrossOriginIsolation is
received, we take care of launching a fresh WebProcess (never recycling an
existing WebProcess) and we make this WebProcess as cross-origin-isolated.
When a process is cross-origin-isolated, we pass it a XPC flag on launch
to allow the process to use SharedArrayBuffer. We use an XPC flag because
JSC Options need to be set before JSC::initialize() is called, which occurs
during XPC service initialization. When a WebProcess is marked as
cross-origin-isolated, we make sure to never cache it so it cannot be
recycled for a new navigation (given that it has special permission to use
SharedArrayBuffer).
* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* UIProcess/Launcher/ProcessLauncher.h:
(WebKit::ProcessLauncher::Client::shouldEnableSharedArrayBuffer const):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::findReusableSuspendedPageProcess):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::createWebPage):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::create):
(WebKit::WebProcessProxy::createForServiceWorkers):
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::canBeAddedToWebProcessCache const):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::isCrossOriginIsolated const):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2021-08-31 Kate Cheney <katherine_cheney@apple.com>
Use after move in ServiceWorkerThreadProxy
https://bugs.webkit.org/show_bug.cgi?id=229731
Reviewed by Chris Dumez.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
2021-08-31 Aditya Keerthi <akeerthi@apple.com>
[iOS] Move the implementation of -[WKWebView _dynamicUserInterfaceTraitDidChange] out of the testing category
https://bugs.webkit.org/show_bug.cgi?id=229735
Reviewed by Tim Horton.
r253465 incorrectly moved -[WKWebView _dynamicUserInterfaceTraitDidChange]
into the WKTestingIOS category. _dynamicUserInterfaceTraitDidChange is used
to respond to trait collection changes that affect dynamic colors, and is
not a testing only method. Consequently, the method should be implemented
in the WKViewInternalIOS category.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _dynamicUserInterfaceTraitDidChange]):
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
2021-08-31 Sihui Liu <sihui_liu@apple.com>
REGRESSION (r281771): ASSERTION FAILED: !m_deletionHasBegun under WebCore::Permissions::~Permissions()
https://bugs.webkit.org/show_bug.cgi?id=229714
<rdar://problem/82581552>
Reviewed by Chris Dumez.
* WebProcess/WebCoreSupport/WebPermissionController.cpp:
(WebKit::WebPermissionController::create):
* WebProcess/WebCoreSupport/WebPermissionController.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
2021-08-31 Kate Cheney <katherine_cheney@apple.com>
Loads after session restore marked app initiated in Safari
https://bugs.webkit.org/show_bug.cgi?id=229721
<rdar://problem/82084236>
Reviewed by Brent Fulgham.
Offer a way to set the app initiated value when restoring a session.
* Shared/SessionState.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _restoreSessionState:andNavigate:]):
* UIProcess/API/Cocoa/_WKSessionState.h:
* UIProcess/API/Cocoa/_WKSessionState.mm:
(-[_WKSessionState _sessionStateWithAppInitiatedValue]):
* UIProcess/API/Cocoa/_WKSessionStateInternal.h:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcessForReload):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::restoreFromSessionState):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::goToBackForwardItem):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-31 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Assertion in startObservingCookieChanges()
https://bugs.webkit.org/show_bug.cgi?id=229708
Reviewed by Philippe Normand.
Do not observe cookies changes unconditionally on session creation/destruction.
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):
(WebKit::NetworkSessionSoup::~NetworkSessionSoup):
2021-08-31 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Drawing system fallback fonts to canvas causes a crash
https://bugs.webkit.org/show_bug.cgi?id=229633
<rdar://problem/81889036>
Reviewed by Wenson Hsieh.
Dot-prefixed font names don't survive the round-trip through
CTFontDescriptorCopyAttributes(CTFontCopyFontDescriptor(font)) unless you also
pass in the kCTFontOptionsSystemUIFont option.
Tests: fast/text/system-fallback-canvas.html
fast/text/draw-synthetic-system-bold-font-into-canvas.html
* Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::createCTFont):
(IPC::ArgumentCoder<Ref<WebCore::Font>>::decodePlatformData):
2021-08-26 Darin Adler <darin@apple.com>
Cut down on use of CFGetTypeID, using dynamic_cf_cast instead; related streamlining
https://bugs.webkit.org/show_bug.cgi?id=229414
Reviewed by Tim Horton.
* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::getPluginInfoFromPropertyLists): Use dynamic_cf_cast.
(WebKit::NetscapePluginModule::getPluginInfo): Ditto.
2021-08-30 Alex Christensen <achristensen@webkit.org>
Remove unused OptionalCallbackID
https://bugs.webkit.org/show_bug.cgi?id=229359
Reviewed by Sam Weinig.
* NetworkProcess/NetworkProcess.h:
* Shared/CallbackID.h:
* Shared/OptionalCallbackID.h: Removed.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebCookieManagerProxy.cpp:
* UIProcess/WebPageProxy.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/FindController.cpp:
* WebProcess/WebPage/WebPage.h:
2021-08-30 Alex Christensen <achristensen@webkit.org>
Update availability macros for APIs available in iOS 14.5 and macOS 11.3
https://bugs.webkit.org/show_bug.cgi?id=229466
Reviewed by Chris Dumez.
We mistakenly updated them to 15.0/12.0
* UIProcess/API/Cocoa/WKDownload.h:
* UIProcess/API/Cocoa/WKDownloadDelegate.h:
* UIProcess/API/Cocoa/WKNavigationAction.h:
* UIProcess/API/Cocoa/WKNavigationDelegate.h:
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2021-08-30 Alex Christensen <achristensen@webkit.org>
Migrate PrivateClickMeasurements from ResourceLoadStatistics database to new database
https://bugs.webkit.org/show_bug.cgi?id=229646
Reviewed by Kate Cheney.
In r281721 I moved the PCM database to be separate from the ResourceLoadStatistics database.
This patch extracts data from the old database and sends it to the new database.
I added some tests that create databases in each of the 3 historical schemas then verify that
data is successfully migrated to the new database.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::checkForMissingTablesInSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::tableExists):
(WebKit::ResourceLoadStatisticsDatabaseStore::deleteTable):
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::buildPrivateClickMeasurementFromDatabase):
* NetworkProcess/DatabaseUtilities.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp:
(WebKit::PCM::Database::insertPrivateClickMeasurement):
(WebKit::PCM::Database::findPrivateClickMeasurement):
(WebKit::PCM::Database::allAttributedPrivateClickMeasurement):
(WebKit::PCM::Database::getDomainStringFromDomainID const):
(WebKit::PCM::Database::buildPrivateClickMeasurementFromDatabase): Deleted.
(WebKit::PCM::Database::getDomainStringFromDomainID): Deleted.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h:
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _dumpPrivateClickMeasurement:]):
2021-08-30 Alex Christensen <achristensen@webkit.org>
WKWebViewConfiguration._loadsSubresources=NO should prevent preconnecting
https://bugs.webkit.org/show_bug.cgi?id=229684
Reviewed by Tim Horton.
This is like bug 228044 and even uses the same test setup.
This should fix rdar://79307070
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::preconnectTo):
2021-08-30 Sihui Liu <sihui_liu@apple.com>
Add stubs for Permissions API
https://bugs.webkit.org/show_bug.cgi?id=229339
<rdar://problem/82442205>
Reviewed by Chris Dumez.
Set up basic infrastructure of permission getting and setting.
* Sources.txt:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestPermission):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebPermissionController.cpp: Added.
(WebKit::WebPermissionController::WebPermissionController):
(WebKit::WebPermissionController::query):
(WebKit::WebPermissionController::request):
(WebKit::WebPermissionController::queryCache):
(WebKit::WebPermissionController::updateCache):
(WebKit::WebPermissionController::tryProcessingRequest):
(WebKit::WebPermissionController::addObserver):
(WebKit::WebPermissionController::removeObserver):
(WebKit::WebPermissionController::permissionChanged):
* WebProcess/WebCoreSupport/WebPermissionController.h: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
* WebProcess/WebPage/mac/DisplayRefreshMonitorMac.h:
2021-08-29 Fujii Hironori <Hironori.Fujii@sony.com>
REGRESSION(r281102): ASSERTION FAILED: !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate
https://bugs.webkit.org/show_bug.cgi?id=229228
Reviewed by Carlos Garcia Campos.
WinCairo WK2 layout tests were observing an assertion failure for
some animations tests since r281102.
DrawingAreaProxyCoordinatedGraphics::incorporateUpdate has an
assertion ensuring a DrawingAreaProxy::Update message isn't sent
during the compositing mode. However,
DrawingAreaCoordinatedGraphics sent a Update message before
sending ExitAcceleratedCompositingMode message in the following
scenario.
1. DrawingAreaCoordinatedGraphics::exitAcceleratedCompositingMode calls DrawingAreaCoordinatedGraphics::display(WebKit::UpdateInfo&)
2. It calls WebPage::updateRendering()
3. It executes JavaScript
4. It calls notifyDone
5. It calls WTR::TestRunner::notifyDone which calls WKBundlePageForceRepaint
6. It calls DrawingAreaCoordinatedGraphics::display() which dispatches the Update message
Send an ExitAcceleratedCompositingMode message instead of an
Update message if ExitAcceleratedCompositingMode isn't sent yet in
display().
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::forceRepaint):
(WebKit::DrawingAreaCoordinatedGraphics::display):
2021-08-29 Joonghun Park <jh718.park@samsung.com>
Unreviewed. Remove the build warning below since r281096.
No new tests, no new behavioral changes.
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::stateString const):
2021-08-28 Cameron McCormack <heycam@apple.com>
Miscellaneous typo fixes
https://bugs.webkit.org/show_bug.cgi?id=229642
Reviewed by Fujii Hironori.
* Platform/IPC/HandleMessage.h:
(IPC::callMemberFunction):
* Shared/Cocoa/ArgumentCodersCocoa.mm:
(IPC::encodeArrayInternal):
* Shared/cf/ArgumentCodersCF.cpp:
(IPC::ArgumentCoder<CFArrayRef>::encode):
2021-08-27 Cameron McCormack <heycam@apple.com>
Fix std::optional<> stripping in MessageArgumentDescriptions.cpp generator
https://bugs.webkit.org/show_bug.cgi?id=229636
<rdar://problem/82461615>
Reviewed by Darin Adler.
* Scripts/webkit/messages.py:
(generate_js_argument_descriptions):
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::messageReplyArgumentDescriptions):
2021-08-27 Simon Fraser <simon.fraser@apple.com>
Address post-landing feedback on r281728.
Move a line inside the #ifdef.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformWillPerformEditingCommand):
2021-08-27 Simon Fraser <simon.fraser@apple.com>
Define ENABLE_CONTENT_CHANGE_OBSERVER for IOS_FAMILY and use it to wrap content observation code
https://bugs.webkit.org/show_bug.cgi?id=229624
Reviewed by Alan Bujtas.
Deploy ENABLE(CONTENT_CHANGE_OBSERVER).
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformWillPerformEditingCommand):
2021-08-27 Alex Christensen <achristensen@webkit.org>
Add UIEventAttribution SPI that uses PrivateClickMeasurementAttributionEphemeral::Yes
https://bugs.webkit.org/show_bug.cgi?id=229623
Reviewed by John Wilander.
This will be used by rdar://80806283.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setEphemeralUIEventAttribution:]):
(-[WKWebView _ephemeralUIEventAttribution]):
2021-08-27 Alex Christensen <achristensen@webkit.org>
Separate PrivateClickMeasurement database from ResourceLoadStatistics database and add SPI to set its location
https://bugs.webkit.org/show_bug.cgi?id=229527
Reviewed by Kate Cheney.
This will be used by rdar://80806283
In order to do this, I moved common code to DatabaseUtilities and moved the PCM logic from ResourceLoadStatisticsDatabaseStore
to a new class. It puts the data in a different file in the same directory unless SPI tells it to put it in a different directory.
The biggest functional change I needed to do was to make a PCMObservedDomains table in the new DB instead of an ObservedDomains table,
which contained more information than I needed. I need just an index and a list of domains.
Another slight implementation change is that instead of checking isEphemeral in WebResourceLoadStatisticsStore, I just pass an empty
String to the Store if it's ephemeral, which causes no DB to be created, which causes equivalent behavior.
I also moved the debug message broadcasting to PrivateClickMeasurementManager::attribute in order to make the Database object not
need to know about the NetworkProcess and not need to keep state of whether debug mode is enabled. Database::attributePrivateClickMeasurement
now returns a DebugInfo object and PrivateClickMeasurementManager::attribute checks whether debug mode is enabled and broadcasts the messages.
I added a few calls to PrivateClickMeasurement::isolatedCopy when moving an PrivateClickMeasurement object to another thread.
I added a CompletionHandler to clearPrivateClickMeasurement and clearPrivateClickMeasurementForRegistrableDomain
so that clearing website data doesn't say it's done until it's done.
An even smaller change is I added a "ForTesting" suffix on some function names of functions that are only used in tests.
The rest of this patch just moves code from one location to another.
I still need to implement migrating data from the old DB to the new DB. I'll do that in another patch soon.
* CMakeLists.txt:
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::expectedTableAndIndexQueries):
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::openITPDatabase):
(WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedSchema):
(WebKit::insertDistinctValuesInTableStatement):
(WebKit::ResourceLoadStatisticsDatabaseStore::openAndUpdateSchemaIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::interruptAllDatabases):
(WebKit::ResourceLoadStatisticsDatabaseStore::createUniqueIndices):
(WebKit::ResourceLoadStatisticsDatabaseStore::createSchema):
(WebKit::ResourceLoadStatisticsDatabaseStore::destroyStatements):
(WebKit::ResourceLoadStatisticsDatabaseStore::clearDatabaseContents):
(WebKit::expectedUnattributedColumns): Deleted.
(WebKit::expectedAttributedColumns): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::close): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::enableForeignKeys): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::needsUpdatedPrivateClickMeasurementSchema): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsToTable): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::addMissingColumnsIfNecessary): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnInTable): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::renameColumnsIfNecessary): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::scopedStatement const): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::interrupt): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::buildPrivateClickMeasurementFromDatabase): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::findPrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::insertPrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::removeUnattributed): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributePrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::allAttributedPrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::clearPrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::clearExpiredPrivateClickMeasurement): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::attributionToString): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::privateClickMeasurementToString): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::earliestTimesToSend): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToSource): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::markReportAsSentToDestination): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::clearSentAttribution): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Deleted.
(WebKit::ResourceLoadStatisticsDatabaseStore::beginTransactionIfNecessary): Deleted.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::pcmStoreDirectory):
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::create):
(WebKit::WebResourceLoadStatisticsStore::didDestroyNetworkSession):
(WebKit::WebResourceLoadStatisticsStore::suspend):
(WebKit::WebResourceLoadStatisticsStore::insertPrivateClickMeasurement): Deleted.
(WebKit::WebResourceLoadStatisticsStore::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting): Deleted.
(WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement): Deleted.
(WebKit::WebResourceLoadStatisticsStore::allAttributedPrivateClickMeasurement): Deleted.
(WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurement): Deleted.
(WebKit::WebResourceLoadStatisticsStore::clearPrivateClickMeasurementForRegistrableDomain): Deleted.
(WebKit::WebResourceLoadStatisticsStore::clearExpiredPrivateClickMeasurement): Deleted.
(WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString): Deleted.
(WebKit::WebResourceLoadStatisticsStore::clearSentAttribution): Deleted.
(WebKit::WebResourceLoadStatisticsStore::markAttributedPrivateClickMeasurementsAsExpiredForTesting): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/DatabaseUtilities.cpp: Added.
(WebKit::DatabaseUtilities::DatabaseUtilities):
(WebKit::DatabaseUtilities::~DatabaseUtilities):
(WebKit::DatabaseUtilities::scopedStatement const):
(WebKit::DatabaseUtilities::beginTransactionIfNecessary):
(WebKit::DatabaseUtilities::openDatabaseAndCreateSchemaIfNecessary):
(WebKit::DatabaseUtilities::enableForeignKeys):
(WebKit::DatabaseUtilities::close):
(WebKit::DatabaseUtilities::interrupt):
* NetworkProcess/DatabaseUtilities.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
(WebKit::NetworkProcess::clearPrivateClickMeasurement):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
(WebKit::NetworkSession::recreateResourceLoadStatisticStore):
(WebKit::NetworkSession::dumpPrivateClickMeasurement):
(WebKit::NetworkSession::clearPrivateClickMeasurement):
(WebKit::NetworkSession::clearPrivateClickMeasurementForRegistrableDomain):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: Added.
(WebKit::PCM::Database::Database):
(WebKit::PCM::Database::~Database):
(WebKit::PCM::Database::interruptAllDatabases):
(WebKit::PCM::Database::createSchema):
(WebKit::PCM::Database::insertPrivateClickMeasurement):
(WebKit::PCM::Database::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
(WebKit::PCM::Database::findPrivateClickMeasurement):
(WebKit::PCM::Database::attributePrivateClickMeasurement):
(WebKit::PCM::Database::buildPrivateClickMeasurementFromDatabase):
(WebKit::PCM::Database::removeUnattributed):
(WebKit::PCM::Database::allAttributedPrivateClickMeasurement):
(WebKit::PCM::Database::privateClickMeasurementToStringForTesting):
(WebKit::PCM::Database::attributionToStringForTesting):
(WebKit::PCM::Database::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::PCM::Database::clearPrivateClickMeasurement):
(WebKit::PCM::Database::clearExpiredPrivateClickMeasurement):
(WebKit::PCM::Database::clearSentAttribution):
(WebKit::PCM::Database::markReportAsSentToDestination):
(WebKit::PCM::Database::markReportAsSentToSource):
(WebKit::PCM::Database::earliestTimesToSend):
(WebKit::PCM::Database::domainID):
(WebKit::PCM::Database::getDomainStringFromDomainID):
(WebKit::PCM::Database::ensureDomainID):
(WebKit::PCM::Database::destroyStatements):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.h: Added.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDebugInfo.cpp: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
(WebKit::PCM::DebugInfo::isolatedCopy const):
(WebKit::PCM::DebugInfo::Message::isolatedCopy const):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDebugInfo.h: Copied from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp: Added.
(WebKit::PCM::sharedWorkQueue):
(WebKit::PCM::Store::prepareForProcessToSuspend):
(WebKit::PCM::Store::processDidResume):
(WebKit::PCM::Store::Store):
(WebKit::PCM::Store::postTask):
(WebKit::PCM::Store::postTaskReply):
(WebKit::PCM::Store::insertPrivateClickMeasurement):
(WebKit::PCM::Store::markAllUnattributedPrivateClickMeasurementAsExpiredForTesting):
(WebKit::PCM::Store::attributePrivateClickMeasurement):
(WebKit::PCM::Store::privateClickMeasurementToStringForTesting):
(WebKit::PCM::Store::allAttributedPrivateClickMeasurement):
(WebKit::PCM::Store::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::PCM::Store::clearPrivateClickMeasurement):
(WebKit::PCM::Store::clearPrivateClickMeasurementForRegistrableDomain):
(WebKit::PCM::Store::clearExpiredPrivateClickMeasurement):
(WebKit::PCM::Store::clearSentAttribution):
(WebKit::PCM::Store::close):
* NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h: Added.
(WebKit::PCM::Store::create):
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
(WebKit::PrivateClickMeasurementManager::attribute):
(WebKit::PrivateClickMeasurementManager::clearSentAttribution):
(WebKit::PrivateClickMeasurementManager::firePendingAttributionRequests):
(WebKit::PrivateClickMeasurementManager::clear):
(WebKit::PrivateClickMeasurementManager::clearForRegistrableDomain):
(WebKit::PrivateClickMeasurementManager::clearExpired):
(WebKit::PrivateClickMeasurementManager::toStringForTesting const):
(WebKit::PrivateClickMeasurementManager::markAllUnattributedAsExpiredForTesting):
(WebKit::PrivateClickMeasurementManager::markAttributedPrivateClickMeasurementsAsExpiredForTesting):
(WebKit::PrivateClickMeasurementManager::toString const): Deleted.
* NetworkProcess/PrivateClickMeasurementManager.h:
* NetworkProcess/PrivateClickMeasurementNetworkLoader.cpp:
(WebKit::PrivateClickMeasurementNetworkLoader::~PrivateClickMeasurementNetworkLoader):
(WebKit::PrivateClickMeasurementNetworkLoader::cancel):
(WebKit::PrivateClickMeasurementNetworkLoader::willSendRedirectedRequest):
* NetworkProcess/PrivateClickMeasurementNetworkLoader.h:
* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
* NetworkProcess/webrtc/NetworkRTCResolver.h:
* NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
(WebKit::resolvedName):
* Shared/ResourceLoadStatisticsParameters.h:
(WebKit::ResourceLoadStatisticsParameters::encode const):
(WebKit::ResourceLoadStatisticsParameters::decode):
* Sources.txt:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _setNetworkProcessSuspensionAllowedForTesting:]):
(+[WKWebsiteDataStore _preventNetworkProcessSuspensionForTesting]): Deleted.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
* UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
(-[_WKWebsiteDataStoreConfiguration privateClickMeasurementStorageDirectory]):
(-[_WKWebsiteDataStoreConfiguration setPrivateClickMeasurementStorageDirectory:]):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setSuspensionAllowedForTesting):
(WebKit::NetworkProcessProxy::sendPrepareToSuspend):
(WebKit::NetworkProcessProxy::preventSuspensionForTesting): Deleted.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy const):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::privateClickMeasurementStorageDirectory const):
(WebKit::WebsiteDataStoreConfiguration::setPrivateClickMeasurementStorageDirectory):
* WebKit.xcodeproj/project.pbxproj:
2021-08-27 Chris Dumez <cdumez@apple.com>
[WK2] Reuse the same network load when process-swapping on resource response due to COOP
https://bugs.webkit.org/show_bug.cgi?id=229465
<rdar://problem/82307611>
Reviewed by Alex Christensen.
r281516 added support for process-swapping based on Cross-Origin-Opener-Policy header
in HTTP responses. However, on process-swap, we would abort the existing network load
that was started by the original WebProcess and start a fresh network load in the new
WebProcess. This was suboptimal and could lead to issues with resources that provide
one-time behaviors. This patch addresses the issue by transferring the network load
in the network process from the old WebProcess to the new WebProcess when process
swapping.
When the UIProcess decides to process-swap on response policy decision, it first
sends IPC to the network process to ask it to prepare the NetworkResourceLoader
for ownership transfer. The network process takes the NetworkResourceLoader
from its NetworkConnectionToWebProcess and stores it in a temporary cache, then
responds to the UIProcess with the NetworkResourceLoadIdentifier of the loader.
Upon receiving the response, the UIProcess proceeds with the process-swap, it
rejects response processing in the old process and does a loadRequest in a new
WebProcess. When starting sending the LoadRequest IPC to the new WebProcess, it
passes along the NetworkResourceLoadIdentifier of the cached loader in the network
process. When the WebProcess ends up scheduling the load with the network process,
it passes again the NetworkResourceLoadIdentifier. Upon receiving the load request,
the network process checks if a NetworkResourceLoadIdentifier is provided for
continuing a load. If none is provided, we use the regular code path and actually
construct a new NetworkResourceLoader. However, if a NetworkResourceLoadIdentifier
is provided, we take the corresponding NetworkResourceLoader from the cache,
transfer it to the new NetworkConnectionToWebProcess and have it send the
DidReceiveResponse IPC to the WebProcess to continue the load with the new
WebProcess.
Test: http/wpt/cross-origin-opener-policy/single-request-to-server.html
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
(WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::takeNetworkResourceLoader):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::CachedNetworkResourceLoader::CachedNetworkResourceLoader):
(WebKit::NetworkProcess::CachedNetworkResourceLoader::takeLoader):
(WebKit::NetworkProcess::CachedNetworkResourceLoader::expirationTimerFired):
(WebKit::NetworkProcess::takeLoaderAwaitingWebProcessTransfer):
(WebKit::NetworkProcess::prepareLoadForWebProcessTransfer):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::transferToNewWebProcess):
(WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions):
(WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
(WebKit::NetworkResourceLoader::logCookieInformation const):
(WebKit::NetworkResourceLoader::addConsoleMessage):
(WebKit::NetworkResourceLoader::serviceWorkerDidNotHandle):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::sendToClient):
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
* Shared/LoadParameters.cpp:
(WebKit::LoadParameters::encode const):
(WebKit::LoadParameters::decode):
* Shared/LoadParameters.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::prepareLoadForWebProcessTransfer):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* WebProcess/Network/WebLoaderStrategy.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadRequest):
* WebProcess/WebPage/WebPage.h:
2021-08-26 Wenson Hsieh <wenson_hsieh@apple.com>
Fix a typo in `ArgumentCoder<Ref<Font>>::decode()`
https://bugs.webkit.org/show_bug.cgi?id=229596
Reviewed by Tim Horton.
Change `renderingRersouceIdentifier` to `renderingResourceIdentifier`.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Ref<Font>>::decode):
2021-08-26 Wenson Hsieh <wenson_hsieh@apple.com>
Add type-safe transaction identifiers for EditorState and FocusedElementInformation
https://bugs.webkit.org/show_bug.cgi?id=229571
Reviewed by Tim Horton.
Make `transactionID` a monotonic object identifier instead of a generic `TransactionID`, and replace
`FocusedElementIdentifier` (which is currently type-defined to `uint64_t`) with its own monotonic object
identifier type.
In a future patch, I plan to implement a mechanism to synchronize `EditorState` and `FocusedElementInformation`
updates, which would require one or both of these objects to hold both types of transactional identifiers; in
order to do this, we need to ensure that these two identifiers are distinct types, so that they can't be easily
mixed up.
* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
* Shared/EditorState.h:
* Shared/FocusedElementInformation.cpp:
(WebKit::FocusedElementInformation::encode const):
(WebKit::FocusedElementInformation::decode):
* Shared/FocusedElementInformation.h:
* Shared/IdentifierTypes.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateEditorState):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView updateCurrentFocusedElementInformation:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
(WebKit::WebPage::elementDidFocus):
* WebProcess/WebPage/WebPage.h:
Additionally rename `m_currentFocusedElementIdentifier` to `m_lastFocusedElementInformationIdentifier`, for
consistency with `m_lastEditorStateIdentifier`.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::focusedElementInformation):
2021-08-26 Cameron McCormack <heycam@apple.com>
Manually release SharedBitmap if CGBitmapContextCreateWithData fails and doesn't do it
https://bugs.webkit.org/show_bug.cgi?id=229428
<rdar://problem/82264138>
Reviewed by Darin Adler.
* Shared/ShareableBitmap.h:
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::releaseBitmapContextData):
2021-08-26 Aditya Keerthi <akeerthi@apple.com>
[iOS] Photo picker appears at incorrect locations when opened using a trackpad
https://bugs.webkit.org/show_bug.cgi?id=229568
rdar://80268735
Reviewed by Wenson Hsieh.
On iOS, file inputs that accept photos give the user the option to
select from a photo picker rather than a standard document picker.
The photo picker is presented as a popover, and uses the content
view's `lastInteractionLocation` to determine the source rect.
However, `lastInteractionLocation` is not updated when mouse events
are recognized, leading to the popover being presented at the location
of the most recent tap / long press / touch event.
To fix, ensure `lastInteractionLocation` is updated when a mouse down
event is recognized.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView mouseGestureRecognizerChanged:]):
2021-08-26 Myles C. Maxfield <mmaxfield@apple.com>
Clean up logging #includes
https://bugs.webkit.org/show_bug.cgi?id=229547
Reviewed by Eric Carlson.
It's actually harmful to include the wrong framework's Logging.h file,
because they conflict with each other. You'll end up with errors like
Unknown symbol "WebCore::WebKit2LogLayout".
No new tests because there is no behavior change.
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::logChannel const):
* Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::logChannel):
* Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:
(WebKit::MediaSampleCursor::logChannel const):
* Shared/mac/MediaFormatReader/MediaTrackReader.cpp:
(WebKit::MediaTrackReader::logChannel const):
* UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp:
(WebKit::RemoteMediaSessionCoordinatorProxy::logChannel const):
* UIProcess/MediaKeySystemPermissionRequestManagerProxy.cpp:
(WebKit::logChannel):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::logChannel const):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::logChannel const):
* WebProcess/GPU/media/MediaSourcePrivateRemote.cpp:
(WebKit::MediaSourcePrivateRemote::logChannel const):
* WebProcess/GPU/media/RemoteAudioSourceProvider.cpp:
(WebKit::RemoteAudioSourceProvider::logChannel const):
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::logChannel const):
* WebProcess/MediaSession/RemoteMediaSessionCoordinator.cpp:
(WebKit::RemoteMediaSessionCoordinator::logChannel const):
2021-08-26 Kimmo Kinnunen <kkinnunen@apple.com>
RemoteGraphicsContextGL refers to GraphicsContextGLOpenGL::SimulatedEventForTesting
https://bugs.webkit.org/show_bug.cgi?id=229405
Reviewed by Kenneth Russell.
Instead, refer via the defining base class, i.e. use
GraphicsContextGL::SimulatedEventForTesting.
Fixes problems if we try to move ANGLE implementation out of
GraphicsContextGLOpenGL.
No new tests, refactor.
* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
2021-08-26 Fujii Hironori <Hironori.Fujii@sony.com>
[curl] REGRESSION(r281158): fetch('http://localhost/') from about:blank doesn't emit the console error message
https://bugs.webkit.org/show_bug.cgi?id=229515
Unreviewed, reverting r281158.
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse):
2021-08-25 Aditya Keerthi <akeerthi@apple.com>
[iOS] Unable to select files when the accept attribute is set to "*/*"
https://bugs.webkit.org/show_bug.cgi?id=229456
rdar://82346315
Reviewed by Chris Dumez.
"*/*" is a valid MIME type string representing all media types. However,
the UniformTypeIdentifiers framework (as well as the now deprecated
CoreServices type identifiers API) does not map wildcard MIME types.
In order to restrict `UIDocumentPickerViewController` to the types of
files specified in the accept attribute, all MIME type strings are
converted into `UTType`s. However, when attempting to retrieve a UTType
for "*/*", the system dynamically generates a type, since the string is
unregistered. Then, since no files conform to the dynamic type, all
files in the document picker are greyed out, and the user is unable
to access the "Photo Library" and "Take Photo or Video" items.
To fix, return an empty set of type identifiers whenever "*/*" is
present in the list of MIME types, ensuring there are no restrictions
on the types of files that can be selected.
Note that the same issue does not occur on macOS, since all MIME types
are mapped to a set of file extensions, rather than UTTypes. Furthermore,
on macOS, the embedding app, not WebKit, is responsible for displaying
the file picker.
* UIProcess/ios/forms/WKFileUploadPanel.mm:
2021-08-25 Wenson Hsieh <wenson_hsieh@apple.com>
Remove some iOS-specific compile-time guards that are no longer needed
https://bugs.webkit.org/show_bug.cgi?id=229500
Reviewed by Tim Horton.
Remove two compile-time flags that were no longer necessary after WebKit's minimum supported iOS version became
iOS 14: `USE(UIKIT_KEYBOARD_ADDITIONS)` and `HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)`.
`HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)` was only needed for a workaround in our test infrastructure,
while `USE(UIKIT_KEYBOARD_ADDITIONS)` was only introduced to maintain basic hardware keyboard functionality in
iOS 12, while supporting improvements to hardware keyboard support in iOS 13.
The latter now only guards `PLATFORM(IOS) || PLATFORM(MACCATALYST)`. However, there's no reason the codepaths
for hardware keyboard support can't exist on watchOS as well (especially since most of hardware keyboard
support is already implemented there -- just unreachable because it's not possible to attach a hardware keyboard
to an Apple watch). We can remove this feature flag, and simply delete code that was formerly guarded by
`!USE(UIKIT_KEYBOARD_ADDITIONS)`.
* Platform/spi/ios/UIKitSPI.h:
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformKeyboardEvent::WebKit2PlatformKeyboardEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
(WebKit::WebKeyboardEvent::encode const):
(WebKit::WebKeyboardEvent::decode):
* Shared/WebKeyboardEvent.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _disableAutomaticKeyboardUI]):
(-[WKContentView _requiresKeyboardWhenFirstResponder]):
(-[WKContentView applyAutocorrection:toString:withCompletionHandler:]):
(-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
(-[WKContentView _didCommitLoadForMainFrame]):
(-[WKContentView _setMarkedText:highlights:selectedRange:]):
(-[WKContentView textInputTraits]):
(-[WKContentView _handleKeyUIEvent:]):
(-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
(-[WKContentView _didHandleKeyEvent:eventWasHandled:]):
(-[WKContentView _elementDidBlur]):
(-[WKContentView _hardwareKeyboardAvailabilityChanged]):
(-[WKContentView _selectionChanged]):
(-[WKContentView keyCommands]): Deleted.
(-[WKContentView handleKeyEvent:]): Deleted.
* UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h:
* UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm:
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover initWithView:hasGroups:]):
(-[WKSelectTableViewController hasText]): Deleted.
(-[WKSelectTableViewController insertText:]): Deleted.
(-[WKSelectTableViewController deleteBackward]): Deleted.
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
(WebKit::WebEditorClient::handleInputMethodKeydown):
2021-08-25 Simon Fraser <simon.fraser@apple.com>
Replace the uint64_t used to identify form submits with a strongly typed identifier
https://bugs.webkit.org/show_bug.cgi?id=229513
Reviewed by Alex Christensen.
Introduce FormSubmitListenerIdentifier and use it in place of a uint64_t.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/IdentifierTypes.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::willSubmitForm):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::setUpWillSubmitFormListener):
(WebKit::WebFrame::continueWillSubmitForm):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::continueWillSubmitForm):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-25 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Visual Look Up animates from the wrong rect when the web view is scaled
https://bugs.webkit.org/show_bug.cgi?id=229518
rdar://82147473
Reviewed by Darin Adler.
When adopting QLPreviewControllerDelegate's animated transition methods for rdar://76020349, I mistakenly
thought that the `outContentRect` passed into `-previewController:transitionImageForPreviewItem:contentRect:`
would be in source view (WKContentView) coordinates; instead, QuickLook expects this `contentRect` to be in
window coordinates.
Fix this by first converting `_visualSearchPreviewImageBounds` to window coordinates.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView previewController:transitionImageForPreviewItem:contentRect:]):
2021-08-25 Eric Carlson <eric.carlson@apple.com>
[GPUP] RemoteAudioSession doesn't implement begin/endInterruption
https://bugs.webkit.org/show_bug.cgi?id=229514
rdar://80896732
Reviewed by Jer Noble.
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setIsPlayingToBluetoothOverride): Remove
ENABLE_ROUTING_ARBITRATION guard because it isn't used in the base class.
* WebProcess/GPU/media/RemoteAudioSession.h: Change the order virtual methods are declared
so they match the base class, to make it easier to spot differences.
2021-08-25 Per Arne Vollan <pvollan@apple.com>
Build error preprocessing sandbox
https://bugs.webkit.org/show_bug.cgi?id=229418
Reviewed by Alexey Proskuryakov.
Build fix after https://commits.webkit.org/240941@main.
* Scripts/generate-derived-sources.sh:
2021-08-25 Aditya Keerthi <akeerthi@apple.com>
[iOS] Crash when tapping <select> element and calling window.open()
https://bugs.webkit.org/show_bug.cgi?id=229468
rdar://82122972
Reviewed by Wenson Hsieh.
UIKit throws an exception when attempting to present a context menu
for a view that is not in a window.
One instance where this can occur in Safari is when a call to
window.open() is made in response to a touch on a select element.
In this scenario, the call to window.open() opens a new tab, unparenting
the current webview. However, the touch also focuses the element, and
WebKit attempts to present a context menu in an unparented view.
To fix, guard against the case where the view is not parented, and do
not attempt to present a context menu.
Test: fast/forms/ios/show-select-menu-in-unparented-view-crash.html
* UIProcess/ios/WKActionSheetAssistant.mm:
Note that the helper method used in other classes is not used in
WKActionSheetAssistant, since the hosting view is not always a
WKContentView.
(-[WKActionSheetAssistant showDataDetectorsUIForPositionInformation:]):
(-[WKActionSheetAssistant showMediaControlsContextMenu:items:completionHandler:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView presentContextMenu:atLocation:]):
Added a helper method to ensure the view is parented prior to presenting
a context menu.
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown _showSuggestions]):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker showDateTimePicker]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel showDocumentPickerMenu]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker showSelectPicker]):
2021-08-25 Per Arne Vollan <pvollan@apple.com>
Build error preprocessing sandbox
https://bugs.webkit.org/show_bug.cgi?id=229418
Reviewed by Alexey Proskuryakov.
Skip unneeded commands when preprocessing sandbox on iOS.
* Scripts/generate-derived-sources.sh:
2021-08-25 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] editing/input/cocoa/autocorrect-on.html times out when run after editing/input/cocoa/autocorrect-off.html
https://bugs.webkit.org/show_bug.cgi?id=229486
rdar://82191308
Reviewed by Tim Horton.
See changes in Tools for more details.
* Platform/spi/ios/TextInputSPI.h:
* Platform/spi/ios/UIKitSPI.h:
2021-08-25 Peng Liu <peng.liu6@apple.com>
[Monterey] LayoutTest media/element-containing-pip-video-going-into-fullscreen.html is flaky timeout/crash
https://bugs.webkit.org/show_bug.cgi?id=229453
<rdar://80346428>
Reviewed by Eric Carlson.
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode):
When the mock video presentation mode is enabled, the UI process still needs to
notify the Web process that the mode change has been done.
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::didCleanupFullscreen):
Return immediately if the element is not in fullscreen to avoid
an assertion later in `enterVideoFullscreenForVideoElement()`.
2021-08-24 Chris Dumez <cdumez@apple.com>
[WK2] Implement process-swapping based on Cross-Origin-Opener-Policy HTTP header
https://bugs.webkit.org/show_bug.cgi?id=229203
<rdar://problem/82047686>
Reviewed by Alex Christensen.
We recently added support for the Cross-Origin-Opener-Policy (COOP) HTTP header. However,
when switching browsing context group on HTTP response, we would keep using the same
WebProcess. This patch makes it so that we now swap WebProcess when switching browsing
context group on network response as this will be required to securely re-enable Web APIs
such as SharedArrayBuffer.
For process-swapping, we reuse most of the same logic as process-swap on navigation (PSON).
A few differences are that:
- We swap on response policy decision instead of navigation policy decision
- We used to have a ShouldTreatAsContinuingLoad Yes/No enum. It is now tri-state: No,
YesAfterNavigationPolicyDecision, YesAfterResponsePolicyDecision. We need this new state
to avoid duplicate response policy delegate calls after process-swapping and to avoid
sending duplicate didStartProvisionalLoad IPCs after proces-swapping.
- After process-swapping on navigation response, we close the previous page instead of trying
to put it into the back/forward cache. Per the specification, in a case of a browsing context
group switch, the previous browsing context needs to be discarded (which is Web-observable).
One important thing to note is that we currently send the HTTP request to the server AGAIN after
a process-swap. This is because the on-going load currently gets cancelled upon receiving the
network response and deciding to process-swap and a new fresh load gets issued by the new
WebProcess after swapping. I will address this in a follow-up to decrease patch size and
complexity. We will need to transition the load in the network process from the old WebProcess
to the new one in case of process-swap.
* Shared/LoadParameters.h:
* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
(WebKit::ProvisionalPageProxy::loadData):
(WebKit::ProvisionalPageProxy::loadRequest):
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
(WebKit::ProvisionalPageProxy::didCreateMainFrame):
(WebKit::ProvisionalPageProxy::decidePolicyForResponse):
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::shouldClosePreviousPageAfterCommit const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadRequestWithNavigationShared):
(WebKit::WebPageProxy::loadDataWithNavigationShared):
(WebKit::WebPageProxy::loadSimulatedRequest):
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::optionalRegistrableDomain const):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadDataImpl):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-24 Chris Dumez <cdumez@apple.com>
Crash in [RBSTarget targetWithPid:] during WebProcessProxy::shutDown
https://bugs.webkit.org/show_bug.cgi?id=229444
Reviewed by Alex Christensen.
It appears xpc_connection_get_pid() may be able to return a PID that is less than 0
(likely when the process has just exited) and this causes RunningBoard to throw an
exception because the PID is invalid. Tweak the WebKit PID validation to use '>= 0'
instead of simply '!= 0', so that our validation is identical to the one used by
RunningBoard.
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):
2021-08-24 Adrian Perez de Castro <aperez@igalia.com>
Non-unified build fixes, late August 2021
https://bugs.webkit.org/show_bug.cgi?id=229440
Unreviewed non-unified build fixes.
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: Add missing
wtf/SuspendableWorkQueue.h header.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: Ditto.
2021-08-23 Carlos Garcia Campos <cgarcia@igalia.com>
[SOUP] Show TLS protocol version and ciphersuite name in the inspector
https://bugs.webkit.org/show_bug.cgi?id=229400
Reviewed by Michael Catanzaro.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::tlsProtocolVersionToString):
(WebKit::NetworkDataTaskSoup::didGetHeaders):
2021-08-23 John Wilander <wilander@apple.com>
PCM: Support ephemeral measurement with non-persistent WebCore::PrivateClickMeasurement
https://bugs.webkit.org/show_bug.cgi?id=228984
<rdar://problem/81778213>
Reviewed by Kate Cheney.
This patch adds support for ephemeral measurement with non-persistent
WebCore::PrivateClickMeasurement for direct response advertising.
Such advertising means there is only one pending click, held in memory,
and only stored right before the triggering event causes attribution
reports to be scheduled.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement):
Now takes an optional ephemeral PrivateClickMeasurement parameter
and stores it right before moving on with attribution.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setPrivateClickMeasurementEphemeralMeasurementForTesting):
Test infrastructure.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setPrivateClickMeasurementEphemeralMeasurementForTesting):
Test infrastructure.
* NetworkProcess/NetworkSession.h:
* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
(WebKit::PrivateClickMeasurementManager::insertPrivateClickMeasurement):
New convenience function. Only stores in memory if the
PrivateClickMeasurement parameter is marked as ephemeral.
(WebKit::PrivateClickMeasurementManager::attribute):
Checks that the triggering event matches the ephemeral measurement if
it exists, and if so, forwards it.
(WebKit::PrivateClickMeasurementManager::clear):
Now clears the ephemeral state too.
* NetworkProcess/PrivateClickMeasurementManager.h:
(WebKit::PrivateClickMeasurementManager::setEphemeralMeasurementForTesting):
Test infrastructure.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPrivateClickMeasurementEphemeralMeasurementForTesting):
Test infrastructure.
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setPrivateClickMeasurementEphemeralMeasurementForTesting):
Test infrastructure.
* UIProcess/WebPageProxy.h:
2021-08-23 Cameron McCormack <heycam@apple.com>
Preserve color space when getting current color in DisplayList::DrawGlyphsRecorder
https://bugs.webkit.org/show_bug.cgi?id=229024
<rdar://problem/81828477>
Reviewed by Sam Weinig.
Change existing CGColor -> WebCore::Color conversions to be explicit
about lossily converting to sRGB.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setUnderPageBackgroundColor:]):
* UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(-[_WKApplicationManifest initWithCoder:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::platformUnderPageBackgroundColor const):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
2021-08-23 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (r271146): editing/selection/ios/scrolling-to-focused-element-inside-iframe.html is failing
https://bugs.webkit.org/show_bug.cgi?id=229376
rdar://80384683
Reviewed by Megan Gardner.
This iOS-specific test verifies that tapping on an element that makes itself contenteditable inside of a click
event handler both (1) brings up the software keyboard, and (2) scrolls to reveal the focused, newly editable
element such that it is not obscured by the software keyboard. This test began failing after the changes in
r271146 -- specifically, the fact that the call to `Element::setFocus()` moved to before the focus event is
dispatched, rather than afterwards.
The following timeline of events (annotated with web and UI processes) illustrates why this happens:
(WEB) 1. The click event on the element inside the subframe is handled; the element is made contentEditable,
and we make it focused, by first calling `Element::setFocus` and then `Element::dispatchFocusEvent`.
Right before dispatching the "focus" event, we call out to the client layer, via
`WebPage::elementDidFocus`, and compute a FocusedElementInformation struct to encode and send to the
UI process in the WebPageProxy::ElementDidFocus IPC message.
2. In the process of populating this struct in `WebPage::focusedElementInformation`, we observe that
layout is dirty, and immediately compute and send an EditorState underneath
`WebPage::sendEditorStateUpdate()`.
3. We then proceed to construct and send FocusedElementInformation to the UI process via
`Messages::WebPageProxy::ElementDidFocus`.
(UI) 4. We receive the EditorState that was computed and sent in step (2), which contains the up-to-date
state corresponding to the newly focused contentEditable `div`.
5. We then receive the FocusedElementInformation computed and sent in step (3), which makes us begin
waiting for the next post-layout EditorState update before zooming to reveal the focused element, by
setting WebPageProxy's `m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement` flag. However,
this post-layout EditorState after focusing the `div` never arrives, since we've already computed it
and sent it in step (2).
6. The software keyboard finishes animating in, causing us to resolve the UIScriptController promise
that we began to await after calling `UIHelper.activateAndWaitForInputSessionAt` in the test.
(WEB) 7. The test finishes, calls `testRunner.notifyDone()`, and we destroy the focused subframe and clear
the editable selection as well. This selection change causes us to compute another post-layout
editor state and send it to the UI process.
(UI) 8. The UI process *finally* receives the post-layout EditorState computed in (7). However, it's too
late, since (a) the test has already finished, and (b) the post-layout EditorState is computed after
the editable selection has already been cleared, so it's missing selection rect information anyways.
Prior to r271146, the call to `Element::setFocus` came *after* step (3), and caused us to compute and send
another EditorState to the UI process, which ensured that an up-to-date post layout EditorState would arrive in
the UI process shortly after step (5).
To fix this, we should avoid immediately computing and sending an EditorState to the UI process in the middle of
`WebPage::focusedElementInformation`, and instead simply schedule an EditorState during the next rendering
update. This ensures that the editor state triggered during element focus will always arrive after
`WebPageProxy::ElementDidFocus` in the UI process, rather than before, which allows us to scroll to the correct
selection rect in the UI process when focusing an editable element.
This also has the additional benefit of avoiding redundant EditorState computation and updates in the case where
focus is programmatically thrashed between elements during the same rendering update, since all of the editor
state updates are effectively batched together and dispatched at the end of the current rendering update.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::focusedElementInformation):
2021-08-23 Chris Dumez <cdumez@apple.com>
WebKit2 can only have one active navigation policy check for a given frame
https://bugs.webkit.org/show_bug.cgi?id=229012
Reviewed by Youenn Fablet.
WebKit2 could only have one active navigation policy check for a given frame
and there was a FIXME comment about this in the code. This was causing some
WPT tests to timeout in WebKit2 only because those tests would trigger
several navigations (e.g. in new windows) and only the last one would proceed
(earlier ones would get cancelled).
This patch updates the policy checking logic in WebFrame so that we can support
several concurrent policy checks.
No new tests, unskipped / rebaselined existing tests.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::cancelPolicyCheck):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::~WebFrame):
(WebKit::WebFrame::setUpPolicyListener):
(WebKit::WebFrame::setUpWillSubmitFormListener):
(WebKit::WebFrame::continueWillSubmitForm):
(WebKit::WebFrame::invalidatePolicyListeners):
(WebKit::WebFrame::didReceivePolicyDecision):
* WebProcess/WebPage/WebFrame.h:
2021-08-22 Kate Cheney <katherine_cheney@apple.com>
Report correct blocked URI in CSP violation report
https://bugs.webkit.org/show_bug.cgi?id=226316
<rdar://problem/78552912>
Reviewed by Alex Christensen.
Currently for a blocked redirection we report the blocked URI as the
target URL. This is not up to spec and we should actually report the
requested URL.
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::check):
(WebKit::NetworkLoadChecker::checkRedirection):
(WebKit::NetworkLoadChecker::checkRequest):
(WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):
* NetworkProcess/NetworkLoadChecker.h:
2021-08-22 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Fix and reenable several layout tests to account for the changes in rdar://80384564
https://bugs.webkit.org/show_bug.cgi?id=229316
Reviewed by Tim Horton.
After rdar://80384564, UIKit's non-editable text tap recognizer will no longer cause us to clear the active text
selection range when tapping outside of currently selected text in the page. Instead, WebKit's synthetic click
gesture recognizer should now manages clearing the selection (unless the page has prevented the "mousedown"
event).
With just the UIKit-side change, this already mostly works as expected since `commitPotentialTapFailed()` clears
out non-editable selections. However, there is one scenario in which we do want to clear out the selection when
tapping that isn't covered by the synthetic click gesture: when tapping on an element that does not handle or
prevent "mousedown"; this behavior is exercised by the existing layout test
`editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html`. To preserve this behavior, we
add a call to `clearSelectionAfterTapIfNeeded()` when completing a synthetic click, in the case where the
"mousedown" event was not swallowed.
These 3 tests should pass after the changes in rdar://80384564:
- editing/selection/ios/change-selection-by-tapping-with-existing-selection.html
- editing/selection/preserve-selection-when-clicking-button.html
- editing/selection/ios/persist-selection-after-tapping-on-element-with-mousedown-handler.html
And these WebKit-side changes are needed to keep these 2 tests passing:
- editing/selection/ios/hide-selection-after-tap-on-prevent-default-element.html
- fast/images/text-recognition/ios/reselect-word-in-image-overlay.html
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
2021-08-22 Simon Fraser <simon.fraser@apple.com>
Use the strongly typed PageGroupIdentifier in place of uint64_t
https://bugs.webkit.org/show_bug.cgi?id=229356
Reviewed by Alex Christensen.
Replace uses of uint64_t for page group identifiers with PageGroupIdentifier.
There are two places where we convert between StorageNamespaceIdentifier and
PageGroupIdentifier because, as the comments state, those are equivalent.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/IdentifierTypes.h:
* Shared/WebPageGroupData.cpp:
(WebKit::WebPageGroupData::decode):
* Shared/WebPageGroupData.h:
* UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::get):
(WebKit::pageGroupData):
(WebKit::generatePageGroupID): Deleted.
* UIProcess/WebPageGroup.h:
(WebKit::WebPageGroup::pageGroupID const):
* WebProcess/Databases/WebDatabaseProvider.cpp:
(WebKit::WebDatabaseProvider::getOrCreate):
(WebKit::WebDatabaseProvider::WebDatabaseProvider):
* WebProcess/Databases/WebDatabaseProvider.h:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebPage/WebPageGroupProxy.h:
(WebKit::WebPageGroupProxy::pageGroupID const):
(WebKit::WebPageGroupProxy::localStorageNamespaceIdentifier const):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::webPageGroup):
(WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::pageGroupID const):
* WebProcess/WebStorage/StorageNamespaceImpl.h:
2021-08-21 Simon Fraser <simon.fraser@apple.com>
Use MediaKeySystemRequestIdentifier, rather than mysterious uint64_t values, in WebKit
https://bugs.webkit.org/show_bug.cgi?id=229310
Reviewed by Youenn Fablet.
WebCore already had an ObjectIdentifer<> type for media system key requests, MediaKeySystemRequestIdentifier.
Use it in the WebKit layer.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* UIProcess/MediaKeySystemPermissionRequestManagerProxy.cpp:
(WebKit::MediaKeySystemPermissionRequestManagerProxy::denyRequest):
(WebKit::MediaKeySystemPermissionRequestManagerProxy::grantRequest):
(WebKit::MediaKeySystemPermissionRequestManagerProxy::createRequestForFrame):
* UIProcess/MediaKeySystemPermissionRequestManagerProxy.h:
* UIProcess/MediaKeySystemPermissionRequestProxy.cpp:
(WebKit::MediaKeySystemPermissionRequestProxy::MediaKeySystemPermissionRequestProxy):
* UIProcess/MediaKeySystemPermissionRequestProxy.h:
(WebKit::MediaKeySystemPermissionRequestProxy::create):
(WebKit::MediaKeySystemPermissionRequestProxy::mediaKeySystemID const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestMediaKeySystemPermissionForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.cpp:
(WebKit::MediaKeySystemPermissionRequestManager::sendMediaKeySystemRequest):
(WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasGranted):
(WebKit::MediaKeySystemPermissionRequestManager::mediaKeySystemWasDenied):
* WebProcess/EncryptedMedia/MediaKeySystemPermissionRequestManager.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mediaKeySystemWasGranted):
(WebKit::WebPage::mediaKeySystemWasDenied):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-20 Simon Fraser <simon.fraser@apple.com>
Remove AsyncRequest, which is unused
https://bugs.webkit.org/show_bug.cgi?id=229358
Reviewed by Alex Christensen.
* Shared/AsyncRequest.cpp: Removed.
* Shared/AsyncRequest.h: Removed.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
2021-08-20 Simon Fraser <simon.fraser@apple.com>
Use UserMediaRequestIdentifier in WebKit rather than a mysterious uint64_t
https://bugs.webkit.org/show_bug.cgi?id=229308
Reviewed by Youenn Fablet.
Use the existing WebCore::UserMediaRequestIdentifier in WebKit code. We need to pull
it out of the ENABLE(MEDIA_STREAM) #ifdef.
In UserMediaPermissionRequestManagerProxy use a new identifier type, MediaDevicePermissionRequestIdentifier,
which is used to identify pending permission requests (but never send to the web process).
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared): Sort
(headers_for_type):
* UIProcess/MediaKeySystemPermissionRequestManagerProxy.h:
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::denyRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::grantRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
(WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::checkUserMediaPermissionForSpeechRecognition):
(WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
(WebKit::generateRequestID): Deleted.
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::create):
(WebKit::UserMediaPermissionRequestProxy::userMediaID const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj: Some files that were in Sources.txt were missing from the project.
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::userMediaAccessWasGranted):
(WebKit::UserMediaPermissionRequestManager::userMediaAccessWasDenied):
* WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::userMediaAccessWasGranted):
(WebKit::WebPage::userMediaAccessWasDenied):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-20 Aditya Keerthi <akeerthi@apple.com>
[macCatalyst] Crash when clicking a phone number link
https://bugs.webkit.org/show_bug.cgi?id=229344
rdar://81804638
Reviewed by Tim Horton.
Clicking on a phone number link should present data detection UI.
However, `-[WKActionSheetAssistant _elementActionForDDAction:]` always
returns nil on Catalyst, resulting in crash when attempting to add the
returned action to an NSArray.
Given that the methods used in `_elementActionForDDAction:` are available
on Catalyst, fix the crash by ensuring the method does not return nil, and
only making the method available on platforms where ENABLE(DATA_DETECTION)
is defined.
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant _elementActionForDDAction:]):
2021-08-20 Alex Christensen <achristensen@webkit.org>
Make UIEventAttribution tests less platform dependent
https://bugs.webkit.org/show_bug.cgi?id=229323
Reviewed by John Wilander.
This allows me to run the UIEventAttribution tests on macOS.
It also makes them not time out, which they were doing since r277447.
To accomplish this, I added more test SPI to prevent the network process
suspension message, which was causing the test to time out on the iOS simulator.
* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _addEventAttributionWithSourceID:destinationURL:sourceDescription:purchaser:reportEndpoint:optionalNonce:]):
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore _preventNetworkProcessSuspensionForTesting]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _setUIEventAttributionForTesting:withNonce:]): Deleted.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::preventSuspensionForTesting):
(WebKit::NetworkProcessProxy::sendPrepareToSuspend):
* UIProcess/Network/NetworkProcessProxy.h:
2021-08-20 Simon Fraser <simon.fraser@apple.com>
Change the mysterious uint64_t argument to detectDataInAllFrames() to OptionSet<WebCore::DataDetectorType>
https://bugs.webkit.org/show_bug.cgi?id=229304
Reviewed by Tim Horton.
We can encode a OptionSet<WebCore::DataDetectorType> in IPC messages now, so do so for DetectDataInAllFrames().
Also use OptionSet<WebCore::DataDetectorType> in some cases where WebCore::DataDetectorType was being used
to hold a bit set.
* Shared/API/Cocoa/WKDataDetectorTypesInternal.h:
(fromWKDataDetectorTypes):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setupPageConfiguration:]):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::detectDataInAllFrames):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::detectDataInAllFrames):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Use an ObjectIdentifier<> for text checker requests
https://bugs.webkit.org/show_bug.cgi?id=229302
Reviewed by Wenson Hsieh.
Introduce TextCheckerRequestID and use it to identify text checker requests in a type-safe
way.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/IdentifierTypes.h:
* UIProcess/TextCheckerCompletion.cpp:
(WebKit::TextCheckerCompletion::create):
(WebKit::TextCheckerCompletion::TextCheckerCompletion):
* UIProcess/TextCheckerCompletion.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestCheckingOfString):
(WebKit::WebPageProxy::didFinishCheckingText):
(WebKit::WebPageProxy::didCancelCheckingText):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::requestCheckingOfString):
(WebKit::generateTextCheckingRequestID): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addTextCheckingRequest):
(WebKit::WebPage::didFinishCheckingText):
(WebKit::WebPage::didCancelCheckingText):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
2021-08-19 Wenson Hsieh <wenson_hsieh@apple.com>
Fix the apple internal build after r281277
https://bugs.webkit.org/show_bug.cgi?id=229100
<rdar://problem/82145920>
Reviewed by Myles C. Maxfield.
Update code guarded by `USE(APPLE_INTERNAL_SDK)`, such that it works with a `Vector<SandboxExtension::Handle>`.
Preserve the existing behavior of appending `handles` and `ids` in reverse order, but leave a FIXME questioning
the need for this.
* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::willCreateMediaStream):
2021-08-19 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS] Remove support for the meaningful tap heuristic
https://bugs.webkit.org/show_bug.cgi?id=229298
rdar://82130066
Reviewed by Tim Horton.
Remove all support for the meaningful tap heuristic, which was used to allow users to toggle tab pill visibility
in earlier versions of the Safari redesign. As of the latest iOS 15 beta, this heuristic is no longer necessary,
so we don't need this SPI support anymore.
* UIProcess/API/APIUIClient.h:
(API::UIClient::didNotHandleTapAsClick):
(API::UIClient::didTapAtPoint): Deleted.
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _didTapAtPoint:withResult:]): Deleted.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::didTapAtPoint): Deleted.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didTapAtPoint): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didTapAtPoint): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::isPlayingMediaDidChange):
* WebProcess/WebPage/WebPage.h:
Drive-by fix: initialize `m_appHighlightsVisible` using the correct type.
(WebKit::WebPage::platformNeedsLayoutForEditorState const):
(WebKit::WebPage::prepareToRunModalJavaScriptDialog):
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
(WebKit::WebPage::platformIsPlayingMediaDidChange): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::attemptSyntheticClick):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::commitPotentialTapFailed):
(WebKit::WebPage::clearSelectionAfterTapIfNeeded):
(WebKit::isProbablyMeaningfulClick): Deleted.
(WebKit::WebPage::didHandleOrPreventMouseDownOrMouseUpEvent): Deleted.
(WebKit::WebPage::platformIsPlayingMediaDidChange): Deleted.
2021-08-19 Aditya Keerthi <akeerthi@apple.com>
Remove __has_include guard for _UIDatePickerOverlayPresentation
https://bugs.webkit.org/show_bug.cgi?id=227298
rdar://79970171
Reviewed by Tim Horton.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker showDateTimePicker]):
2021-08-19 Alex Christensen <achristensen@webkit.org>
Use Vector<SandboxExtension::Handle> instead of SandboxExtension::HandleArray
https://bugs.webkit.org/show_bug.cgi?id=229100
Reviewed by Chris Dumez.
No change in behavior. Just more modern code.
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* Platform/IPC/FormDataReference.h:
(IPC::FormDataReference::encode const):
(IPC::FormDataReference::decode):
* Shared/Cocoa/LoadParametersCocoa.mm:
(WebKit::LoadParameters::platformDecode):
* Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::createHandlesForResources):
(WebKit::SandboxExtension::createReadOnlyHandlesForFiles):
(WebKit::SandboxExtension::createHandlesForMachLookup):
(WebKit::SandboxExtension::createHandlesForIOKitClassExtensions):
(WebKit::SandboxExtension::consumePermanently):
(WebKit::SandboxExtension::HandleArray::HandleArray): Deleted.
(WebKit::SandboxExtension::HandleArray::~HandleArray): Deleted.
(WebKit::SandboxExtension::HandleArray::allocate): Deleted.
(WebKit::SandboxExtension::HandleArray::append): Deleted.
(WebKit::SandboxExtension::HandleArray::operator[]): Deleted.
(WebKit::SandboxExtension::HandleArray::operator[] const): Deleted.
(WebKit::SandboxExtension::HandleArray::size const): Deleted.
(WebKit::SandboxExtension::HandleArray::encode const): Deleted.
(WebKit::SandboxExtension::HandleArray::decode): Deleted.
* Shared/Databases/IndexedDB/WebIDBResult.cpp:
(WebKit::WebIDBResult::encode const):
(WebKit::WebIDBResult::decode):
* Shared/Databases/IndexedDB/WebIDBResult.h:
(WebKit::WebIDBResult::WebIDBResult):
(WebKit::WebIDBResult::handles const):
* Shared/LoadParameters.h:
* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::Handle::decode):
(WebKit::SandboxExtension::createReadOnlyHandlesForFiles):
(WebKit::SandboxExtension::consumePermanently):
(WebKit::SandboxExtension::HandleArray::at): Deleted.
(WebKit::SandboxExtension::HandleArray::HandleArray): Deleted.
(WebKit::SandboxExtension::HandleArray::~HandleArray): Deleted.
(WebKit::SandboxExtension::HandleArray::allocate): Deleted.
(WebKit::SandboxExtension::HandleArray::append): Deleted.
(WebKit::SandboxExtension::HandleArray::size const): Deleted.
(WebKit::SandboxExtension::HandleArray::operator[] const): Deleted.
(WebKit::SandboxExtension::HandleArray::operator[]): Deleted.
(WebKit::SandboxExtension::HandleArray::begin): Deleted.
(WebKit::SandboxExtension::HandleArray::end): Deleted.
(WebKit::SandboxExtension::HandleArray::begin const): Deleted.
(WebKit::SandboxExtension::HandleArray::end const): Deleted.
(WebKit::SandboxExtension::HandleArray::encode const): Deleted.
(WebKit::SandboxExtension::HandleArray::decode): Deleted.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
(WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions):
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::performDragOperation):
* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::willCreateMediaStream):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::performDragOperation):
(WebKit::WebPageProxy::performDragControllerAction):
(WebKit::WebPageProxy::processNextQueuedMouseEvent):
(WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:performDrop:]):
* WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp:
(WebKit::MediaDeviceSandboxExtensions::MediaDeviceSandboxExtensions):
(WebKit::MediaDeviceSandboxExtensions::encode const):
(WebKit::MediaDeviceSandboxExtensions::decode):
* WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getPathnamesForType):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::consumeNetworkExtensionSandboxExtensions):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mouseEvent):
(WebKit::WebPage::didReceivePolicyDecision):
(WebKit::WebPage::performDragControllerAction):
(WebKit::WebPage::extendSandboxForFilesFromOpenPanel):
(WebKit::WebPage::consumeSandboxExtensions):
(WebKit::WebPage::consumeNetworkExtensionSandboxExtensions):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::unblockPreferenceService):
(WebKit::WebProcess::unblockServicesRequiredByAccessibility):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Replace the uint64_t used to identify taps with an ObjectIdentifier<> type
https://bugs.webkit.org/show_bug.cgi?id=229278
Reviewed by Wenson Hsieh.
Interaction code used "uint64_t requestID" to identify taps, but there are other
things that used "uint64_t requestID", which may result in bugs.
Fix by using a strongly typed ObjectIdentifier<TapIdentifierType> to identify taps.
This is defined in IdentifierTypes.h since I expect to add more of them.
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Shared/IdentifierTypes.h: Added.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::disableDoubleTapGesturesDuringTapIfNecessary):
(WebKit::PageClientImpl::handleSmartMagnificationInformationForPotentialTap):
(WebKit::PageClientImpl::didGetTapHighlightGeometries):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
(-[WKContentView _disableDoubleTapGesturesDuringTapIfNecessary:]):
(-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
(-[WKContentView nextTapIdentifier]):
(-[WKContentView _highlightLongPressRecognized:]):
(-[WKContentView _twoFingerSingleTapGestureRecognized:]):
(-[WKContentView _singleTapIdentified:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::handleTwoFingerTapAtPoint):
(WebKit::WebPageProxy::potentialTapAtPosition):
(WebKit::WebPageProxy::tapHighlightAtPosition):
(WebKit::WebPageProxy::didGetTapHighlightGeometries):
(WebKit::WebPageProxy::disableDoubleTapGesturesDuringTapIfNecessary):
(WebKit::WebPageProxy::handleSmartMagnificationInformationForPotentialTap):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
(WebKit::WebPage::handleTwoFingerTapAtPoint):
(WebKit::WebPage::potentialTapAtPosition):
(WebKit::WebPage::tapHighlightAtPosition):
2021-08-19 Alex Christensen <achristensen@webkit.org>
Remove more non-inclusive language from Source
https://bugs.webkit.org/show_bug.cgi?id=229230
Reviewed by Myles C. Maxfield.
* mac/WebKit2.order:
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Rename Element::clientRect() which does not return a value in web-exposed "client" coordinates
https://bugs.webkit.org/show_bug.cgi?id=229243
Reviewed by Wenson Hsieh.
The result of Element::clientRect() is in the coordinate space of the root view,
not in the space of the Element's Frame, so does not match the other functions on Element
with "client" in the name.
Rename to Element::boundingBoxInRootViewCoordinates() for clarity.
* WebProcess/WebCoreSupport/WebValidationMessageClient.cpp:
(WebKit::WebValidationMessageClient::showValidationMessage):
(WebKit::WebValidationMessageClient::updateValidationBubbleStateIfNeeded):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::contextForElement const):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::isObscuredElement):
(WebKit::WebPage::textInputContextsInRect):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Fix the typo in horiontalRubberbandAmountInContentCoordinates
https://bugs.webkit.org/show_bug.cgi?id=229255
Reviewed by Tim Horton.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Rename WebPageProxy::headerHeight() and related to make it clear they are for printing
https://bugs.webkit.org/show_bug.cgi?id=229242
Reviewed by Tim Horton.
Disambiguate WebPageProxy::headerHeight(), used for printing, from FrameView::headerHeight()
which is not.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::headerHeightForPrinting):
(WebKit::WebPageProxy::footerHeightForPrinting):
(WebKit::WebPageProxy::drawHeaderForPrinting):
(WebKit::WebPageProxy::drawFooterForPrinting):
(WebKit::WebPageProxy::headerHeight): Deleted.
(WebKit::WebPageProxy::footerHeight): Deleted.
(WebKit::WebPageProxy::drawHeader): Deleted.
(WebKit::WebPageProxy::drawFooter): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
(-[WKPrintingView drawPageBorderWithSize:]):
2021-08-19 Simon Fraser <simon.fraser@apple.com>
Use a Ref<> argument to keep WebPage alive in TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition()
https://bugs.webkit.org/show_bug.cgi?id=229239
Reviewed by Tim Horton.
Replace a manual ref()/deref() with a makeRef() argument to the function.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):
2021-08-19 Kate Cheney <katherine_cheney@apple.com>
Unable to load downloaded HTML files in Safari
https://bugs.webkit.org/show_bug.cgi?id=229254
<rdar://problem/82051114>
Reviewed by Brent Fulgham.
Check quarantine bits for webarchive files only.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::isQuarantinedAndNotUserApproved):
2021-08-19 Kate Cheney <katherine_cheney@apple.com>
[App Privacy Report] Some HTTP Redirects from non app initiated requests are marked app initiated
https://bugs.webkit.org/show_bug.cgi?id=229202
<rdar://problem/79467871>
Reviewed by Brent Fulgham.
Tests: http/tests/app-privacy-report/app-attribution-media-redirect.html
http/tests/app-privacy-report/user-attribution-media-redirect.html
The request returned in the completion handler of
NetworkDataTaskCocoa::willPerformHTTPRedirection does not always have
the attribution property of the original request. We should pass it
along and set it.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
2021-08-19 Zan Dobersek <zdobersek@igalia.com>
Adjust fallback SandboxExtension std::optional<Handle> construction
https://bugs.webkit.org/show_bug.cgi?id=229233
Reviewed by Carlos Garcia Campos.
In r240512, std::optional<> was adopted as the return type for handle
creation methods in the SandboxExtension class. For no-op methods,
the construction of these return values was done using empty initializer
lists.
The changes here should match pre-r240512 behavior by creating empty
Handle objects and using those to implicitly construct the returning
std::optional<> object. In addition, this avoids compilation breakage
with GCC 8 where ambiguity between possible std::optional<> constructors
is detected.
* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::createHandle):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForGenericExtension):
2021-08-19 Youenn Fablet <youenn@apple.com>
Rename MediaPlayer::setVisible to MediaPlayer::setPageIsVisible
https://bugs.webkit.org/show_bug.cgi?id=228837
<rdar://problem/81857023>
Reviewed by Eric Carlson.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::setPageIsVisible):
(WebKit::RemoteMediaPlayerProxy::setVisible): Deleted.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::setPageIsVisible):
(WebKit::MediaPlayerPrivateRemote::setVisible): Deleted.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2021-08-18 David Kilzer <ddkilzer@apple.com>
Bug 229265: run-webkit-tests --leaks should check for leaks in the GPU process
<https://webkit.org/b/229265>
<rdar://problem/82101453>
Reviewed by Alex Christensen.
* UIProcess/API/C/WKPage.cpp:
(WKPageGetGPUProcessIdentifier): Add.
* UIProcess/API/C/WKPagePrivate.h:
(WKPageGetGPUProcessIdentifier): Add.
- Add function to return the PID for the GPU process.
2021-08-18 Megan Gardner <megan_gardner@apple.com>
Remove unneeded UIKitSPI declarations
https://bugs.webkit.org/show_bug.cgi?id=210075
Reviewed by Wenson Hsieh.
No code changes, just using the now fully public API.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _webTouchEventsRecognized:]):
(-[WKContentView _highlightLongPressRecognized:]):
(-[WKContentView _doubleTapRecognizedForDoubleClick:]):
(-[WKContentView _twoFingerSingleTapGestureRecognized:]):
(-[WKContentView _singleTapRecognized:]):
(gestureRecognizerModifierFlags): Deleted.
2021-08-18 Youenn Fablet <youenn@apple.com>
[MacOS] Use com.apple.webkit.microphone extension to gate microphone access in GPUProcess sandbox
https://bugs.webkit.org/show_bug.cgi?id=229238
Reviewed by Eric Carlson.
Manually tested.
* GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in:
Align to iOS and only allow microphone access in sandbox if com.apple.webkit.microphone is sent to GPUProcess.
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
Do audio capture in UIProcess for non Safari applications until rdar://problem/29448368 is fixed.
2021-08-18 Sihui Liu <sihui_liu@apple.com>
Do not terminate relaunched network process when getting network process connection
https://bugs.webkit.org/show_bug.cgi?id=229236
Reviewed by Chris Dumez.
When UI process fails to get network process connection for the first time, it will retry on next runloop
iteration. On the retry, it terminates existing network process and relaunch a network process, because the
failure may indicate something is wrong in the network process. If existing network process is different from
the one on first try, the existing process can be functional and we should not terminate it.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
2021-08-18 Michael Catanzaro <mcatanzaro@gnome.org>
REGRESSION(r280382): [GTK] 2.33.3 does not build with gtk-doc enabled, installs broken pkg-config files
https://bugs.webkit.org/show_bug.cgi?id=229152
Reviewed by Philippe Normand.
CMake is expanding templates in the pkg-config files that are not supposed to be expanded.
Oops! Let's switch back to using @SVN_REVISION@ instead of ${SVN_REVISION} as the template
for inserting the SVN revision into the pkg-config file, so we can tell CMake to leave the
${} variables alone.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
* Shared/glib/BuildRevision.h.in:
* gtk/webkit2gtk-web-extension.pc.in:
* gtk/webkit2gtk.pc.in:
2021-08-18 Wenson Hsieh <wenson_hsieh@apple.com>
REGRESSION (iOS 15): DoubleDown Casino app won't load past launch page
https://bugs.webkit.org/show_bug.cgi?id=229200
rdar://81636256
Reviewed by Myles C. Maxfield.
The changes in https://webkit.org/b/228216 to fix rdar://80473805 introduced a mechanism to keep track of uses
of cached fonts and images in display list items in the web and GPU processes, via a `useCount` counter variable
that's incremented in the web process whenever the font or image is used in a display list item and decremented
in the GPU process whenever the item is processed.
However, the code to increment `useCount` in the web process currently only triggers at most once per rendering
update — this means that if there are multiple canvas drawing commands that use fonts in the same rendering
update, the web process' notion of `useCount` will fall out of sync with the GPU process' notion of `useCount`.
In most cases, this causes the cached font to remain for longer in the GPU process than necessary; however, in
this specific scenario, it's possible for the web process to tell the GPU process to release the cached font too
early, which causes the GPU process to prematurely purge the font from the cache, and subsequently wait for the
cached font to arrive (which will never arrive, since the web process has already released the font).
In other words, the timeline of events between the web and GPU processes looks like this (where `f` is a cached
web font, `A_f` is a drawing command that uses `f`, and `B_f` is another drawing command that uses `f`).
WEB GPU
==============================================================
1. Cache `f`
2. Append `A_f`
3. Cache `f`
4. Play back `A_f`
5. Append `B_f`
6. Release `f` (use count was 1 here)
7. Release `f` (use count dropped from 1 to 0)
8. Play back `B_f`
...and then display list playback stops due to `f` not being in
the cache.
To address this, we simply move the `useCount` increment in the web process out of the rendering update check.
The original intent of the fix for bug #228216 was to allow for `useCount` to increment as many times as needed
per rendering update, so this limitation was unintentional.
Unfortunately, I have not been able to come up with a layout test that reliably reproduces this scenario (yet).
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::recordFontUse):
2021-08-17 Sihui Liu <sihui_liu@apple.com>
Fix crash in TestWebKitAPI.NetworkProcess.CrashWhenNotAssociatedWithDataStore
https://bugs.webkit.org/show_bug.cgi?id=229209
rdar://82040197
Reviewed by Geoffrey Garen.
When getting network process connection fails, we don't need to retry or crash UI process if web process is
already gone.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
2021-08-17 Fujii Hironori <Hironori.Fujii@sony.com>
[curl] Kept alive NetworkResourceLoaders should be cancelled by NetworkLoad::didCompleteWithError on PolicyAction::Ignore of didReceiveResponse
https://bugs.webkit.org/show_bug.cgi?id=228095
<rdar://problem/81393898>
Reviewed by Don Olmstead.
If a page dispatches a keepalive fetch and the page is navigated
away, the alive NetworkResourceLoader is transferred to the
NetworkSession by NetworkConnectionToWebProcess::transferKeptAliveLoad.
After the NetworkResourceLoader receives a response, it is canceled
by PolicyAction::Ignore.
However, NetworkDataTaskCurl didn't properly cancel the kept alive
NetworkResourceLoader. They remained in m_keptAliveLoads of
NetworkSession even after the requests were canceled.
Test: http/tests/fetch/keepalive-fetch-2.html
* NetworkProcess/curl/NetworkDataTaskCurl.cpp:
(WebKit::NetworkDataTaskCurl::invokeDidReceiveResponse): Call didCompleteWithError on PolicyAction::Ignore.
2021-08-17 Jer Noble <jer.noble@apple.com>
De-duplicate the Cocoa-specific MediaPlayerPrivateRemote constructor
https://bugs.webkit.org/show_bug.cgi?id=229193
Reviewed by Eric Carlson.
Rather than have two, separate implementations of the MediaPlayerPrivateRemote constructor (one for Cocoa),
just wrap the initializer for the Cocoa-specific ivar in PLATFORM(COCOA) guards.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote): Deleted.
2021-08-16 Wenson Hsieh <wenson_hsieh@apple.com>
[GPU Process] Demote the release assertion in `RemoteResourceCache::ensureResourceUseCounter`
https://bugs.webkit.org/show_bug.cgi?id=229164
rdar://81999835
Reviewed by Simon Fraser.
Replace the `RELEASE_ASSERT` with a regular debug assertion. See bug description for more information.
* GPUProcess/graphics/RemoteResourceCache.cpp:
(WebKit::RemoteResourceCache::ensureResourceUseCounter):
2021-08-16 Fujii Hironori <Hironori.Fujii@sony.com>
[WinCairo][GraphicsLayerTextureMapper] DrawingAreaProxyCoordinatedGraphics doesn't enter accelerated compositing mode
https://bugs.webkit.org/show_bug.cgi?id=228100
Reviewed by Don Olmstead.
Even if DrawingAreaCoordinatedGraphics entered AC mode in web
process side, DrawingAreaProxyCoordinatedGraphics didn't enter AC
mode in UI process side. They should sync.
There were two problems.
LayerTreeHost::layerTreeContext() always returned an empty
LayerTreeContext that means non-AC mode.
LayerTreeHost::m_layerTreeContext.contextID should be initialized.
DrawingAreaCoordinatedGraphics::layerHostDidFlushLayers should be
called after setShouldNotifyAfterNextScheduledLayerFlush(true) to
submit the current AC mode state.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
(WebKit::LayerTreeHost::layerFlushTimerFired):
(WebKit::LayerTreeHost::LayerTreeHost):
(WebKit::LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h:
* WebProcess/WebPage/DrawingArea.h:
2021-08-16 Sihui Liu <sihui_liu@apple.com>
Add logging for failure in getting network process connection
https://bugs.webkit.org/show_bug.cgi?id=229102
Reviewed by Geoffrey Garen.
UI process knows more about why network connection cannot be created compared to web process, so let's add
logging in UI process to help debug rdar://80760179.
* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::stateString const):
* UIProcess/AuxiliaryProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getNetworkProcessConnection):
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebProcess/WebProcess.cpp:
(WebKit::getNetworkProcessConnection):
2021-08-16 David Kilzer <ddkilzer@apple.com>
"make analyze" should run clang static analyzer in deep mode
<https://webkit.org/b/229127>
<rdar://problem/81960587>
Reviewed by Alexey Proskuryakov.
* Scripts/generate-derived-sources.sh:
* WebKit.xcodeproj/project.pbxproj:
- Treat "analyze" the same as "build" for "ACTION" environment
variable.
2021-08-16 Philippe Normand <pnormand@igalia.com>
[GLib] Enable mediastream setting if it's enabled at build-time
https://bugs.webkit.org/show_bug.cgi?id=229134
Reviewed by Adrian Perez de Castro.
* UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsConstructed):
2021-08-16 Philippe Normand <pnormand@igalia.com>
[GTK] MiniBrowser crashes when closed while capturing desktop
https://bugs.webkit.org/show_bug.cgi?id=228232
<rdar://problem/81093648>
Reviewed by Adrian Perez de Castro.
Remove explicit detach call from the UIClient. Resetting the page state in the proxy *after*
the clients have been cleared is a better fix for this crash.
* UIProcess/API/glib/WebKitUIClient.cpp:
(attachUIClientToView):
(detachUIClientFromView): Deleted.
* UIProcess/API/glib/WebKitUIClient.h:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewDispose):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
2021-08-16 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.3 release
* gtk/NEWS: Add release notes for 2.33.3.
2021-08-16 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Fix GTK distcheck build
* webkitglib-symbols.map: Remove symbols that are not in the library anymore.
2021-08-15 Miguel Gomez <magomez@igalia.com>
[GTK][WPE] Add API to pass WebKitMemoryPressureHandler parameters to the network processes
https://bugs.webkit.org/show_bug.cgi?id=228227
Reviewed by Carlos Garcia Campos.
Added webkit_website_data_manager_set_memory_pressure_settings() API function to pass a
WebKitMemoryPressureSettings instance as the settings to use by all the network processes.
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
* UIProcess/API/glib/WebKitMemoryPressureSettings.cpp:
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_set_memory_pressure_settings):
* UIProcess/API/gtk/WebKitWebsiteDataManager.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebsiteDataManager.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didExceedMemoryLimit):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebProcessPool.h:
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::memoryPressureMonitorDisabled):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
2021-08-15 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] editing/selection/ios/select-all-in-readonly-input-does-not-overflow.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=229126
rdar://80384801
Reviewed by Tim Horton.
Remove the (now-unused) testing SPI `-[WKWebView _doAfterResettingSingleTapGesture:]`. See Tools/ChangeLog for
more information.
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _doAfterResettingSingleTapGesture:]): Deleted.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _singleTapDidReset:]):
(-[WKContentView _doAfterResettingSingleTapGesture:]): Deleted.
2021-08-15 David Kilzer <ddkilzer@apple.com>
Bug 229112: ThreadSanitizer: data races of WTF::String in WebResourceLoadStatisticsStore
<https://webkit.org/b/229112>
<rdar://problem/81940951>
Reviewed by Kate Cheney.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::attributePrivateClickMeasurement):
- Make isolated copies of sourceSite and destinationSite to fix
data races.
(WebKit::WebResourceLoadStatisticsStore::privateClickMeasurementToString):
- Make isolated copy of WTF::String to fix data race.
2021-08-14 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION: WebContent often crashes when opening a Google spreadsheet with charts
https://bugs.webkit.org/show_bug.cgi?id=229106
<rdar://81806877>
Reviewed by Wenson Hsieh.
Don't resume processing the DisplayList of an ImageBuffer until its
backend is created.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::didAppendData):
2021-08-13 Kate Cheney <katherine_cheney@apple.com>
Check quarantine bits before rendering local files
https://bugs.webkit.org/show_bug.cgi?id=229073
<rdar://problem/81430251>
Reviewed by Brent Fulgham.
We shouldn't load files unless they have no quarantine flags or
have been marked user approved.
* Platform/spi/mac/QuarantineSPI.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::isQuarantinedAndNotUserApproved):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadFile):
* UIProcess/WebPageProxy.h:
2021-08-13 Chris Dumez <cdumez@apple.com>
Add Cross-Origin-Embedder-Policy support for Blob URLs
https://bugs.webkit.org/show_bug.cgi?id=229041
Reviewed by Alex Christensen.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:
2021-08-13 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] fast/events/touch/ios/long-press-on-link.html is a constant crash
https://bugs.webkit.org/show_bug.cgi?id=229095
rdar://80386326
Reviewed by Tim Horton.
This test crashes when run immediately after another test that attempts to present the context menu and ends
with the context menu still showing (in this case, fast/events/touch/ios/long-press-on-image.html). Running
these tests back to back causes us to immediately dismiss the context menu interaction while transitioning to
the second test, which triggers the context menu interaction's dismissal animation.
This animation ends in the middle of the next test (long-press-on-link.html), after the long press has begun and
the context menu interaction has already requested a targeted hint preview, but (importantly) before the context
menu peek animation actually begins (i.e. `-contextMenuInteraction:willDisplayMenuForConfiguration:animator:`).
As a result, we tear down the hint container too early (with the hint view still in the view hierarchy), and
subsequently crash with an exception when UIKit tries to perform coordinate space conversions with the now-
unparented view.
To fix this, we make two small adjustments:
1. Avoid unparenting the context menu hint container if it still has subviews.
2. Add plumbing to ensure that the context menu hint container is unparented once all of its subviews have
been removed (and the container isn't being used for anything else).
* Platform/spi/ios/UIKitSPI.h:
Add an SPI declaration for the `-_didRemoveSubview:` subclassing hook.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKTargetedPreviewContainer initWithContentView:]):
(-[WKTargetedPreviewContainer _didRemoveSubview:]):
Add a new subclass for WKTargetedPreviewContainer that notifies WKContentView when its last subview has been
removed, such that WKContentView can tear down the container view if needed.
(-[WKContentView cleanUpInteraction]):
(-[WKContentView removeContextMenuViewIfPossibleForActionSheetAssistant:]):
(-[WKContentView _targetedPreviewContainerDidRemoveLastSubview:]):
(-[WKContentView _createPreviewContainerWithLayerName:]):
(-[WKContentView _removeContextMenuHintContainerIfPossible]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
(-[WKContentView _removeContextMenuViewIfPossible]): Deleted.
Additionally rename `-_removeContextMenuViewIfPossible` to `-_removeContextMenuHintContainerIfPossible`, to make
it clear that this method is about removing the container view for context menu hints (and not the hints
themselves).
* UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsDropdown _removeContextMenuInteraction]):
* UIProcess/ios/forms/WKDateTimeInputControl.mm:
(-[WKDateTimePicker removeContextMenuInteraction]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel removeContextMenuInteraction]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKSelectPicker removeContextMenuInteraction]):
2021-08-13 Jer Noble <jer.noble@apple.com>
[Cocoa] RemoteMediaPlayerProxy does not receive acceleratedRenderingStateChanged() when video element switches sources
https://bugs.webkit.org/show_bug.cgi?id=229092
<rdar://81902163>
Reviewed by Eric Carlson.
Follow up to r280723; in that patch, a call to acceleratedRenderingStateChanged() was added to
the MediaPlayerPrivateRemote, but only for non-Cocoa ports. Add the same method to the constructor
for the Cocoa version as well.
* WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
2021-08-13 Alex Christensen <achristensen@webkit.org>
SandboxExtension::Handle creation should return std::optional instead of bool
https://bugs.webkit.org/show_bug.cgi?id=228875
Reviewed by Youenn Fablet.
This modernizes the code somewhat.
This makes it easier to write code that realizes that handle creation can fail.
This is a step towards removing the unnecessary abstraction HandleArray.
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::encode const):
* Platform/IPC/FormDataReference.h:
(IPC::FormDataReference::encode const):
* Shared/Cocoa/SandboxExtensionCocoa.mm:
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandle):
(WebKit::createHandlesForResources):
(WebKit::SandboxExtension::createReadOnlyHandlesForFiles):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForTemporaryFile):
(WebKit::SandboxExtension::createHandleForGenericExtension):
(WebKit::SandboxExtension::createHandleForMachLookup):
(WebKit::SandboxExtension::createHandlesForMachLookup):
(WebKit::SandboxExtension::createHandleForReadByAuditToken):
(WebKit::SandboxExtension::createHandleForIOKitClassExtension):
(WebKit::SandboxExtension::createHandlesForIOKitClassExtensions):
* Shared/SandboxExtension.h:
(WebKit::SandboxExtension::createHandle):
(WebKit::SandboxExtension::createHandleWithoutResolvingPath):
(WebKit::SandboxExtension::createHandleForReadWriteDirectory):
(WebKit::SandboxExtension::createHandleForTemporaryFile):
(WebKit::SandboxExtension::createHandleForGenericExtension):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::addPlatformLoadParameters):
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): Deleted.
(WebKit::WebPageProxy::scrollingUpdatesDisabledForTesting): Deleted.
(WebKit::WebPageProxy::startDrag): Deleted.
(WebKit::WebPageProxy::setPromisedDataForImage): Deleted.
(WebKit::WebPageProxy::setDragCaretRect): Deleted.
(WebKit::WebPageProxy::platformRegisterAttachment): Deleted.
(WebKit::WebPageProxy::platformCloneAttachment): Deleted.
(WebKit::WebPageProxy::performDictionaryLookupAtLocation): Deleted.
(WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection): Deleted.
(WebKit::WebPageProxy::insertDictatedTextAsync): Deleted.
(WebKit::WebPageProxy::platformDictationAlternatives): Deleted.
(WebKit::WebPageProxy::errorForUnpermittedAppBoundDomainNavigation): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorConnection): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorBoundInterfaceIdentifier): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationBundleIdentifier): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorSourceApplicationSecondaryIdentifier): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorAddMessageReceiver): Deleted.
(WebKit::WebPageProxy::paymentCoordinatorRemoveMessageReceiver): Deleted.
(WebKit::WebPageProxy::didStartSpeaking): Deleted.
(WebKit::WebPageProxy::didFinishSpeaking): Deleted.
(WebKit::WebPageProxy::didPauseSpeaking): Deleted.
(WebKit::WebPageProxy::didResumeSpeaking): Deleted.
(WebKit::WebPageProxy::speakingErrorOccurred): Deleted.
(WebKit::WebPageProxy::boundaryEventOccurred): Deleted.
(WebKit::WebPageProxy::voicesDidChange): Deleted.
(WebKit::WebPageProxy::didCreateContextInWebProcessForVisibilityPropagation): Deleted.
(WebKit::WebPageProxy::didCreateContextInGPUProcessForVisibilityPropagation): Deleted.
(WebKit::WebPageProxy::grantAccessToPreferenceService): Deleted.
(WebKit::WebPageProxy::mediaUsageManager): Deleted.
(WebKit::WebPageProxy::addMediaUsageManagerSession): Deleted.
(WebKit::WebPageProxy::updateMediaUsageManagerSessionState): Deleted.
(WebKit::WebPageProxy::removeMediaUsageManagerSession): Deleted.
(WebKit::convertPlatformImageToBitmap): Deleted.
(WebKit::WebPageProxy::requestThumbnailWithOperation): Deleted.
(WebKit::WebPageProxy::requestThumbnailWithFileWrapper): Deleted.
(WebKit::WebPageProxy::requestThumbnailWithPath): Deleted.
(WebKit::WebPageProxy::scheduleActivityStateUpdate): Deleted.
(WebKit::WebPageProxy::addActivityStateUpdateCompletionHandler): Deleted.
(WebKit::WebPageProxy::createAppHighlightInSelectedRange): Deleted.
(WebKit::WebPageProxy::restoreAppHighlightsAndScrollToIndex): Deleted.
(WebKit::WebPageProxy::setAppHighlightsVisibility): Deleted.
(WebKit::WebPageProxy::appHighlightsVisibility): Deleted.
(WebKit::WebPageProxy::appHighlightsOverlayRect): Deleted.
(WebKit::WebPageProxy::setUpHighlightsObserver): Deleted.
(WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions): Deleted.
(WebKit::WebPageProxy::canHandleContextMenuTranslation const): Deleted.
(WebKit::WebPageProxy::handleContextMenuTranslation): Deleted.
(WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): Deleted.
(WebKit::WebPageProxy::setLastNavigationWasAppInitiated): Deleted.
(WebKit::WebPageProxy::lastNavigationWasAppInitiated): Deleted.
(WebKit::WebPageProxy::grantAccessToAssetServices): Deleted.
(WebKit::WebPageProxy::revokeAccessToAssetServices): Deleted.
(WebKit::WebPageProxy::switchFromStaticFontRegistryToUserFontRegistry): Deleted.
(WebKit::WebPageProxy::fontdMachExtensionHandle): Deleted.
(WebKit::WebPageProxy::contentsOfUserInterfaceItem): Deleted.
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess): Deleted.
(WebKit::WebProcessPool::platformInvalidateContext): Deleted.
(WebKit::WebProcessPool::parentBundleDirectory): Deleted.
(WebKit::WebProcessPool::networkingCachesDirectory): Deleted.
(WebKit::WebProcessPool::webContentCachesDirectory): Deleted.
(WebKit::WebProcessPool::containerTemporaryDirectory): Deleted.
(WebKit::WebProcessPool::setJavaScriptConfigurationFileEnabledFromDefaults): Deleted.
(WebKit::WebProcessPool::omitPDFSupport): Deleted.
(WebKit::WebProcessPool::processSuppressionEnabled const): Deleted.
(WebKit::WebProcessPool::displayBrightness): Deleted.
(WebKit::WebProcessPool::backlightLevelDidChangeCallback): Deleted.
(WebKit::WebProcessPool::accessibilityPreferencesChangedCallback): Deleted.
(WebKit::WebProcessPool::mediaAccessibilityPreferencesChangedCallback): Deleted.
(WebKit::WebProcessPool::colorPreferencesDidChangeCallback): Deleted.
(WebKit::WebProcessPool::remoteWebInspectorEnabledCallback): Deleted.
(WebKit::WebProcessPool::startObservingPreferenceChanges): Deleted.
(WebKit::WebProcessPool::registerNotificationObservers): Deleted.
(WebKit::WebProcessPool::unregisterNotificationObservers): Deleted.
(WebKit::WebProcessPool::isURLKnownHSTSHost const): Deleted.
(WebKit::WebProcessPool::nominalFramesPerSecondForDisplay): Deleted.
(WebKit::WebProcessPool::startDisplayLink): Deleted.
(WebKit::WebProcessPool::stopDisplayLink): Deleted.
(WebKit::WebProcessPool::stopDisplayLinks): Deleted.
(WebKit::WebProcessPool::setDisplayLinkPreferredFramesPerSecond): Deleted.
(WebKit::WebProcessPool::setDisplayLinkForDisplayWantsFullSpeedUpdates): Deleted.
(WebKit::WebProcessPool::setCookieStoragePartitioningEnabled): Deleted.
(WebKit::WebProcessPool::clearPermanentCredentialsForProtectionSpace): Deleted.
(WebKit::networkProcessLatencyQOS): Deleted.
(WebKit::networkProcessThroughputQOS): Deleted.
(WebKit::webProcessLatencyQOS): Deleted.
(WebKit::webProcessThroughputQOS): Deleted.
(WebKit::WebProcessPool::applicationIsAboutToSuspend): Deleted.
(WebKit::WebProcessPool::notifyProcessPoolsApplicationIsAboutToSuspend): Deleted.
(WebKit::WebProcessPool::initializeClassesForParameterCoding): Deleted.
(WebKit::WebProcessPool::allowedClassesForParameterCoding const): Deleted.
(WebKit::WebProcessPool::notifyPreferencesChanged): Deleted.
(WebKit::webProcessPoolHighDynamicRangeDidChangeCallback): Deleted.
(WebKit::WebProcessPool::registerHighDynamicRangeChangeCallback): Deleted.
(WebKit::WebProcessPool::systemWillSleep): Deleted.
(WebKit::WebProcessPool::systemDidWake): Deleted.
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::publishProgress):
(WebKit::DownloadProxy::decideDestinationWithSuggestedFilename):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
(WebKit::addCameraSandboxExtensions):
(WebKit::addMicrophoneSandboxExtension):
(WebKit::addTCCDSandboxExtension):
(WebKit::gpuProcessSessionParameters):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendCreationParametersToNewProcess):
(WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
* UIProcess/SpeechRecognitionRemoteRealtimeMediaSourceManager.cpp:
(WebKit::SpeechRecognitionRemoteRealtimeMediaSourceManager::addSource):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
* UIProcess/UserMediaProcessManager.cpp:
(WebKit::UserMediaProcessManager::willCreateMediaStream):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
(WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::webProcessDataStoreParameters):
(WebKit::WebProcessPool::initializeNewWebProcess):
(WebKit::WebProcessPool::processDidFinishLaunching):
(WebKit::WebProcessPool::resumeDownload):
(WebKit::WebProcessPool::startMemorySampler):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerFileBlobURL):
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::load):
2021-08-13 Youenn Fablet <youenn@apple.com>
Overly verbose catchable fetch error messages lead to cross-origin leaks
https://bugs.webkit.org/show_bug.cgi?id=228861
Reviewed by Brent Fulgham.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceError>::encode):
(IPC::ArgumentCoder<ResourceError>::decode):
2021-08-12 Peng Liu <peng.liu6@apple.com>
REGRESSION (r280951): [ Big Sur ] TestWebKitAPI.AudioRoutingArbitration.Close is failing
https://bugs.webkit.org/show_bug.cgi?id=229040
Reviewed by Eric Carlson.
Function `AudioSessionRoutingArbitratorProxy::processDidTerminate()` should
be called only in the case that the corresponding WebContent process exits,
whereas `GPUProcessConnection::didClose()` (in WebContent process) deals with
the case that the GPU process crashes.
No new tests. Fix an API test failure.
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::gpuProcessExited):
2021-08-12 Wenson Hsieh <wenson_hsieh@apple.com>
[ iOS Debug] 3 editing/pasteboard/smart-paste-paragraph tests are flaky failing
https://bugs.webkit.org/show_bug.cgi?id=228285
rdar://81118724
Reviewed by Tim Horton and Aditya Keerthi.
Add SPI declarations. See Tools/ChangeLog for more details.
* Platform/spi/ios/TextInputSPI.h:
* Platform/spi/ios/UIKitSPI.h:
2021-08-12 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION: WebContent often crashes when using iCloud photos
https://bugs.webkit.org/show_bug.cgi?id=228969
<rdar://81761078>
Reviewed by Simon Fraser.
Terminating the GPUProcess is very stressful situation which has to be
handled carefully. The side effect of each function which is called through
gpuProcessConnectionDidClose() has to be understood to get the right
sequence of calls. There are problems in releasing all kinds of resources.
- Releasing NativeImage: Calling clearNativeImageMap() after clearing the
backend of the ImageBuffers was causing a problem. When clearing the
backend of an ImageBuffer, it will clear its DisplayList which may have
the last reference to a NativeImage. The destructor of NativeImage calls
releaseRemoteResource() before it is removed from the the NativeImageMap.
This will send a message to the relaunched GPUP to release a NativeImage
which is not in its cache.
- Releasing Font: clearFontMap() was always calling releaseRemoteResource()
even if it is called form remoteResourceCacheWasDestroyed(). This should
not happen because the connection with GPUProcess has been closed.
- Releasing ImageBuffer: This happen when a DisplayList of an ImageBuffer
'A' holds the last reference to another ImageBuffer 'B' and we call
clearBackend() for 'A'. clearBackend() will clear the DisplayList of 'A'
and causes the deletion of 'B'. In this case we should not call
releaseImageBuffer() for 'B' because the GPUPProcess is closed.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy):
If the ImageBuffer is being released because of the clean-up we do when
the GPUProcess is terminated, we should not release the corresponding
RemoteImageBuffer since it is already gone.
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::isGPUProcessConnectionClosed const):
This will return true if we are deleting a RemoteImageBufferProxy through
RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed().
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::releaseAllRemoteFonts):
This function will be used to release the remote fonts. It should be called
from RemoteResourceCacheProxy::releaseMemory() where we sure the GPUP is
alive and all the fonts are cached there.
(WebKit::RemoteResourceCacheProxy::clearFontMap):
The part of releasing the remote fonts was moved from this function to
releaseAllRemoteFonts().
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
1. Clearing the NativeImages and the Fonts has to come before clearing
the backends of the ImageBuffers. The reason is clearBackend() clears the
DisplayList which may release the last reference of a NativeImage or Font.
We want to detach the NativeImages and the Fonts from the cache before then.
2. We should have two different loops: one for clearing the backends of
the ImageBuffers and another one for recreating these backends. The reason
for this is clearBackend() clears the DisplayList which may release the
last reference of a another source RemoteImageBufferProxy used by a
DrawImageBuffer item for example.
(WebKit::RemoteResourceCacheProxy::releaseMemory):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-08-12 Sam Weinig <weinig@apple.com>
Allow testing of the final UIView tree on iOS platforms
https://bugs.webkit.org/show_bug.cgi?id=229016
Reviewed by Tim Horton.
Test: remote-layer-tree/ios/uiview-tree-basic.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(allowListedClassToString):
(dumpUIView):
(-[WKWebView _uiViewTreeAsText]):
Add partner SPI called _uiViewTreeAsText that dumps the WKWebView's
UIView tree as constructed via remote layer creation. It currently
dumps some basic properties of each view and uses an allow list of
class names so changes to implementation details in frameworks below
us, like UIKit, don't cause tests to fail.
2021-08-12 Jer Noble <jer.noble@apple.com>
[macOS] Enter fullscreen animation interferes with auto-hiding menu bar
https://bugs.webkit.org/show_bug.cgi?id=229039
<rdar://79150656>
Reviewed by Eric Carlson.
When entering fullscreen, if a user has unchecked the "auto-hide menu bar in fullscreen"
setting, the fullscreen animation will enter to the full screen frame, then snap down once
the animation completes to reveal the menu bar. Instead, use a WebCore utility method to
calculate the screen's frame taking that menu bar into account, and use it for the initial
enter fullscreen animation.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
2021-08-12 Devin Rousso <drousso@apple.com>
Fix some `NSAttributedString` inconsistencies between WK1 and WK2
https://bugs.webkit.org/show_bug.cgi?id=229013
<rdar://problem/81215696>
Reviewed by Timothy Hatcher.
`NSAttributedString` now uses WK2, which has caused us to discover some inconsistencies (and bugs).
* UIProcess/API/Cocoa/NSAttributedString.mm:
(+[_WKAttributedStringWebViewCache configuration]):
Change the default font size to 12 to match WK1.
2021-08-12 Carlos Garcia Campos <cgarcia@igalia.com>
[ATK] Critical warnings on children-changed::add signal emission
https://bugs.webkit.org/show_bug.cgi?id=229030
Reviewed by Michael Catanzaro.
Implement AtkObjectClass::ref_state_set.
* WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
(webkitWebPageAccessibilityObjectRefStateSet): Return our child state set.
(webkit_web_page_accessibility_object_class_init): Add an implementation for AtkObjectClass::ref_state_set.
2021-08-11 Peng Liu <peng.liu6@apple.com>
Function _os_feature_enabled_impl() expects compile-time static strings as arguments
https://bugs.webkit.org/show_bug.cgi?id=229017
<rdar://81813732>
Reviewed by Tim Horton.
There are multiple issues in the current implementation of `isFeatureFlagEnabled()`.
1. `_os_feature_enabled_impl()` expects compile-time static strings as arguments.
So we should not use `String` here.
2. As Simon Fraser pointed out, `String::characters8()` is not null terminated.
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::isFeatureFlagEnabled):
* Shared/WebPreferencesDefaultValues.h:
2021-08-11 Jean-Yves Avenard <jya@apple.com>
[Monterey] WebContent process immediately crash when GPU Process is disabled
https://bugs.webkit.org/show_bug.cgi?id=228944
rdar://81727094
Reviewed by Brent Fulgham.
* WebProcess/com.apple.WebProcess.sb.in: Allow SYS_getpriority syscall.
2021-08-11 Chris Dumez <cdumez@apple.com>
Add initial support for Cross-Origin-Embedder-Policy (COEP)
https://bugs.webkit.org/show_bug.cgi?id=228754
Reviewed by Alex Christensen.
As mentioned in the WebCore changelog, we do all the COEP checks in the network process
instead of WebCore for added security. As a result, we need to pass more information
to the network process when doing loads in order to do those checks. The checks are done
in NetworkResourceLoader for navigations & worker script loads (similarly to CSP,
X-FrameOptions) and in NetworkLoadChecker for CORP checks of subresource loads (similarly
to CORS checks).
* NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::NetworkLoadChecker):
(WebKit::NetworkLoadChecker::validateResponse):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::setParentCrossOriginEmbedderPolicy):
(WebKit::NetworkLoadChecker::setCrossOriginEmbedderPolicy):
* NetworkProcess/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::parentOrigin const):
(WebKit::NetworkResourceLoadParameters::encode const):
(WebKit::NetworkResourceLoadParameters::decode):
* NetworkProcess/NetworkResourceLoadParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
(WebKit::NetworkResourceLoader::shouldInterruptNavigationForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::shouldInterruptWorkerLoadForCrossOriginEmbedderPolicy):
(WebKit::NetworkResourceLoader::didReceiveResponse):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::initialize):
* NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::didReceiveResponse):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.cpp:
(WebKit::ServiceWorkerSoftUpdateLoader::processResponse):
(WebKit::ServiceWorkerSoftUpdateLoader::didFinishLoading):
* NetworkProcess/ServiceWorker/ServiceWorkerSoftUpdateLoader.h:
* NetworkProcess/cache/CacheStorageEngineCache.cpp:
(WebKit::CacheStorage::Cache::retrieveRecords):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::addParametersShared):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2021-08-11 Darin Adler <darin@apple.com>
Add deduction guide to RetainPtr, use constexpr a bit more, and streamline the implementation
https://bugs.webkit.org/show_bug.cgi?id=228852
Reviewed by Sam Weinig.
* UIProcess/mac/WKTextFinderClient.mm:
(-[WKTextFinderClient findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:]):
Test the deduction guide by writing RetainPtr instead of RetainPtr<NSProgress>.
2021-08-11 Peng Liu <peng.liu6@apple.com>
[ BigSur Debug ] TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource is flaky, hitting ASSERTION FAILED: !isInRoutingArbitrationForToken(token)
https://bugs.webkit.org/show_bug.cgi?id=227728
<rdar://problem/80237464>
Reviewed by Jer Noble.
After the GPU process crashes, the UI process will clean up the
`SharedRoutingArbitrator`, while a WebContent process might be resuming
the media playback and setup `AudioSessionRoutingArbitrator`.
There is a race condition here. If the WebContent process runs faster,
`SharedRoutingArbitrator` in the UI process will try to begin a duplicated
routing arbitration and lead to an assertion failure.
No new tests. Fixed following two API test failures:
- TestWebKitAPI.WebKit2.CrashGPUProcessWhileCapturing
- TestWebKitAPI.GPUProcess.CrashWhilePlayingAudioViaCreateMediaElementSource
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::didClose):
2021-08-11 Peng Liu <peng.liu6@apple.com>
[BigSur] TestWebKitAPI.AudioRoutingArbitration.Updating fails after r280726
https://bugs.webkit.org/show_bug.cgi?id=228966
Reviewed by Eric Carlson.
Add an IPC message `RemoteAudioSessionProxy::SetIsPlayingToBluetoothOverride`
for testing purpose, so that the test `AudioRoutingArbitration.Updating` will
work as expected when "Media in GPU Process" is enabled.
No new tests. Fix an API test failure.
* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::setCategory):
(WebKit::RemoteAudioSessionProxy::setIsPlayingToBluetoothOverride):
* GPUProcess/media/RemoteAudioSessionProxy.h:
* GPUProcess/media/RemoteAudioSessionProxy.messages.in:
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setCategory):
(WebKit::RemoteAudioSession::setIsPlayingToBluetoothOverride):
* WebProcess/GPU/media/RemoteAudioSession.h:
2021-08-11 David Kilzer <ddkilzer@apple.com>
ThreadSanitizer: data race in WTF::StringImpl::deref() under WebKit::NetworkCache::IOChannel::~IOChannel()
<https://webkit.org/b/229003>
<rdar://problem/81795626>
Reviewed by Chris Dumez.
Covered by 3245 layout tests running with TSan including:
http/wpt/service-workers/file-upload.html
* NetworkProcess/cache/NetworkCacheIOChannel.h:
(WebKit::NetworkCache::IOChannel::open):
- Update to use #pragma once.
- Make an isolatedCopy() for m_path.
(WebKit::NetworkCache::IOChannel::IOChannel):
- Switch to using an rvalue reference.
* NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
(WebKit::NetworkCache::IOChannel::IOChannel): Ditto.
* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::IOChannel): Ditto.
* NetworkProcess/cache/NetworkCacheIOChannelGLib.cpp:
(WebKit::NetworkCache::IOChannel::IOChannel): Ditto.
- Switch to use m_path instead of filePath to prevent
use-after-move.
2021-08-11 Sihui Liu <sihui_liu@apple.com>
Suspend WorkQueue of ResourceLoadStatistics and LocalStorage sooner
https://bugs.webkit.org/show_bug.cgi?id=228748
<rdar://problem/81626714>
Reviewed by Chris Dumez.
When suspending ResourceLoadStatistics and LocalStorage, we dispatched a suspend task, which waits on a
condition, to their WorkQueue. That means the queue will be suspended after completing all tasks scheduled
before the suspend task. These tasks may take a long time to complete and assertion may be timed out.
When network process receives PrepareToSuspend message, we want the queues to suspend as soon as possible. To
achieve that, now we check if the queue needs to be suspended before each task, which ensures the queue
execute as most one task after suspend().
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
(WebKit::ResourceLoadStatisticsStore::workQueue):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::sharedStatisticsQueue):
(WebKit::WebResourceLoadStatisticsStore::suspend):
(WebKit::WebResourceLoadStatisticsStore::resume):
(WebKit::WTF_GUARDED_BY_LOCK): Deleted.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* NetworkProcess/WebStorage/LocalStorageDatabase.cpp:
(WebKit::LocalStorageDatabase::create):
(WebKit::LocalStorageDatabase::LocalStorageDatabase):
* NetworkProcess/WebStorage/LocalStorageDatabase.h:
* NetworkProcess/WebStorage/LocalStorageNamespace.cpp:
(WebKit::LocalStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/LocalStorageNamespace.h:
* NetworkProcess/WebStorage/SessionStorageNamespace.cpp:
(WebKit::SessionStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/SessionStorageNamespace.h:
* NetworkProcess/WebStorage/StorageArea.cpp:
(WebKit::StorageArea::StorageArea):
* NetworkProcess/WebStorage/StorageArea.h:
* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::createLocalStorageArea):
(WebKit::StorageManager::createTransientLocalStorageArea):
(WebKit::StorageManager::createSessionStorageArea):
* NetworkProcess/WebStorage/StorageManager.h:
* NetworkProcess/WebStorage/StorageManagerSet.cpp:
(WebKit::StorageManagerSet::StorageManagerSet):
(WebKit::StorageManagerSet::suspend):
(WebKit::StorageManagerSet::resume):
* NetworkProcess/WebStorage/StorageManagerSet.h:
(WebKit::StorageManagerSet::WTF_GUARDED_BY_LOCK): Deleted.
* NetworkProcess/WebStorage/TransientLocalStorageNamespace.cpp:
(WebKit::TransientLocalStorageNamespace::getOrCreateStorageArea):
* NetworkProcess/WebStorage/TransientLocalStorageNamespace.h:
2021-08-11 Dana Estra <destra@apple.com>
Start smooth keyboard scrolling animation when pageUp or pageDown key is pressed.
https://bugs.webkit.org/show_bug.cgi?id=228156
Reviewed by Tim Horton.
UIProcess now no longer handles scrollPageUp and scrollPageDown events. They return
to eventHandler as unhandled and the keyboard scroll animation is started.
* UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView scrollPageDown:]):
(-[WKWebView scrollPageUp:]):
2021-08-11 Alex Christensen <achristensen@webkit.org>
Fix iOS debug build after r280875
https://bugs.webkit.org/show_bug.cgi?id=228683
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _removeTemporaryFilesIfNecessary]):
2021-08-11 Alex Christensen <achristensen@webkit.org>
Fix iOS debug build after r280875
​https://bugs.webkit.org/show_bug.cgi?id=228683
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _removeTemporaryFilesIfNecessary]):
2021-08-11 Per Arne <pvollan@apple.com>
[macOS] Disable menu bar related code in the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=229002
<rdar://problem/80408291>
Reviewed by Brent Fulgham.
Disable some menu bar related code running in the WebContent process on macOS, since it only makes sense to execute it in the UI process.
* WebProcess/EntryPoint/Cocoa/XPCService/WebContentService/Info-OSX.plist:
2021-08-10 Tim Horton <timothy_horton@apple.com>
Unreviewed build fix after r280875
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
2021-08-10 Chris Dumez <cdumez@apple.com>
Add Cross-Origin-Opener-Policy support for Blob URLs
https://bugs.webkit.org/show_bug.cgi?id=228924
Reviewed by Alex Christensen.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLFromURL):
(WebKit::NetworkConnectionToWebProcess::registerBlobURLOptionallyFileBacked):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:
2021-08-10 Tim Horton <timothy_horton@apple.com>
Unreviewed build fix.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(stringForTLSProtocolVersion):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
Ignore some slightly less unconventional deprecation warnings.
2021-08-10 Alex Christensen <achristensen@webkit.org>
WebKitBlobResource error 1 exactly after 60 seconds when trying to read file input
https://bugs.webkit.org/show_bug.cgi?id=228683
<rdar://78448610>
Reviewed by Tim Horton.
To prevent UIKit from deleting our files to upload after 60 seconds, copy them to a temporary directory,
then delete the files when cleaning up the WKContentView.
I manually verified this makes the files able to upload after more than 60 seconds, then deletes them when you close the tab.
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView dealloc]):
(-[WKContentView _removeTemporaryFilesIfNecessary]):
(-[WKContentView _removeTemporaryFilesWhenDeallocated:]):
* UIProcess/ios/WKContentViewInteraction.h.orig: Added.
* UIProcess/ios/WKContentViewInteraction.mm.orig: Added.
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
2021-08-10 Andres Gonzalez <andresg_22@apple.com>
Notify accessibility that WebProcess is suspended when in process cache.
https://bugs.webkit.org/show_bug.cgi?id=228936
rdar://80911502
Reviewed by Chris Dumez.
Need to notify accessibility clients that a WebProcess in the process
cache is suspended. Otherwise accessibility clients may continue making
requests to the cached Webprocess and be waiting indefinitely for a
suspended process.
Deleted WebProcess::accessibilityProcessSuspendedNotification and
instead use IPC::AccessibilityProcessSuspendedNotification
* Platform/IPC/Connection.h:
* Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::AccessibilityProcessSuspendedNotification):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setIsInProcessCache):
(WebKit::WebProcess::prepareToSuspend):
(WebKit::WebProcess::processDidResume):
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityProcessSuspendedNotification): Deleted.
2021-08-10 Kimmo Kinnunen <kkinnunen@apple.com>
Scripts/generate-derived-sources.sh: line 19: [: binary operator expected while building Source/WebKit
https://bugs.webkit.org/show_bug.cgi?id=228908
Reviewed by Per Arne Vollan.
Change variable references in the sh script to quoted "$VAR".
[ -z $VAR ] with VAR="a b" would mean
[ -z a b ].
-z is unary operator, so the expression b would be in position
where test would expect an operator.
The correct form is [ -z "a b" ].
In general, sh scripts usually refer to variables using quotes.
* Scripts/generate-derived-sources.sh:
Fix a bug where multiple space separated paths in
WEBKITADDITIONS_HEADER_SEARCH_PATHS would cause
test expression to receive arguments after the -z arg.
Quote the use of CC so future copy-paste does not make the same mistake
as this bug.
2021-08-10 Peng Liu <peng.liu6@apple.com>
RemoteImageDecoderAVF::clearFrameBufferCache() uses a weak pointer without checking its validity
https://bugs.webkit.org/show_bug.cgi?id=228925
Reviewed by Eric Carlson.
Only use `m_gpuProcessConnection` when it is a valid pointer.
* WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::clearFrameBufferCache):
2021-08-10 Megan Gardner <megan_gardner@apple.com>
Don't instantiate a SYNotesActivationObserver to just say that it's not active or visible.
https://bugs.webkit.org/show_bug.cgi?id=228929
rdar://81634182
Reviewed by Wenson Hsieh.
If we do not have an SYNotesActivationObserver then we do not need to make one to say that it is not visible
or that it's not occuding the screen. This is a performance optimization for all WebViews that are not
in Safari as well as all pages that do not have highlights to restore.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::appHighlightsVisibility):
(WebKit::WebPageProxy::appHighlightsOverlayRect):
2021-08-10 David Kilzer <ddkilzer@apple.com>
ThreadSanitizer: data race in WTF::StringImpl::deref() under WebKit::WebProcessPool::setMediaAccessibilityPreferences()
<https://webkit.org/b/228932>
Reviewed by Chris Dumez.
Covered by numerous layout tests running with TSan including:
crypto/crypto-random-values-types.html
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::setMediaAccessibilityPreferences):
- Make an isolatedCopy() of Vector<String> object before passing
it to the main thread.
2021-08-09 Chris Dumez <cdumez@apple.com>
Blob URL changes after loading it
https://bugs.webkit.org/show_bug.cgi?id=228923
Reviewed by Geoff Garen.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLHandle):
(WebKit::NetworkConnectionToWebProcess::unregisterBlobURLHandle):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createBlobRegistry):
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURLHandle):
(WebKit::BlobRegistryProxy::unregisterBlobURLHandle):
* WebProcess/FileAPI/BlobRegistryProxy.h:
2021-08-09 Myles C. Maxfield <mmaxfield@apple.com>
Create a Language log channel
https://bugs.webkit.org/show_bug.cgi?id=228764
Reviewed by Simon Fraser.
* Platform/Logging.h:
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::setAppleLanguagesPreference):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setOverrideLanguages):
(WebKit::WebProcessPool::initializeNewWebProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::userPreferredLanguagesChanged const):
2021-08-09 Myles C. Maxfield <mmaxfield@apple.com>
Support WTF logging channels
https://bugs.webkit.org/show_bug.cgi?id=228768
Reviewed by Fujii Hironori.
No new tests because there is no behavior change.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* GPUProcess/GPUProcessCreationParameters.cpp:
(WebKit::GPUProcessCreationParameters::encode const):
(WebKit::GPUProcessCreationParameters::decode):
* GPUProcess/GPUProcessCreationParameters.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/GPUProcessProxyCocoa.mm:
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/WebProcessPool.cpp:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-08-09 Said Abou-Hallawa <said@apple.com>
Ease sandboxing restrictions for Mail to allow HEIF image decoding
https://bugs.webkit.org/show_bug.cgi?id=228812
<rdar://80967782>
Reviewed by Per Arne Vollan.
If the running application is Mail, add a sandbox extension to allow HEIF
image decoding. There is no plan right now to enable HEIF in WebKit. So
do not try to support decoding it outside Mail.
* 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::WebProcess::initializeSandbox):
(WebKit::restrictImageAndVideoDecoders): Deleted.
2021-08-09 Jer Noble <jer.noble@apple.com>
[Cocoa|GPU] platformLayer() not always added to remotedly hosted context; black video while playing
https://bugs.webkit.org/show_bug.cgi?id=228873
<rdar://81271107>
Reviewed by Eric Carlson.
Currently, the RemoteMediaPlayerProxy will insert its MediaPlayer's platformLayer() into the
remotely hosted context when it receives a "firstVideoFrameAvailable()" notification.
However this is problematic for two reasons: AVPlayerLayer may not become "ready for
playback" when it is not in an active CALayer heirarchy, and for
MediaPlayerPrivateAVFoundation, firstVideoFrameAvailable() is only fired during
updateStates(), which is not guaranteed to occur unless another state change occurs.
Instead, reparent the MediaPlayer's platformLayer() when we receive a
mediaPlayerRenderingModeChanged() notification, which notifies the client whenever a
platformLayer() is created or destroyed.
* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable):
(WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged):
2021-08-09 Imanol Fernandez <ifernandez@igalia.com>
Implement fullscreen in WPEView
https://bugs.webkit.org/show_bug.cgi?id=227951
Reviewed by Adrian Perez de Castro.
Notify DOM fullscreen enter request to libwpe and handle exit fullscreen from libwpe.
* UIProcess/API/wpe/WPEView.cpp:
(WKWPE::m_backend):
(WKWPE::View::setFullScreen):
* UIProcess/API/wpe/WPEView.h:
2021-08-09 Imanol Fernandez <ifernandez@igalia.com>
Allow custom IPC::Attachment messaging in ConnectionUnix.cpp
https://bugs.webkit.org/show_bug.cgi?id=227740
Reviewed by Žan Doberšek.
In order to share AHardwareBuffer handles via IPC we need to use the AHardwareBuffer_sendHandleToUnixSocket()
and AHardwareBuffer_recvHandleFromUnixSocket() functions. This is not currently compatible with the Attachment
API used in UnixConnection, as those functions use custom messaging into the socked fd.
This patch adds a CustomWriterType Attachment that allows custom messaging going into the socket fd.
* Platform/IPC/unix/ConnectionUnix.cpp:
2021-08-08 Wenson Hsieh <wenson_hsieh@apple.com>
caret-color does not work on first click in ios
https://bugs.webkit.org/show_bug.cgi?id=228859
rdar://81674787
Reviewed by Tim Horton.
Addresses a couple of issues that cause the `caret-color` CSS property to not be applied when focusing editable
content on iOS. See below for more details.
Test: editing/caret/ios/caret-color-after-refocusing-input.html
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _serializedSelectionCaretBackgroundColorForTesting]):
Add support for a new test-only helper method. See Tools/ChangeLog for more information.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
(WebKit::operator==):
(WebKit::operator<<):
Make a minor adjustment to ensure that changes to `caretColor` in `EditorState` are propagated to UIKit's
selection views. To achieve this, we add `caretColor` to `WKSelectionDrawingInfo`, and force the text selection
view to update the caret background color when the caret color changes (alongside other selection UI geometry
changes, which are applied underneath the call to `-selectionChanged`).
(-[WKContentView _updateChangedSelection:]):
(-[WKContentView textInteractionAssistant]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPlatformEditorState const):
Address an existing FIXME which (mostly) fixes this bug. Currently, the caret color is only computed when
`WebPage::m_focusedElement` is set. However, when resigning first responder, we clear out `WebPage`'s
`m_focusedElement`) right before updating the DOM selection, which creates a brief window during which we
compute an `EditorState` with a `caretColor` of transparent black.
To avoid this inconsistency, we instead compute the caret color from the selection container; this has the
additional benefit of allowing the caret color to change when changing selection within a single editable host
with multiple caret colors (instead of always just using the focused element's caret color).
Note that while this adjustment to `WebPage::getPlatformEditorState` is sufficient to ensure that the value of
`-[WKContentView insertionPointColor]` (which is based on `EditorState`) is always up-to-date, this doesn't
guarantee that the actual color of UIKit's caret view reflects the updated `-insertionPointColor`, which results
in situations where the caret color appears out-of-date after hiding the keyboard and refocusing an input field.
To fix this, we need the other adjustment in WKContentView (see above).
2021-08-07 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS] Web process crashes when detaching Document with uncommitted marked text
https://bugs.webkit.org/show_bug.cgi?id=228841
rdar://79960890
Reviewed by Ryosuke Niwa.
Deploy a similar fix on iOS, to avoid any attempts to compute editor state due to discarding uncommitted marked
text during Document teardown. This is required in order to avoid the same security assertion when running the
new layout test on iOS.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendEditorStateUpdate):
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* Platform/LogInitialization.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp.
(WebKit::logChannels):
(WebKit::getLogChannel):
* Platform/LogInitialization.h:
* Platform/Logging.cpp:
(WebKit::initializeLogChannelsIfNecessary): Deleted.
(WebKit::getLogChannel): Deleted.
* Platform/Logging.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* Sources.txt:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-08-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, reverting r280756.
https://bugs.webkit.org/show_bug.cgi?id=228897
Broke gtk build
Reverted changeset:
"Deduplicate logging channel algorithms"
https://bugs.webkit.org/show_bug.cgi?id=228809
https://commits.webkit.org/r280756
2021-08-07 Myles C. Maxfield <mmaxfield@apple.com>
Deduplicate logging channel algorithms
https://bugs.webkit.org/show_bug.cgi?id=228809
Reviewed by Fujii Hironori.
* GPUProcess/GPUConnectionToWebProcess.cpp:
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::initializeGPUProcess):
* Platform/LogInitialization.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp.
(WebKit::logChannels):
(WebKit::getLogChannel):
* Platform/LogInitialization.h:
* Platform/Logging.cpp:
(WebKit::initializeLogChannelsIfNecessary): Deleted.
(WebKit::getLogChannel): Deleted.
* Platform/Logging.h:
* Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
* Sources.txt:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
2021-08-06 Simon Fraser <simon.fraser@apple.com>
Clarify some identifier naming in RemoteRenderingBackend
https://bugs.webkit.org/show_bug.cgi?id=228886
Reviewed by Said Abou-Hallawa.
Rename some "identifier" variables to differentiate between resource identifiers and
item buffer identifiers.
No behavior change.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::createImageBuffer):
(WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList):
(WebKit::RemoteRenderingBackend::cacheNativeImage):
(WebKit::RemoteRenderingBackend::cacheFont):
(WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle):
2021-08-06 Simon Fraser <simon.fraser@apple.com>
Page on mhlw.go.jp triggers WebContent termination by GPU process
https://bugs.webkit.org/show_bug.cgi?id=228885
<rdar://81603231>
Reviewed by Wenson Hsieh.
https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/0000164708_00001.html triggered an issue
where RemoteRenderingBackend::finalizeRenderingUpdate() would be called when the
GPU process had just processed a "switching to next item buffer" meta command,
but had not yet received the new item buffer. This triggered the
MESSAGE_CHECK(initialHandle, "Missing initial shared display list handle");
in RemoteRenderingBackend::wakeUpAndApplyDisplayList().
Protect against this by having finalizeRenderingUpdate() check that
arguments.itemBufferIdentifier had been received, which is similar to what happens
inside the loop in wakeUpAndApplyDisplayList() already.
Not easily testable.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::finalizeRenderingUpdate):
2021-08-06 Tim Horton <timothy_horton@apple.com>
Disable WKHoverPlatter for now
https://bugs.webkit.org/show_bug.cgi?id=228880
Reviewed by Wenson Hsieh.
* UIProcess/ios/WKHoverPlatterParameters.mm:
(-[WKHoverPlatterParameters setDefaultValues]):
Flip the switch.
2021-08-06 Tim Horton <timothy_horton@apple.com>
REGRESSION (r185111): Links to App Store doesn't work when opening a PDF in Safari on iOS and iPadOS
https://bugs.webkit.org/show_bug.cgi?id=228881
rdar://81294035
Reviewed by Andy Estes.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
Clicking a link in PDF should absolutely be allowed to launch an external app.
Humorously, r185111 applied the correct value to PDFPlugin (macOS), but the
wrong value to WKPDFView (iOS). Bring them into alignment.
2021-08-06 Fujii Hironori <Hironori.Fujii@sony.com>
ASSERTION FAILED: !m_networkLoad in NetworkResourceLoader::~NetworkResourceLoader()
https://bugs.webkit.org/show_bug.cgi?id=228853
Reviewed by Alex Christensen.
~NetworkResourceLoader() had the assertion ensuring m_networkLoad
was empty. But, this could fail in the following scenario. If a
'keepalive' fetch request is not finished and the page is
navigated away, its NetworkResourceLoader is transferred to the
NetworkSession by NetworkConnectionToWebProcess::transferKeptAliveLoad.
And, before the request is finished, if the NetworkSession is
destroyed, the kept alive NetworkResourceLoader is destroyed.
Test: http/tests/fetch/keepalive-fetch.html
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::~NetworkSession): Abort m_keptAliveLoads.
2021-08-06 Aditya Keerthi <akeerthi@apple.com>
[macOS] 3 second IPC deadlocks involving WebPageProxy::acceptsFirstMouse
https://bugs.webkit.org/show_bug.cgi?id=228834
rdar://75390908
Reviewed by Wenson Hsieh and Tim Horton.
Reports show 3 second hangs in WebPageProxy::acceptsFirstMouse, which is
the timeout for the sync IPC sent by the method. While this method has
always sent a sync IPC, logs show the WebProcess is also blocked on sync
IPC, under WebProcess::ensureGPUProcessConnection.
If a Web<->GPU process connection has not been established,
WebProcess::ensureGPUProcessConnection sends a sync IPC from the
WebProcess to the UIProcess to establish get the connection. However, to
get the connection, the UIProcess then sends an async IPC with a reply
block to the GPUProcess (see GPUProcessProxy::getGPUProcessConnection).
The WebProcess remains blocked until the UIProcess receives the reply
from the GPUProcess, and then sends a reply to the WebProcess.
Now, if a call to acceptsFirstMouse occurs in between the time the async
UIProcess -> GPUProcess IPC is sent, and the reply is received, we will
experience deadlock. The UIProcess will be blocked waiting on the
WebProcess' reply to acceptsFirstMouse, and the reply from the GPUProcess
will not be dispatched. Since the reply from the GPUProcess will not be
dispatched until the UIProcess is unblocked, the WebProcess will be
waiting under WebProcess:ensureGPUProcessConnection, and unable to reply
to acceptsFirstMouse.
A simple fix for the described scenario would be to introduce a
replySendOptions parameter to sendWithAsyncReply, so that the UIProcess
could be re-entered to dispatch the GPUProcess reply, even when waiting
for acceptsFirstMouse. However, this will not work in cases where the
GPUProcess is being launched, due to being blocked on the reply from
xpc_connection_send_message_with_reply in ProcessLauncherMac, which is
before the IPC::Connection has been established.
Since re-entering the UIProcess is not possible in this scenario, given
the existing architecture, the next simplest solution is to re-enter
the WebProcess on acceptsFirstMouse instead. Consequently, one part of
the fix involves sending the acceptsFirstMouse IPC with
IPC::SendOption::DispatchMessageEvenWhenWaitingForUnboundedSyncReply and
tagging WebProcess::getGPUProcessConnection as unbounded sync IPC.
Then, we must also consider the fact that, in the WebProcess,
acceptsFirstMouse performs hit-testing. Hit-testing triggers layout and
could cause script to run. Script could result in a GPUProcess connection
being established, eventually leading us down the path towards the
aforementioned deadlock. To avoid deadlock in this scenario, we need to
interrupt acceptsFirstMouse if a message to get the GPUProcess connection
is received. This is achieved by using waitForAndDispatchImmediately with
the InterruptWaitingIfSyncMessageArrives option, and splitting up
acceptsFirstMouse into two separate IPCs.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
Implementation not required for iOS.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::acceptsFirstMouse):
Send an async IPC with IPC::SendOption::DispatchMessageEvenWhenWaitingForUnboundedSyncReply
so that the WebProcess can be re-entered to resolve deadlock if
necessary. Then, use waitForAndDispatchImmediately to wait for the reply
(essentially making it a sync IPC), so that the wait can be interrupted
if another sync message, such as getGPUProcessConnection, is received.
(WebKit::WebPageProxy::handleAcceptsFirstMouse):
Store the result of the reply from the WebProcess.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Split the sync IPC into two async IPCs, in order to support the use of
waitForAndDispatchImmediately.
* WebProcess/WebPage/ios/WebPageIOS.mm:
Implementation not required for iOS.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::requestAcceptsFirstMouse):
Exit early if re-entering the WebProcess, to avoid running script on
re-entry.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getGPUProcessConnection):
Tag as unbounded sync IPC, so the WebProcess can be re-entered to
resolve deadlock.
2021-08-06 Youenn Fablet <youenn@apple.com>
WebKit::SampleBufferDisplayLayer needs to handle GPUProcess crash
https://bugs.webkit.org/show_bug.cgi?id=228824
<rdar://problem/81564477>
Reviewed by Eric Carlson.
Make WebKit::SampleBufferDisplayLayer listen to GPUProcess connection being closed.
When that happens, notify its client that it failed.
* WebProcess/GPU/GPUProcessConnection.cpp:
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::create):
(WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
(WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
(WebKit::SampleBufferDisplayLayer::setDidFail):
(WebKit::SampleBufferDisplayLayer::gpuProcessConnectionDidClose):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
(WebKit::SampleBufferDisplayLayerManager::createLayer):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h:
2021-08-06 Peng Liu <peng.liu6@apple.com>
[macOS] Clean up Feature Flags related code
https://bugs.webkit.org/show_bug.cgi?id=228803
<rdar://problem/81142982>
Reviewed by Tim Horton.
On macOS, Safari Technology Preview or a local build WebKit/Safari will always
get the default preference values through the "Feature Flags" SPI. Unfortunately,
this approach won't work if the OS does not provide correct default preference values.
With this patch, we only get default preference values with the SPI for system
WebKit on macOS. For all other cases, we use hardcoded values. So that
WebKit will always get the correct default preference values.
This patch also fixes a few mistakes in two preferences: "webm_webaudio" and "vp8_decoder".
* FeatureFlags/WebKit-appletvos.plist:
* FeatureFlags/WebKit-ios.plist:
* FeatureFlags/WebKit-macos.plist:
* FeatureFlags/WebKit-watchos.plist:
* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::isFeatureFlagEnabled):
(WebKit::defaultAsyncFrameAndOverflowScrollingEnabled):
(WebKit::defaultUseGPUProcessForCanvasRenderingEnabled):
(WebKit::defaultUseGPUProcessForDOMRenderingEnabled):
(WebKit::defaultUseGPUProcessForMediaEnabled):
(WebKit::defaultUseGPUProcessForWebGLEnabled):
(WebKit::defaultCaptureAudioInGPUProcessEnabled):
(WebKit::defaultCaptureVideoInGPUProcessEnabled):
(WebKit::defaultWebRTCCodecsInGPUProcess):
(WebKit::defaultIncrementalPDFEnabled):
(WebKit::defaultWebMFormatReaderEnabled):
(WebKit::defaultVP8DecoderEnabled):
(WebKit::defaultVP9DecoderEnabled):
(WebKit::defaultVP9SWDecoderEnabledOnBattery):
(WebKit::defaultWebMParserEnabled):
(WebKit::defaultWebMWebAudioEnabled):
(WebKit::defaultInAppBrowserPrivacy): Deleted.
* Shared/WebPreferencesDefaultValues.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Fix a typo.
2021-08-06 Jer Noble <jer.noble@apple.com>
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
<rdar://problem/81336280>
Reviewed by Eric Carlson.
Drive-by fix: we're passing the wrong value into acceleratedRenderingStateChanged(), and
we're not setting the correct initial value on MediaPlayerPrivateRemote creation.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
2021-08-06 Eric Carlson <eric.carlson@apple.com>
REGRESSION: ASSERTION FAILED: !DeprecatedGlobalSettings::shouldManageAudioSessionCategory() || AudioSession::sharedSession().category() == AudioSession::CategoryType::PlayAndRecord
https://bugs.webkit.org/show_bug.cgi?id=228847
<rdar://problem/81587101>
Reviewed by Jer Noble.
No new tests, fixes a crashing test.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::audioUnitWillStart): Restore.
2021-08-05 Kate Cheney <katherine_cheney@apple.com>
LoadWebArchive.FailNavigation1 test is a false positive
https://bugs.webkit.org/show_bug.cgi?id=228848
<rdar://problem/81587448>
Reviewed by Brent Fulgham.
Drive by logging fix.
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::fetchWebsiteData):
(WebKit::WebProcessProxy::deleteWebsiteData):
2021-08-05 Eric Carlson <eric.carlson@apple.com>
[iOS] getUserMedia sometimes doesn't capture from specified microphone
https://bugs.webkit.org/show_bug.cgi?id=228753
rdar://79704226
Reviewed by Youenn Fablet.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Re
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::audioUnitWillStart): Delete,
we don't need it now that the web process configures the audio session before
capture begins.
2021-08-05 Youenn Fablet <youenn@apple.com>
GPUProcessProxy should send tccd mach lookup sandbox extension
https://bugs.webkit.org/show_bug.cgi?id=228827
Reviewed by Per Arne Vollan.
In https://bugs.webkit.org/show_bug.cgi?id=225319, I mistakenly moved from mach lookup extension to generic extension.
Reverting that change.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::addTCCDSandboxExtension):
2021-08-05 Eric Carlson <eric.carlson@apple.com>
[GPUP] RemoteAudioSessionProxyManager should use the shared audio session
https://bugs.webkit.org/show_bug.cgi?id=228795
<rdar://problem/81530450>
Reviewed by Jer Noble.
RemoteAudioSessionProxyManager creates and uses a private AudioSession, which means
that any code that moves from the WebProcess to the GPUProcess and uses
`AudioSession::sharedSession` will be using a separate platform audio session wrapper
object. RemoteAudioSessionProxyManager doesn't need a private AudioSession, so
change it to use `AudioSession::sharedSession`.
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager): Don't
create a new AudioSession.
(WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager): Use
AudioSession::sharedSession().
(WebKit::RemoteAudioSessionProxyManager::updateCategory): Ditto.
(WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess): Ditto.
(WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess): Ditto.
2021-08-05 Wenson Hsieh <wenson_hsieh@apple.com>
[macOS Monterey] Translate popover becomes detached from webpage after scrolling
https://bugs.webkit.org/show_bug.cgi?id=228807
rdar://81540115
Reviewed by Sam Weinig.
Close the context menu translation popover in `WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly`
(along with all other content-relative UI) to prevent the popover from being detached from its translated text
upon scrolling or zooming.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
(WebKit::WebViewImpl::handleContextMenuTranslation):
Save a weak pointer to the current translation popover when we're about to present it, and use it to force the
popover to `-close` when dismissing content-relative child windows. Also take this opportunity to remove some
staging declarations on LTUITranslationViewController that have long since landed in the macOS 12 SDK.
2021-08-05 Michael Catanzaro <mcatanzaro@gnome.org>
GCC 11 builds should use -Wno-array-bounds, -Wno-nonnull
https://bugs.webkit.org/show_bug.cgi?id=228601
Reviewed by Carlos Garcia Campos.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::Stream::~Stream):
2021-08-05 Imanol Fernandez <ifernandez@igalia.com>
Fix XR related clang warnings in WPE
https://bugs.webkit.org/show_bug.cgi?id=228779
Reviewed by Sam Weinig.
Fix a few compiler warnings.
* Shared/XR/XRDeviceProxy.cpp:
(WebKit::XRDeviceProxy::views const):
2021-08-04 Tim Horton <timothy_horton@apple.com>
Bifurcated RemoteLayerBackingStore zooms in every time it repaints
https://bugs.webkit.org/show_bug.cgi?id=228798
Reviewed by Sam Weinig.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display):
If applying the scale/flip workaround manually, we need to save the
GraphicsContext state, or it leaks between paints.
2021-08-04 Jean-Yves Avenard <jya@apple.com>
Use Observer in place of VideoFullscreenManagerProxyClient
https://bugs.webkit.org/show_bug.cgi?id=228761
rdar://problem/81489026
Reviewed by Jer Noble.
Use an Observer member rather than creating a child class that would be used
when the PiP state change. This prevents having to deal with lifetime and
potentially setting it up multiple times.
No change in observable behaviour, covered with existing tests.
* UIProcess/Cocoa/VideoFullscreenManagerProxy.h: Remove VideoFullscreenManagerProxyClient
class. Use WeakHashSet to store observers.
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::addVideoInPictureInPictureDidChangeObserver):
Method added, replace older setClient
(WebKit::VideoFullscreenManagerProxy::hasVideoInPictureInPictureDidChange):
Iterate over all observers and call accordingly.
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController initWithWebView:]): Remove no longer necessary
code.
(-[WKFullScreenWindowController dealloc]): Remove no longer necessary
code.
(-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
set PiP change observer if none already exists.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController initWithWindow:webView:page:]): Remove no longer necessary
code.
(-[WKFullScreenWindowController dealloc]): Remove no longer necessary
code.
(-[WKFullScreenWindowController clearVideoFullscreenManagerObserver]):
(-[WKFullScreenWindowController setVideoFullscreenManagerObserver]):
(-[WKFullScreenWindowController didExitPictureInPicture]):
(-[WKFullScreenWindowController windowDidEnterFullScreen:]):
(-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
2021-08-04 Tim Horton <timothy_horton@apple.com>
RemoteLayerBackingStore: Adopt a new bifurcated layer switch
https://bugs.webkit.org/show_bug.cgi?id=228800
<rdar://problem/81534641>
Reviewed by Sam Weinig.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
Let CA know that we're going to hand it both a display list and
backing store ahead of time by setting a new bit.
2021-08-04 Peng Liu <peng.liu6@apple.com>
[Catalina][GPUP] Some API tests fail after GPU Process features are enabled
https://bugs.webkit.org/show_bug.cgi?id=228589
Reviewed by Jer Noble.
When an audio session's configuration changes, let `RemoteAudioSessionProxy`
in the GPU process send the latest audio session configuration to `RemoteAudioSession`
in the WebContent process through an IPC message (`RemoteAudioSession::ConfigurationChanged`).
* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::configurationChanged):
* GPUProcess/media/RemoteAudioSessionProxy.h:
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager):
(WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager):
(WebKit::RemoteAudioSessionProxyManager::beginAudioSessionInterruption):
(WebKit::RemoteAudioSessionProxyManager::endAudioSessionInterruption):
(WebKit::RemoteAudioSessionProxyManager::hardwareMutedStateDidChange):
(WebKit::RemoteAudioSessionProxyManager::bufferSizeDidChange):
(WebKit::RemoteAudioSessionProxyManager::sampleRateDidChange):
(WebKit::RemoteAudioSessionProxyManager::configurationDidChange):
* GPUProcess/media/RemoteAudioSessionProxyManager.h:
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::addConfigurationChangeObserver):
(WebKit::RemoteAudioSession::removeConfigurationChangeObserver):
(WebKit::RemoteAudioSession::configurationChanged):
* WebProcess/GPU/media/RemoteAudioSession.h:
* WebProcess/GPU/media/RemoteAudioSession.messages.in:
2021-08-04 Simon Fraser <simon.fraser@apple.com>
Crash in DisplayLink::notifyObserversDisplayWasRefreshed() on macOS
https://bugs.webkit.org/show_bug.cgi?id=228790
<rdar://81338621>
Reviewed by Tim Horton.
Defend against DisplayLink::nominalFramesPerSecondFromDisplayLink() returning zero,
which can result in a later divide by zero in m_currentUpdate.nextUpdate().
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
2021-08-04 Said Abou-Hallawa <said@apple.com>
[GPUProcess] REGRESSION: A noticeable slow down when browsing Live Photos album on iCloud.com
https://bugs.webkit.org/show_bug.cgi?id=228673
<rdar://81353138>
Reviewed by Wenson Hsieh.
RemoteImageBufferProxy::flushDrawingContext() assumes a FlushContext item
is always appended to its DisplayList when it calls flushDrawingContextAsync()
and this is why it waits up to 3 seconds for the DidFlush message. But this
does not happen if the DisplayList of RemoteImageBufferProxy is empty.
In addition to checking whether the DisplayList is empty, we can check also
whether we do not have pending a FlushContext item before appending a new
one.
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
2021-08-04 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS 15] "Look Up" action is sometimes missing after force pressing images
https://bugs.webkit.org/show_bug.cgi?id=228774
rdar://78040734
Reviewed by Devin Rousso.
On iOS devices that support both 3D Touch and Visual Look Up (i.e., iPhone XS and iPhone XS Max), it's currently
possible to skip the image analysis preflight gesture entirely when showing the context menu over images in the
case where the user triggers the interaction by exceeding the force press threshold in under 100 ms (the current
delay of the image analysis long press gesture).
Mitigate this by teaching WKImageAnalysisGestureRecognizer to trigger image analysis preflight slightly ahead of
the context menu interaction when performing a force press by transitioning to Began state early under
`-touchesBegan:withEvent:` and `-touchesMoved:withEvent:`, if the touch's force exceeds a certain (relatively
low) threshold.
* UIProcess/ios/WKImageAnalysisGestureRecognizer.mm:
(-[WKImageAnalysisGestureRecognizer touchesBegan:withEvent:]):
(-[WKImageAnalysisGestureRecognizer touchesMoved:withEvent:]):
(-[WKImageAnalysisGestureRecognizer beginAfterExceedingForceThresholdIfNeeded:]):
2021-08-04 Per Arne <pvollan@apple.com>
[macOS] Update message filters
https://bugs.webkit.org/show_bug.cgi?id=228773
<rdar://problem/81514311>
Reviewed by Brent Fulgham.
Update message filters with enforcement on macOS based on telemetry.
* WebProcess/com.apple.WebProcess.sb.in:
2021-08-04 Said Abou-Hallawa <said@apple.com>
[GPU Process] REGRESSION: iCloud Photos Web app may crash WebProcess once the GPUProcess is relaunched
https://bugs.webkit.org/show_bug.cgi?id=228665
Reviewed by Simon Fraser.
When the GPUProcess is relaunched, ensure NativeImage is detached from
the RemoteResourceCacheProxy once it is removed from its m_nativeImages.
Otherwise the NativeImage later will ask RemoteResourceCacheProxy to
release its corresponding NativeImage from RemoteResourceCache even
though it was destroyed when the GPUProcess was relaunched.
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
(WebKit::RemoteResourceCacheProxy::~RemoteResourceCacheProxy):
(WebKit::RemoteResourceCacheProxy::clearNativeImageMap):
(WebKit::RemoteResourceCacheProxy::remoteResourceCacheWasDestroyed):
* WebProcess/GPU/graphics/RemoteResourceCacheProxy.h:
2021-08-03 Jean-Yves Avenard <jya@apple.com>
REGRESSION (r280568): ASSERTION FAILED: videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient
https://bugs.webkit.org/show_bug.cgi?id=228740
rdar://problem/81464301
Reviewed by Jer Noble.
Fix assertion to reflect that the code can be code in two ways.
This will all go away following bug 228761.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController setVideoFullscreenManagerClient:]):
2021-08-03 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, reverting r280531 and r280589.
caused
Reverted changesets:
"[Cocoa] Remove support for AVAssetImageGenerator"
https://bugs.webkit.org/show_bug.cgi?id=228560
https://commits.webkit.org/r280531
"REGRESSION (r280531): multiple modern-media-controls tests
have become flaky timeouts"
https://bugs.webkit.org/show_bug.cgi?id=228714
https://commits.webkit.org/r280589
2021-08-03 Brent Fulgham <bfulgham@apple.com>
[iOS] Allow check for nvram "emu" state on internal OS builds
https://bugs.webkit.org/show_bug.cgi?id=228745
<rdar://problem/78363040>
Reviewed by Per Arne Vollan.
Allow access to the 'emu' nvram variable when running on an Apple Internal OS build. This
reduces spurious sandbox violation reports, and improves the performance of test systems.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb.in:
2021-08-03 Tim Horton <timothy_horton@apple.com>
Remove unused processDidTransitionTo{Foreground,Background} IPC
https://bugs.webkit.org/show_bug.cgi?id=228328
Reviewed by Wenson Hsieh.
* GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::processDidTransitionToForeground): Deleted.
(WebKit::GPUProcess::processDidTransitionToBackground): Deleted.
* GPUProcess/GPUProcess.h:
* GPUProcess/GPUProcess.messages.in:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processDidTransitionToForeground): Deleted.
(WebKit::NetworkProcess::processDidTransitionToBackground): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformProcessDidTransitionToBackground): Deleted.
(WebKit::NetworkProcess::platformProcessDidTransitionToForeground): Deleted.
* NetworkProcess/curl/NetworkProcessCurl.cpp:
(WebKit::NetworkProcess::platformProcessDidTransitionToForeground): Deleted.
(WebKit::NetworkProcess::platformProcessDidTransitionToBackground): Deleted.
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformProcessDidTransitionToForeground): Deleted.
(WebKit::NetworkProcess::platformProcessDidTransitionToBackground): Deleted.
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::updateProcessAssertion):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::updateProcessAssertion):
* UIProcess/WebAuthentication/WebAuthnProcessProxy.cpp:
(WebKit::WebAuthnProcessProxy::updateProcessAssertion):
* WebAuthnProcess/WebAuthnProcess.cpp:
(WebKit::WebAuthnProcess::processDidTransitionToForeground): Deleted.
(WebKit::WebAuthnProcess::processDidTransitionToBackground): Deleted.
* WebAuthnProcess/WebAuthnProcess.h:
* WebAuthnProcess/WebAuthnProcess.messages.in:
These messages do nothing.
2021-08-03 Per Arne <pvollan@apple.com>
[iOS] Fix sandbox violation in GPU process
https://bugs.webkit.org/show_bug.cgi?id=228743
<rdar://problem/81334849>
Reviewed by Brent Fulgham.
Allow reading "hw.product" in the GPU process' sandbox.
* Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
2021-08-03 Devin Rousso <drousso@apple.com>
[Live Text] [iOS] Provide a presenting `UIViewController` for machine readable code actions so that they are related to the same view
https://bugs.webkit.org/show_bug.cgi?id=228722
Reviewed by Tim Horton.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateContextMenuForMachineReadableCodeForImageAnalysis:]): Added.
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
2021-08-02 Peng Liu <peng.liu6@apple.com>
[GPUP] RemoteAudioSession::setPreferredBufferSize() does not change its preferredBufferSize
https://bugs.webkit.org/show_bug.cgi?id=228720
Reviewed by Jer Noble.
`RemoteAudioSession` should update its `preferredBufferSize` in
`setPreferredBufferSize()`. Otherwise, the `preferredBufferSize`
will become inconsistent with the value in the GPU process.
No new tests. Fix API test failures.
* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setPreferredBufferSize):
2021-08-02 Kate Cheney <katherine_cheney@apple.com>
[App Privacy Report] Domains are deleted for ephemeral website data stores
https://bugs.webkit.org/show_bug.cgi?id=228708
<rdar://problem/81282432>
Reviewed by Alex Christensen.
No new tests. Since this data is not stored in WebKit, we have no
way to test when it gets deleted or not. I tested manually and requested
an automated test at the correct networking layer.
Only clear Privacy Report data if the website data store is
persistent. Safari calls the SPI to remove website data for ephemeral
data stores in some cases that are unrelated to a user clearing
website data or history and thus should not clear App Privacy Report
data. Additionally, it is unexpected that clearing an ephemeral data
store would clear disk data, as website data is only stored in memory
in this case.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::removeNetworkWebsiteData):
2021-08-02 Jean-Yves Avenard <jya@apple.com>
[WebAudio] Add webm/vorbis container support
https://bugs.webkit.org/show_bug.cgi?id=228139
rdar://80883073
Reviewed by Jer Noble.
Access to the com.apple.audio.AudioComponentRegistrar is denied by the sandbox which
prevents registering the Vorbis Audio Component. So we instantiate the decoder right before
setting up the sandbox.
This is a workaround for rdar://81137953.
Test: webaudio/decode-audio-data-webm-vorbis.html
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::initializeSandbox):
2021-08-02 Jean-Yves Avenard <jya@apple.com>
Crash in -[WKFullScreenWindowController windowDidExitFullScreen:]
https://bugs.webkit.org/show_bug.cgi?id=228694
rdar://79569881
Reviewed by Jer Noble.
It appears that [WKFullScreenWindowController finishedEnterFullScreenAnimation] can
cause the retain count to be decreased (this is the only explanation that makes any
sense considering the crash and when the regression started following bug 227243).
No test, can't reproduce.
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController setVideoFullscreenManagerClient:]): Add utility method
to remove duplicated code.
(-[WKFullScreenWindowController didExitPictureInPicture]):
(-[WKFullScreenWindowController windowDidEnterFullScreen:]):
(-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
(-[WKFullScreenWindowController _manager]): fly-by make style consistent with other
similar methods.
2021-08-02 Alex Christensen <achristensen@webkit.org>
Add log when experimental network loader is used
https://bugs.webkit.org/show_bug.cgi?id=227932
Reviewed by Chris Dumez.
We are seeing some reports of serious loading issues in bugs related to rdar://80330028
and we think they are because of problems related to the experimental network loader, which can be
enabled in experimental features but is not ready for use on the internet yet.
Add a log so we can determine for sure that is what is going on in those cases.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2021-08-02 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] ASSERTION FAILED: evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent in WebView::interpretKeyEvent since r280492
https://bugs.webkit.org/show_bug.cgi?id=228690
Reviewed by Brent Fulgham.
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::handleEditingKeyboardEvent): Return early unless the event is keydown or keypress.
2021-08-02 Alex Christensen <achristensen@webkit.org>
Don't change invalid baseURLs from loadData or loadHTMLString to about:blank
https://bugs.webkit.org/show_bug.cgi?id=228717
<rdar://79909343>
Reviewed by Chris Dumez.
r278737 fixed a compatibility bug from r272469 but introduced a crash when the base URL does not successfully parse.
r279450 fixed that crash but introduced a new behavior change that changes the URL to about:blank. This didn't seem
to change anything because window.location is about:blank with and without the change, but WKWebView.URL did change,
which broke at least one app. This undoes the functionality change from r279450 and keeps the crash fix, which are
both covered by API tests. I also manually verified this fixes the app in the radar.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadData):
2021-08-02 Devin Rousso <drousso@apple.com>
[Live Text] SPI for machine readable codes is only available on iOS
https://bugs.webkit.org/show_bug.cgi?id=228711
Reviewed by Tim Horton.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _setUpImageAnalysis]):
(-[WKContentView _tearDownImageAnalysis]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
(-[WKContentView continueContextMenuInteraction:]):
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
2021-08-02 Youenn Fablet <youenn@apple.com>
Attribute nw connections to the page bundle identifier
https://bugs.webkit.org/show_bug.cgi?id=228649
Reviewed by Eric Carlson.
Send page identifier from WebProcess to NetworkProcess when creating a WebRTC socket.
Use page identifier to get the attributed bundle identifier.
For that purpose, we need to hop to main thread to get it, then go back to rtc thread to create it.
We do so by using callOnMainRunLoopAndWait when NetworkRTCProvider does not have the information for the provided page identifier.
We then make use of nw_parameters_set_source_application_by_bundle_id to set the bundle identifier on TCP and UDP connections.
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::attributedBundleIdentifierFromPageIdentifier const):
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::addWebPageNetworkParameters):
(WebKit::NetworkSessionCocoa::removeWebPageNetworkParameters):
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::attributedBundleIdentifierFromPageIdentifier):
(WebKit::NetworkRTCProvider::createUDPSocket):
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket):
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::create):
(WebKit::NetworkRTCUDPSocketCocoa::createUDPSocket):
(WebKit::NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa):
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
* Platform/spi/Cocoa/NWParametersSPI.h:
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::RTCSocketFactory::RTCSocketFactory):
(WebKit::RTCSocketFactory::CreateUdpSocket):
(WebKit::RTCSocketFactory::CreateClientTcpSocket):
(WebKit::LibWebRTCProvider::createSocketFactory):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createUdpSocket):
(WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2021-08-02 Chris Dumez <cdumez@apple.com>
imported/w3c/web-platform-tests/webmessaging/broadcastchannel/blobs.html is a flaky failure since implementing BlobChannel
https://bugs.webkit.org/show_bug.cgi?id=228168
<rdar://problem/80922502>
Reviewed by Alex Christensen.
* NetworkProcess/NetworkBroadcastChannelRegistry.cpp:
(WebKit::NetworkBroadcastChannelRegistry::postMessage):
* NetworkProcess/NetworkBroadcastChannelRegistry.h:
* NetworkProcess/NetworkBroadcastChannelRegistry.messages.in:
* Platform/IPC/HandleMessage.h:
(IPC::handleMessageAsyncWantsConnection):
handleMessageAsyncWantsConnection() had gotten out of sync with handleMessageAsync(). This was causing IPC decoding
failures when using both "Async" and "WantsConnection" for the IPC message.
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.cpp:
(WebKit::WebBroadcastChannelRegistry::postMessage):
(WebKit::WebBroadcastChannelRegistry::postMessageToRemote):
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.h:
* WebProcess/WebCoreSupport/WebBroadcastChannelRegistry.messages.in:
2021-08-02 Per Arne Vollan <pvollan@apple.com>
[macOS] Remove unneeded sandbox extension member
https://bugs.webkit.org/show_bug.cgi?id=228584
Reviewed by Darin Adler.
Remove unneeded sandbox extension handle member, since this extension is never revoked.
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::switchFromStaticFontRegistryToUserFontRegistry):
2021-08-02 Jer Noble <jer.noble@apple.com>
[Cocoa] Remove support for AVAssetImageGenerator
https://bugs.webkit.org/show_bug.cgi?id=228560
<rdar://problem/81336280>
Reviewed by Eric Carlson.
Drive-by fix: Passing the wrong value down to the GPU process when the acceleratedRenderingStateChanged().
We should be passing the results of MediaPlayer::renderingCanBeAccelerated() which comes down from HTMLMediaElement,
not MediaPlayer::supportsAcceleratedRendering(), which comes up from the GPU process.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
2021-08-02 Martin Robinson <mrobinson@igalia.com>
[css-scroll-snap] Consider all snap areas at a given snap offset when snapping
https://bugs.webkit.org/show_bug.cgi?id=228141
Reviewed by Frédéric Wang.
* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<SnapOffset<float>>::encode): Serialize new members.
(ArgumentCoder<SnapOffset<float>>::decode): Deserialize new members.
2021-08-01 Youenn Fablet <youenn@apple.com>
Introduce an experimental feature to toggle WebRTC socket proxying
https://bugs.webkit.org/show_bug.cgi?id=228681
Reviewed by Eric Carlson.
Decide whether to disable proxying based on experimental feature in WebProcess.
Send the disable relay value from WebProcess to NetworkProcess for TCP sockets.
Manually tested.
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::createClientTCPSocket):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
* NetworkProcess/webrtc/NetworkRTCProvider.messages.in:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.h:
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::createClientTCPSocket):
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::RTCSocketFactory::CreateClientTcpSocket):
(WebKit::LibWebRTCProvider::createSocketFactory):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::createClientTcpSocket):
* WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
2021-07-31 Youenn Fablet <youenn@apple.com>
Improve LocalSampleBufferDisplayLayer logging
https://bugs.webkit.org/show_bug.cgi?id=228582
Reviewed by Eric Carlson.
Send through IPC the log identifier to the GPU display layer.
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
(WebKit::RemoteSampleBufferDisplayLayer::setLogIdentifier):
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::setLogIdentifier):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
2021-07-31 Youenn Fablet <youenn@apple.com>
RemoteAudioMediaStreamTrackRendererInternalUnit should handle changes of requested sampleCount
https://bugs.webkit.org/show_bug.cgi?id=228631
<rdar://80690191>
Reviewed by Eric Carlson.
The requested number of samples might change in case the output device changes.
When changing device, we might have a generated buffer of 4096 while 1024 samples are requested.
For each 1024 sample chunk, we will request a buffer of 4096, which cannot be provided by WebProcess.
To prevent this case, we keep track of a requested sample count overshoot so that next time the render callback is called,
we might not request to generate another chunk.
* GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::start):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::Unit::render):
2021-07-30 Jean-Yves Avenard <jya@apple.com>
REGRESSION (r274460?): Infinite recursion on fullscreen/full-screen-remove-ancestor.html in WTR::InjectedBundlePage::closeFullScreen
https://bugs.webkit.org/show_bug.cgi?id=224085
rdar://75576840
Reviewed by Eric Carlson.
WebFullScreenManager::close() is used to cleanup a transient error when exiting or
attempting to exit fullscreen; it then calls InjectedBundleXXX::closeFullScreen().
It is possible for the injected bundle's closeFullScreen() to attempt to exit full
screen mode again.
Rather than making the bundle responsible for doing the right thing, we add a
workaround in the fullscreen manager to ensure no recursion is happening.
Covered by existing test.
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::close):
* WebProcess/FullScreen/WebFullScreenManager.h: Make close() method private
2021-07-30 Tim Horton <timothy_horton@apple.com>
Accessibility code logs to stderr in many layout test runs
https://bugs.webkit.org/show_bug.cgi?id=228653
Reviewed by Wenson Hsieh.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityPreferencesDidChange):
r279342 accidentally landed a WTFLogAlways in a common codepath. Remove it.
2021-07-30 Youenn Fablet <youenn@apple.com>
softlink nw_parameters_allow_sharing_port_with_listener
https://bugs.webkit.org/show_bug.cgi?id=228636
Reviewed by Eric Carlson.
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::createNWConnection):
This helps compiling/running WebKit on older OSes.
Also make use of nw_endpoint_create_host_with_numeric_port to remove the need for string to int conversion.
* Platform/spi/Cocoa/NWParametersSPI.h:
2021-07-30 Youenn Fablet <youenn@apple.com>
Attribute nw connections to the source application
https://bugs.webkit.org/show_bug.cgi?id=228641
<rdar://81039713>
Reviewed by Alex Christensen.
Add source application token for every nw connection/listener, like done for WebSocket or NSURLSession tasks.
This will allow the nw layer to do custom processing based on the application doing the loads.
Introduce an audit_token_t getter on NetworkProcess.
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::sourceApplicationAuditData const):
(WebKit::NetworkProcess::sourceApplicationAuditToken const):
* NetworkProcess/webrtc/NetworkRTCProvider.cpp:
(WebKit::NetworkRTCProvider::NetworkRTCProvider):
* NetworkProcess/webrtc/NetworkRTCProvider.h:
(WebKit::NetworkRTCProvider::sourceApplicationAuditToken const):
* NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
(WebKit::NetworkRTCTCPSocketCocoa::NetworkRTCTCPSocketCocoa):
* NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
(WebKit::NetworkRTCUDPSocketCocoaConnections::NetworkRTCUDPSocketCocoaConnections):
(WebKit::NetworkRTCUDPSocketCocoaConnections::configureParameters):
* Platform/spi/Cocoa/NWParametersSPI.h:
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 ==