2e5209dd05eafd4f7d32bbd848a4cc507c71efae
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2020-06-19  Per Arne Vollan  <pvollan@apple.com>
2
3         [macOS] Connections to the preference daemon are established before entering the sandbox
4         https://bugs.webkit.org/show_bug.cgi?id=213379
5
6         Reviewed by Darin Adler.
7
8         On macOS, connections to the preference daemon are established before entering the sandbox. These connections also persist
9         after entering the sandbox and denying access to the preference daemon. There should not be attempts to connect to the
10         preference daemon before entering the sandbox, since these attempts will not be stopped by the sandbox. This patch moves
11         code that connects to the preference daemon to be executed after the sandbox has been entered. That includes code to
12         prevent connections to the Dock and code to initialize WebKit logging. Also, instead of calling [NSBundle bundleForClass:],
13         call [NSBundle bundleWithIdentifier:], since calling [NSBundle bundleForClass:] will connect to the preference daemon.
14         Finally, allow the syscall SYS_gethostuuid, since that is needed by CoreFoundation when there is no access to the
15         preference daemon.
16
17         No new tests. This should be covered by existing tests. It would be nice to have a test to make sure that there are no
18         connections to the preference daemon just before entering the sandbox, but I am not aware of how to implement this.
19
20         * NetworkProcess/mac/NetworkProcessMac.mm:
21         (WebKit::NetworkProcess::initializeSandbox):
22         * Shared/AuxiliaryProcess.cpp:
23         (WebKit::AuxiliaryProcess::initialize):
24         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
25         (WebKit::runInitializationCode):
26         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
27         (WebKit::XPCServiceMain):
28         * Shared/mac/AuxiliaryProcessMac.mm:
29         (WebKit::webKit2Bundle):
30         * WebProcess/cocoa/WebProcessCocoa.mm:
31         (WebKit::WebProcess::platformInitializeWebProcess):
32         (WebKit::WebProcess::initializeSandbox):
33         * WebProcess/com.apple.WebProcess.sb.in:
34
35 2020-06-19  Chris Dumez  <cdumez@apple.com>
36
37         Avoid initializing RenderTheme singleton unnecessarily in the UIProcess
38         https://bugs.webkit.org/show_bug.cgi?id=213406
39
40         Reviewed by Per Arne Vollan.
41
42         Avoid initializing RenderTheme singleton unnecessarily in the UIProcess. Instead, introduce
43         a static function to get the focus ring color on iOS.
44
45         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
46         (WebKit::WebProcessPool::platformInitializeWebProcess):
47
48 2020-06-19  Chris Dumez  <cdumez@apple.com>
49
50         Unreviewed build fix after r263288.
51
52         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
53         (WebKit::WebProcessPool::platformInitializeWebProcess):
54
55 2020-06-19  Chris Dumez  <cdumez@apple.com>
56
57         Use ASCIILiteral more for SandboxExtension functions
58         https://bugs.webkit.org/show_bug.cgi?id=213400
59
60         Reviewed by Per Arne Vollan.
61
62         Use ASCIILiteral more for SandboxExtension functions. Functions like createHandleForMachLookup() / createHandleForIOKitClassExtension()
63         don't need to take in Strings, ASCIILiteral is enough.
64
65         * Shared/Cocoa/SandboxExtensionCocoa.mm:
66         (WebKit::createHandlesForResources):
67         (WebKit::SandboxExtension::createReadOnlyHandlesForFiles):
68         (WebKit::SandboxExtension::createHandleForGenericExtension):
69         (WebKit::SandboxExtension::createHandleForMachLookup):
70         (WebKit::SandboxExtension::createHandlesForMachLookup):
71         (WebKit::SandboxExtension::createHandleForIOKitClassExtension):
72         (WebKit::SandboxExtension::createHandlesForIOKitClassExtensions):
73         * Shared/SandboxExtension.h:
74         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
75         (WebKit::mediaRelatedMachServices):
76         (WebKit::nonBrowserServices):
77         (WebKit::diagnosticServices):
78         (WebKit::agxCompilerClasses):
79         (WebKit::WebProcessPool::platformInitializeWebProcess):
80         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
81         (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded):
82         * UIProcess/GPU/GPUProcessProxy.cpp:
83         (WebKit::GPUProcessProxy::singleton):
84         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
85         (WebKit::UserMediaPermissionRequestManagerProxy::finishGrantingRequest):
86         * UIProcess/WebPageProxy.cpp:
87         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
88         (WebKit::WebPageProxy::creationParameters):
89         * UIProcess/ios/WebPageProxyIOS.mm:
90         (WebKit::WebPageProxy::grantAccessToAssetServices):
91
92 2020-06-19  Brent Fulgham  <bfulgham@apple.com>
93
94         [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle
95         https://bugs.webkit.org/show_bug.cgi?id=213357
96         <rdar://problem/63837247>
97
98         Reviewed by Darin Adler.
99
100         The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need
101         this access for web browsing, and should limit this access to this one case.
102
103         This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the
104         non-extension access case with a backtrace so we can see if any other clients are hitting this.
105
106         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
107         * Shared/WebProcessCreationParameters.cpp:
108         (WebKit::WebProcessCreationParameters::encode const):
109         (WebKit::WebProcessCreationParameters::decode):
110         * Shared/WebProcessCreationParameters.h:
111         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
112         (WebKit::WebProcessPool::platformInitializeWebProcess):
113         * WebProcess/cocoa/WebProcessCocoa.mm:
114         (WebKit::WebProcess::platformInitializeWebProcess):
115         * WebProcess/com.apple.WebProcess.sb.in:
116
117 2020-06-19  Andres Gonzalez  <andresg_22@apple.com>
118
119         AX: web process crash in AXObjectCache::postNotification.
120         https://bugs.webkit.org/show_bug.cgi?id=213398
121
122         Reviewed by Chris Fleizach.
123
124         AXObjectCache was being instantiated on the AX secondary thread.
125         Therefore the timers for the different delayed notifications where
126         initialized with the secondary thread. When postNotification was triggered
127         on the main thread as it should, and the timer was accessed, the timer
128         would assert/crash for being accessed in a thread different than where
129         it was created. This change guaranties that AXObjectCache is always
130         created on the main thread.
131
132         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
133         (-[WKAccessibilityWebPageObjectBase axObjectCache]):
134         (-[WKAccessibilityWebPageObjectBase accessibilityPluginObject]):
135         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
136         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
137         (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
138         (-[WKAccessibilityWebPageObjectBase setRemoteParent:]):
139
140 2020-06-19  Chris Fleizach  <cfleizach@apple.com>
141
142         AX: Make isolated tree enablement status dependent on client preference
143         https://bugs.webkit.org/show_bug.cgi?id=213355
144         <rdar://problem/64506577>
145
146         Reviewed by Zalan Bujtas.
147
148         We don't want the isolated tree mode in all clients (like Mail or Dictionary).
149         As a result, we can set this setting to off and allow safari and mini browser turn on more directly.
150
151         * Shared/WebPreferences.yaml:
152         * UIProcess/API/Cocoa/WKPreferences.mm:
153         (-[WKPreferences _setAccessibilityIsolatedTreeEnabled:]):
154         (-[WKPreferences _accessibilityIsolatedTreeEnabled]):
155         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
156         * WebProcess/InjectedBundle/InjectedBundle.cpp:
157         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
158         (WebKit::InjectedBundle::setAccessibilityIsolatedTreeEnabled):
159         * WebProcess/InjectedBundle/InjectedBundle.h:
160
161 2020-06-19  Rob Buis  <rbuis@igalia.com>
162
163         Enable referrer policy attribute support by default
164         https://bugs.webkit.org/show_bug.cgi?id=213285
165
166         Reviewed by Youenn Fablet.
167
168         Enable referrer policy attribute support by default by flipping the switch.
169
170         * Shared/WebPreferences.yaml:
171
172 2020-06-19  Youenn Fablet  <youenn@apple.com>
173
174         LibWebRTCSocketClient::sendTo is too verbose in case of error
175         https://bugs.webkit.org/show_bug.cgi?id=213380
176
177         Reviewed by Eric Carlson.
178
179         Only log error message if the error code is different from the previous one.
180
181         * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
182         (WebKit::LibWebRTCSocketClient::sendTo):
183         * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
184
185 2020-06-19  Chris Dumez  <cdumez@apple.com>
186
187         Web Inspector: RemoteInspector::singleton() slows down MobileSafari launch
188         https://bugs.webkit.org/show_bug.cgi?id=213381
189         <rdar://problem/64533003>
190
191         Reviewed by Darin Adler.
192
193         RemoteInspector::singleton() is expensive according to traces. It was called in WebProcessPool::initializeNewWebProcess()
194         which happens on MobileSafari launch because we prewarm a WebProcess. However, there is no reason to initialize remote
195         Web Inspector at this point. Per associated comment, Remote Web Inspector needs to be initialized once there is a
196         sub process hosting one of our Web View. As a result, I moved the initialization call to WebPageProxy::initializeWebPage()
197         which is when we actually send the IPC to the WebProcess to create the WebPage that is backing the UI-side WebView.
198
199         * UIProcess/WebPageProxy.cpp:
200         (WebKit::WebPageProxy::initializeWebPage):
201         * UIProcess/WebProcessPool.cpp:
202         (WebKit::WebProcessPool::initializeNewWebProcess):
203
204 2020-06-19  Chris Dumez  <cdumez@apple.com>
205
206         Move Prefixed WebAudio interfaces behind their own feature flag
207         https://bugs.webkit.org/show_bug.cgi?id=213356
208
209         Reviewed by Darin Adler.
210
211         * Shared/WebPreferences.yaml:
212
213 2020-06-19  Rob Buis  <rbuis@igalia.com>
214
215         Enable stale-while-revalidate support by default
216         https://bugs.webkit.org/show_bug.cgi?id=213286
217
218         Reviewed by Youenn Fablet.
219
220         Enable stale-while-revalidate support for Mac/GTK/WPE by changing the default
221         to true. Note that platforms that do not support speculative loads, which s-w-r
222         relies on, will not see any change in bahavior.
223
224         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
225
226 2020-06-19  Alexander Mikhaylenko  <alexm@gnome.org>
227
228         REGRESSION(r253360): [GTK] Page starts loading during animation in back/forward gesture
229         https://bugs.webkit.org/show_bug.cgi?id=205650
230
231         Reviewed by Carlos Garcia Campos.
232
233         r253360 changed the swipe gesture to start loading the page during the gesture, relying on
234         freezing the layer tree state to prevent unwanted redraws. However, it was implemented for
235         AC mode, but didn't prevent redraws in non-accelerated mode. Add a simple check to skip
236         redraws in this case.
237
238         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
239         (WebKit::DrawingAreaCoordinatedGraphics::display): Skip drawing if layer tree state is frozen.
240
241 2020-06-19  Carlos Garcia Campos  <cgarcia@igalia.com>
242
243         Add support for fetching registrable domains with resource load statistics
244         https://bugs.webkit.org/show_bug.cgi?id=213291
245
246         Reviewed by Adrian Perez de Castro and Youenn Fablet.
247
248         WebsiteDataStore::fetchData() doesn't return anything for resource load statistics because
249         NetworkProcess::fetchWebsiteData() doesn't handle WebsiteDataType::ResourceLoadStatistics.
250
251         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
252         (WebKit::ResourceLoadStatisticsDatabaseStore::allDomains const): Query all registrable domains from database.
253         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
254         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
255         (WebKit::ResourceLoadStatisticsMemoryStore::allDomains const): Return all registrable domains in memory map.
256         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
257         * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
258         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
259         (WebKit::WebResourceLoadStatisticsStore::registrableDomains): Get the list of registrable domains.
260         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
261         * NetworkProcess/NetworkProcess.cpp:
262         (WebKit::NetworkProcess::fetchWebsiteData): Handle WebsiteDataType::ResourceLoadStatistics.
263         * Shared/WebsiteData/WebsiteData.cpp:
264         (WebKit::WebsiteData::encode const): Encode registrableDomainsWithResourceLoadStatistics.
265         (WebKit::WebsiteData::decode): Decode registrableDomainsWithResourceLoadStatistics.
266         * Shared/WebsiteData/WebsiteData.h:
267         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
268         (WKWebsiteDataStoreRemoveITPDataForDomain): Use WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain()
269         instead of the display name.
270         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
271         (WebKit::WebsiteDataRecord::addResourceLoadStatisticsRegistrableDomain): Add the given registrable domain to the list.
272         * UIProcess/WebsiteData/WebsiteDataRecord.h:
273         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
274         (WebKit::WebsiteDataStore::fetchDataAndApply): Handle registrable domains with resource load statistics.
275         (WebKit::WebsiteDataStore::removeData): Use resourceLoadStatisticsRegistrableDomains instead of the display name.
276
277 2020-06-18  David Kilzer  <ddkilzer@apple.com>
278
279         Use fastMalloc/fastFree in WebCoreArgumentCodersMac.mm
280         <https://webkit.org/b/213325>
281
282         Reviewed by Darin Adler.
283
284         * Shared/mac/WebCoreArgumentCodersMac.mm:
285         (IPC::createArchiveList):
286         (IPC::createCFURLRequestFromSerializableRepresentation):
287
288 2020-06-18  Tim Horton  <timothy_horton@apple.com>
289
290         Remove some vestiges of the 32-bit Plugin Process
291         https://bugs.webkit.org/show_bug.cgi?id=213361
292
293         Reviewed by Dan Bernstein.
294
295         We haven't launched 32-bit plugins for a while, but there are some
296         build system complications and random references in the code that we can get rid of.
297
298         * WebKit.xcodeproj/project.pbxproj:
299         * Configurations/PluginService.xcconfig: Renamed from Source/WebKit/Configurations/PluginService.64.xcconfig.
300         No need for .64 in the name anymore, since it's the only one.
301         We do have to leave the .64 in the product name because there are other things in the system that depend on this.
302
303         * PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.Info.plist: Renamed from Source/WebKit/PluginProcess/EntryPoint/Cocoa/XPCService/PluginService.64.Info.plist.
304         No need for .64 in the name anymore.
305
306         * UIProcess/AuxiliaryProcessProxy.cpp:
307         (WebKit::AuxiliaryProcessProxy::getLaunchOptions):
308         * UIProcess/Launcher/ProcessLauncher.h:
309         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
310         (WebKit::serviceName):
311         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
312         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
313         There need only be one ProcessType for the plugin process now!
314
315         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
316         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
317         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
318         (WebKit::bubblewrapSpawn):
319         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
320         (WebKit::ProcessLauncher::launchProcess):
321         GTK WebKit appears to also only launch 64-bit plugin processes.
322
323 2020-06-18  Megan Gardner  <megan_gardner@apple.com>
324
325         Workaround for UIKit layout bug in time picker.
326         https://bugs.webkit.org/show_bug.cgi?id=213346
327         <rdar://problem/64042277>
328
329         Reviewed by Tim Horton.
330
331         There is a bug in the layout of UIKit that needs to be fixed.
332         Until then, this workaround should give us a view that is viable.
333
334         * UIProcess/ios/WKContentViewInteraction.mm:
335         (-[WKContentView resignFirstResponderForWebView]):
336         * UIProcess/ios/forms/WKDateTimeInputControl.mm:
337         (-[WKDateTimeContextMenuViewController preferredContentSize]):
338
339 2020-06-18  David Kilzer  <ddkilzer@apple.com>
340
341         [IPC hardening] OptionSet<> values should be validated
342         <https://webkit.org/b/213199>
343         <rdar://problem/64369963>
344
345         Reviewed by Anders Carlsson.
346
347         Summary:
348         - Add WTF::EnumTraits<> for all OptionSet<> enums.
349         - Specify unsigned backing types for enum classes.
350
351         * NetworkProcess/NetworkProcess.h:
352         * NetworkProcess/NetworkSession.h:
353         * Platform/IPC/ArgumentCoders.h:
354         (IPC::ArgumentCoder<OptionSet<T>>::encode):
355         (IPC::ArgumentCoder<OptionSet<T>>::decode):
356         - Add WTF::isValidOptionSet() checks.
357         * Platform/IPC/Decoder.h:
358         * Platform/IPC/Encoder.h:
359         - Replace <wtf/EnumTraits.h> with <wtf/OptionSet.h> since the
360           latter now includes the former.
361         * Platform/IPC/MessageFlags.h:
362         * Shared/DocumentEditingContext.h:
363         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
364         * Shared/WebEvent.h:
365         * Shared/WebsiteAutoplayQuirk.h:
366         * Shared/WebsiteData/WebsiteData.h:
367         * Shared/WebsiteData/WebsiteDataFetchOption.h:
368         * Shared/WebsiteData/WebsiteDataType.h:
369         * Shared/ios/GestureTypes.h:
370         * UIProcess/Network/NetworkProcessProxy.h:
371         * UIProcess/Plugins/PluginProcessManager.h:
372         * UIProcess/WebProcessProxy.h:
373         * UIProcess/WebsiteData/WebsiteDataStore.h:
374         * WebProcess/WebProcess.h:
375
376 2020-06-18  Carlos Garcia Campos  <cgarcia@igalia.com>
377
378         [GTK][WPE] Add API to configure and handle service worker registrations to WebKitWebsiteDataManager
379         https://bugs.webkit.org/show_bug.cgi?id=213290
380
381         Reviewed by Michael Catanzaro.
382
383         The default path is always used even for apps setting a base data directory. We should handle
384         WebsiteDataType::ServiceWorkerRegistrations to configure the directory and allow to fetch and clear them.
385
386         * UIProcess/API/glib/WebKitWebsiteData.cpp:
387         (recordContainsSupportedDataTypes):
388         (toWebKitWebsiteDataTypes):
389         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
390         (webkitWebsiteDataManagerGetProperty):
391         (webkitWebsiteDataManagerSetProperty):
392         (webkitWebsiteDataManagerConstructed):
393         (webkit_website_data_manager_class_init):
394         (webkitWebsiteDataManagerGetDataStore):
395         (webkit_website_data_manager_get_service_worker_registrations_directory):
396         (toWebsiteDataTypes):
397         * UIProcess/API/gtk/WebKitWebsiteData.h:
398         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
399         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
400         * UIProcess/API/wpe/WebKitWebsiteData.h:
401         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
402         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
403
404 2020-06-18  Yuri Chornoivan  <yurchor@ukr.net>
405
406         Unreviewed. Fix a typo introduced in r263085
407
408         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
409         (webkit_website_data_manager_class_init):
410
411 2020-06-17  Chris Dumez  <cdumez@apple.com>
412
413         Add experimental feature flag for modern & unprefixed WebAudio API
414         https://bugs.webkit.org/show_bug.cgi?id=213268
415
416         Reviewed by Jer Noble.
417
418         Add experimental feature flag for modern & unprefixed WebAudio API,
419         off by default.
420
421         * Shared/WebPreferences.yaml:
422
423 2020-06-17  Wenson Hsieh  <wenson_hsieh@apple.com>
424
425         [macOS] Shift-tab in a bullet list in Mail Compose jumps back to Subject field
426         https://bugs.webkit.org/show_bug.cgi?id=213320
427         <rdar://problem/63831962>
428
429         Reviewed by Tim Horton.
430
431         See WebCore/ChangeLog for more detail.
432
433         * WebProcess/WebPage/WebPage.cpp:
434         (WebKit::WebPage::handleKeyEventByRelinquishingFocusToChrome):
435         * WebProcess/WebPage/WebPage.h:
436         * WebProcess/WebPage/ios/WebPageIOS.mm:
437         (WebKit::WebPage::handleEditingKeyboardEvent):
438
439         Hoist logic for relinquishing focus as a result of shift+tab from EventHandler to WebPage, so that it is the
440         default behavior when processing a "keypress" event that corresponds to shift+tab in an editable web view on
441         Cocoa platforms. If we do end up relinquishing focus, then we consider the keypress event to be handled.
442
443         * WebProcess/WebPage/mac/WebPageMac.mm:
444         (WebKit::WebPage::handleEditingKeyboardEvent):
445
446 2020-06-17  Beth Dakin  <bdakin@apple.com>
447
448         Remove references to blacklist/whitelist in the old C API
449         https://bugs.webkit.org/show_bug.cgi?id=213322
450
451         Reviewed by Tim Horton.
452
453         * UIProcess/API/C/WKPageGroup.cpp:
454         (WKPageGroupAddUserStyleSheet):
455         (WKPageGroupAddUserScript):
456         * UIProcess/API/C/WKPageGroup.h:
457         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
458
459 2020-06-17  Alex Christensen  <achristensen@webkit.org>
460
461         Null check plugin.m_data before using it in PDFPlugin::ByteRangeRequest::completeUnconditionally
462         https://bugs.webkit.org/show_bug.cgi?id=213305
463         <rdar://problem/60349279>
464
465         Reviewed by Brady Eidson.
466
467         * WebProcess/Plugins/PDF/PDFPlugin.mm:
468         (WebKit::PDFPlugin::ByteRangeRequest::completeUnconditionally):
469
470 2020-06-17  Darryl Pogue  <darryl@dpogue.ca>
471
472         IndexedDB: Support IDBFactory databases method
473         https://bugs.webkit.org/show_bug.cgi?id=211043
474
475         Reviewed by Youenn Fablet.
476
477         Plumbing for returning a list of IDB databases and versions.
478
479         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
480         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions):
481         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted.
482         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
483         * NetworkProcess/IndexedDB/WebIDBServer.cpp:
484         (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
485         (WebKit::WebIDBServer::getAllDatabaseNames): Deleted.
486         * NetworkProcess/IndexedDB/WebIDBServer.h:
487         * NetworkProcess/IndexedDB/WebIDBServer.messages.in:
488         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
489         (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions):
490         (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions):
491         (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted.
492         (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted.
493         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
494         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
495
496 2020-06-16  Simon Fraser  <simon.fraser@apple.com>
497
498         REGRESSION (r255037): Broken position while comparing watch bands on www.apple.com/shop/studio/apple-watch
499         https://bugs.webkit.org/show_bug.cgi?id=213282
500         <rdar://problem/63862940>
501
502         Reviewed by Antti Koivisto.
503
504         If a scrolling tree commit has a requested scroll position update for a node, we need
505         to call applyLayerPositons() to set the UIScrollView's contentOffset.
506
507         Often the layer tree commit will contain a boundsOrigin change for the layer in question
508         (which is equivalent to setting the UIScrollView's contentOffset), but some combinations of
509         user and programmatic scrolling result in no boundsOrigin change, revealing the bug.
510
511         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
512         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
513
514 2020-06-16  Kate Cheney  <katherine_cheney@apple.com>
515
516         Check for inAppBrowserPrivacyEnabled flag in WebsiteDataStore::initializeAppBoundDomains is expensive and calls a non-static function WebsiteDataStore::parameters().
517         https://bugs.webkit.org/show_bug.cgi?id=213261
518         <rdar://problem/64317084>
519
520         Reviewed by Brent Fulgham.
521
522         There are two bugs here. First, WebsiteDataStore::parameters()
523         does a lot of work aside from returning the parameters, making this an
524         expensive call just to check the value of one flag. Second,
525         appBoundDomains() is a static hashset, and initializing the hashset
526         should not rely on non-static functions.
527
528         * NetworkProcess/NetworkSessionCreationParameters.cpp:
529         (WebKit::NetworkSessionCreationParameters::encode const):
530         (WebKit::NetworkSessionCreationParameters::decode):
531         * NetworkProcess/NetworkSessionCreationParameters.h:
532         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
533         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
534         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
535         Remove flag, it is no longer used here.
536
537         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
538         (WebKit::WebsiteDataStore::platformSetNetworkParameters):
539         Save the flag value in a member variable so we can use that later
540         when checking app-bound domains. Rename to something more descriptive.
541
542         (WebKit::WebsiteDataStore::initializeAppBoundDomains):
543         Remove the check for the non-static runtime flag.
544
545         (WebKit::WebsiteDataStore::ensureAppBoundDomains const):
546         Enable test mode quirks. We must do it in two places in case the
547         initialization hasn't happened by the time we call
548         ensureAppBoundDomains.
549
550         * UIProcess/WebsiteData/WebsiteDataStore.h:
551
552 2020-06-16  Mark Lam  <mark.lam@apple.com>
553
554         Make Options::useJIT() be the canonical source of truth on whether we should use the JIT.
555         https://bugs.webkit.org/show_bug.cgi?id=212556
556         <rdar://problem/63780436>
557
558         Reviewed by Saam Barati.
559
560         * WebProcess/WebProcess.cpp:
561         (WebKit::WebProcess::isJITEnabled):
562
563 2020-06-16  David Kilzer  <ddkilzer@apple.com>
564
565         REGRESSION (r262994): Web Inspector is killed when context-clicking anywhere
566         <https://webkit.org/b/213224>
567         <rdar://problem/64383320>
568
569         Reviewed by Darin Adler.
570
571         * Platform/IPC/Decoder.h:
572         * Platform/IPC/Encoder.h:
573         - Include <WebCore/ContextMenuItem.h> since the definition of
574           the custom WTF::isValidEnum<WebCore::ContextMenuAction>
575           function is needed.
576         * Scripts/webkit/messages.py:
577         (generate_message_names_header):
578         - Change the third typename in the template for
579           WTF::isValidEnum<IPC::MessageName>() to avoid partial template
580           specialization errors from other implementations like
581           WTF::isValidEnum<WebCore::ContextMenuAction>().
582         - Also replace hard-coded "IPC::MessageName" names with template
583           values.
584
585 2020-06-16  Chris Dumez  <cdumez@apple.com>
586
587         Stop calling userPreferredLanguages() in the UIProcess
588         https://bugs.webkit.org/show_bug.cgi?id=213214
589         <rdar://problem/64317593>
590
591         Reviewed by Darin Adler.
592
593         Follow-up to r263094 to address post-landing feedback from Darin.
594         Use makeVector() functionality in WTF to convert the NSArray into a Vector instead
595         of doing it by hand. Also mark the NeverDestroyed variable as static const to
596         avoid leaking.
597
598         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
599         (WebKit::WebProcessProxy::platformOverrideLanguages const):
600
601 2020-06-16  Alex Christensen  <achristensen@webkit.org>
602
603         Provide alternatively-named WKBrowsingContextGroup SPI
604         https://bugs.webkit.org/show_bug.cgi?id=213229
605
606         Reviewed by Tim Horton.
607
608         This is unfortunately still used. In order to try to convince the user to make the smallest change possible, make newly named SPI that behaves identically.
609         Doubly-deprecate the old SPI and implement it in terms of the new during the transition period.
610
611         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
612         * UIProcess/API/Cocoa/WKBrowsingContextGroup.mm:
613         (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]):
614         (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:mainFrameOnly:]):
615         (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]):
616         (-[WKBrowsingContextGroup addUserScript:baseURL:includeMatchPatternStrings:excludeMatchPatternStrings:injectionTime:mainFrameOnly:]):
617
618 2020-06-16  Youenn Fablet  <youenn@apple.com>
619
620         Loads triggered by an opaque stylesheet should not be visible to service workers
621         https://bugs.webkit.org/show_bug.cgi?id=213246
622
623         Reviewed by Alex Christensen.
624
625         * WebProcess/Network/WebLoaderStrategy.cpp:
626         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
627         In case the load is triggered from an opaque response, set service worker mode to none.
628
629 2020-06-16  Charlie Turner  <cturner@igalia.com>
630
631         [GTK] Disable video autoplay
632         https://bugs.webkit.org/show_bug.cgi?id=184845
633
634         Reviewed by Carlos Garcia Campos.
635
636         * PlatformGTK.cmake: Add new source files to the build.
637         * PlatformWPE.cmake: Ditto.
638         * SourcesGTK.txt: Ditto.
639         * SourcesWPE.txt: Ditto.
640         * UIProcess/API/glib/WebKitPolicyDecision.cpp:
641         (webkit_policy_decision_use_with_policies): : Add an API to
642         respond to navigation decisions with policies.
643         * UIProcess/API/glib/WebKitWebContext.cpp:
644         (webkitWebContextCreatePageForWebView): Plumb in the default
645         website policies that are associated with the web view.
646         * UIProcess/API/glib/WebKitWebContextPrivate.h:
647         * UIProcess/API/glib/WebKitWebView.cpp:
648         (webkitWebViewConstructed):
649         (webkitWebViewSetProperty):
650         (webkitWebViewGetProperty):
651         (webkit_web_view_class_init):
652         (webkit_web_view_get_website_policies):
653         * UIProcess/API/glib/WebKitWebsitePolicies.cpp: Added.
654         (_WebKitWebsitePoliciesPrivate::_WebKitWebsitePoliciesPrivate):
655         (webkitWebsitePoliciesGetWebsitePolicies):
656         (webkitWebsitePoliciesGetPoliciesData):
657         (webkitWebsitePoliciesGetProperty):
658         (webkitWebsitePoliciesSetAutoplayPolicy):
659         (webkitWebsitePoliciesSetProperty):
660         (webkit_website_policies_class_init):
661         (webkit_website_policies_new):
662         (webkit_website_policies_new_with_policies):
663         (webkit_website_policies_get_autoplay_policy):
664         * UIProcess/API/glib/WebKitWebsitePoliciesPrivate.h: Added.
665         * UIProcess/API/gtk/WebKitPolicyDecision.h:
666         * UIProcess/API/gtk/WebKitWebView.h:
667         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
668         (webkit_web_view_new_with_related_view):
669         * UIProcess/API/gtk/WebKitWebsitePolicies.h: Added.
670         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
671         * UIProcess/API/wpe/WebKitPolicyDecision.h:
672         * UIProcess/API/wpe/WebKitWebView.h:
673         * UIProcess/API/wpe/WebKitWebsitePolicies.h: Added.
674         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
675
676 2020-06-16  Chris Dumez  <cdumez@apple.com>
677
678         Stop calling userPreferredLanguages() in the UIProcess
679         https://bugs.webkit.org/show_bug.cgi?id=213214
680         <rdar://problem/64317593>
681
682         Reviewed by Per Arne Vollan.
683
684         Stop calling userPreferredLanguages() in the UIProcess since this can be slow and may keep
685         the main thread busy. Nowadays, the WebProcess is able to call it by itself anyway. The
686         sandbox is allowing it.
687
688         * Shared/WebProcessCreationParameters.cpp:
689         (WebKit::WebProcessCreationParameters::encode const):
690         (WebKit::WebProcessCreationParameters::decode):
691         * Shared/WebProcessCreationParameters.h:
692         * UIProcess/WebProcessPool.cpp:
693         (WebKit::WebProcessPool::languageChanged):
694         (WebKit::WebProcessPool::initializeNewWebProcess):
695         * WebProcess/WebProcess.cpp:
696         (WebKit::WebProcess::initializeWebProcess):
697         (WebKit::WebProcess::userPreferredLanguagesChanged const):
698         * WebProcess/WebProcess.h:
699         * WebProcess/WebProcess.messages.in:
700
701 2020-06-16  Truitt Savell  <tsavell@apple.com>
702
703         Unreviewed, reverting r263079.
704
705         Broke Internal builds.
706
707         Reverted changeset:
708
709         "IndexedDB: Support IDBFactory databases method"
710         https://bugs.webkit.org/show_bug.cgi?id=211043
711         https://trac.webkit.org/changeset/263079
712
713 2020-06-16  Carlos Garcia Campos  <cgarcia@igalia.com>
714
715         [GTK][WPE] Add API to configure and enable resource load statistics
716         https://bugs.webkit.org/show_bug.cgi?id=177943
717
718         Reviewed by Michael Catanzaro.
719
720         * UIProcess/API/glib/WebKitWebsiteData.cpp:
721         (recordContainsSupportedDataTypes):
722         (toWebKitWebsiteDataTypes):
723         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
724         (webkitWebsiteDataManagerGetProperty):
725         (webkitWebsiteDataManagerSetProperty):
726         (webkitWebsiteDataManagerConstructed):
727         (webkit_website_data_manager_class_init):
728         (webkitWebsiteDataManagerGetDataStore):
729         (webkit_website_data_manager_get_itp_directory):
730         (webkit_website_data_manager_set_itp_enabled):
731         (webkit_website_data_manager_get_itp_enabled):
732         (toWebsiteDataTypes):
733         * UIProcess/API/gtk/WebKitWebsiteData.h:
734         * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
735         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
736         * UIProcess/API/wpe/WebKitWebsiteData.h:
737         * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
738         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
739         * UIProcess/glib/WebsiteDataStoreGLib.cpp:
740         (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
741
742 2020-06-16  Darryl Pogue  <darryl@dpogue.ca>
743
744         IndexedDB: Support IDBFactory databases method
745         https://bugs.webkit.org/show_bug.cgi?id=211043
746
747         Reviewed by Youenn Fablet.
748
749         Plumbing for returning a list of IDB databases and versions.
750
751         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
752         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNamesAndVersions):
753         (WebKit::WebIDBConnectionToClient::didGetAllDatabaseNames): Deleted.
754         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
755         * NetworkProcess/IndexedDB/WebIDBServer.cpp:
756         (WebKit::WebIDBServer::getAllDatabaseNamesAndVersions):
757         (WebKit::WebIDBServer::getAllDatabaseNames): Deleted.
758         * NetworkProcess/IndexedDB/WebIDBServer.h:
759         * NetworkProcess/IndexedDB/WebIDBServer.messages.in:
760         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
761         (WebKit::WebIDBConnectionToServer::getAllDatabaseNamesAndVersions):
762         (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNamesAndVersions):
763         (WebKit::WebIDBConnectionToServer::getAllDatabaseNames): Deleted.
764         (WebKit::WebIDBConnectionToServer::didGetAllDatabaseNames): Deleted.
765         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
766         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
767
768 2020-06-15  Pavel Feldman  <pavel.feldman@gmail.com>
769
770         Web Inspector: introduce request interception
771         https://bugs.webkit.org/show_bug.cgi?id=207446
772
773         Reviewed by Devin Rousso.
774
775         This change introduces network request interception to the Network 
776         protocol domain. It adds Network.interceptWithRequest notification that
777         can be continued, modified or fulfilled. NetworkStage enum can now have
778         'request' and 'response' values.
779
780         * WebProcess/Network/WebLoaderStrategy.cpp:
781         (WebKit::WebLoaderStrategy::scheduleLoad):
782
783 2020-06-15  Brent Fulgham  <bfulgham@apple.com>
784
785         [macOS] Update sandboxes to reduce logging for media-related operations
786         https://bugs.webkit.org/show_bug.cgi?id=213210
787         <rdar://problem/64376237>
788
789         Reviewed by Per Arne Vollan.
790
791         Ongoing testing has uncovered a set of additional services and IOKit
792         properties that we should allow without logging.
793
794         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
795         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
796         (WebKit::mediaRelatedMachServices):
797         * WebProcess/com.apple.WebProcess.sb.in:
798
799 2020-06-15  Alex Christensen  <achristensen@webkit.org>
800
801         Provide alternatively-named SPI for user style sheets and scripts
802         https://bugs.webkit.org/show_bug.cgi?id=213206
803
804         Reviewed by Brady Eidson.
805
806         Test-only SPI was just renamed.
807         SPI used by other projects was deprecated with a replacement so we can remove the old names soon.
808
809         _WKUserContentWorld/WKContentWorld was tied up in this, and rather than provide replacement SPI with deprecated _WKUserContentWorld,
810         this will move some SPI from _WKUserContentWorld to WKContentWorld too.  The most heavy user of _WKUserContentWorld is TestWebKitAPI and we'll remove it soon.
811
812         * UIProcess/API/C/WKContext.cpp:
813         (WKContextSetFontAllowList):
814         (WKContextSetFontWhitelist): Deleted.
815         * UIProcess/API/C/WKContextPrivate.h:
816         * UIProcess/API/Cocoa/WKUserContentController.mm:
817         (-[WKUserContentController _removeAllUserScriptsAssociatedWithContentWorld:]):
818         (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithContentWorld:]):
819         (-[WKUserContentController _addScriptMessageHandler:name:contentWorld:]):
820         (-[WKUserContentController _removeAllUserScriptsAssociatedWithUserContentWorld:]): Deleted.
821         (-[WKUserContentController _removeAllUserStyleSheetsAssociatedWithUserContentWorld:]): Deleted.
822         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
823         * UIProcess/API/Cocoa/WKUserScript.mm:
824         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]):
825         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
826         * UIProcess/API/Cocoa/_WKUserStyleSheet.h:
827         * UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
828         (-[_WKUserStyleSheet initWithSource:forWKWebView:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:baseURL:level:contentWorld:]):
829         * UIProcess/WebProcessPool.cpp:
830         (WebKit::WebProcessPool::setFontAllowList):
831         (WebKit::WebProcessPool::setFontWhitelist): Deleted.
832         * UIProcess/WebProcessPool.h:
833
834 2020-06-15  Alex Christensen  <achristensen@webkit.org>
835
836         Add SPI to preconnect to a server
837         https://bugs.webkit.org/show_bug.cgi?id=213109
838         <rdar://problem/64184412>
839
840         Reviewed by Geoff Garen.
841
842         Covered by API tests.
843
844         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
845         * UIProcess/API/Cocoa/WKWebView.mm:
846         (-[WKWebView _preconnectToServer:]):
847         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
848         * UIProcess/Network/NetworkProcessProxy.cpp:
849         (WebKit::NetworkProcessProxy::preconnectTo):
850         * UIProcess/WebPageProxy.cpp:
851         (WebKit::WebPageProxy::preconnectTo):
852         * UIProcess/WebPageProxy.h:
853
854 2020-06-15  Keith Miller  <keith_miller@apple.com>
855
856         Signal handlers should have a two phase installation.
857         https://bugs.webkit.org/show_bug.cgi?id=213160
858
859         Reviewed by Mark Lam.
860
861         Put back old WASM fast memory installation.
862
863         * WebProcess/WebProcess.cpp:
864         (WebKit::WebProcess::initializeWebProcess):
865
866 2020-06-15  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
867
868         Suppress compiler warnings
869         https://bugs.webkit.org/show_bug.cgi?id=213034
870
871         Reviewed by Darin Adler.
872
873         Convert to std:size_t to compare equal data types.
874
875         * NetworkProcess/cache/NetworkCacheData.cpp:
876         (WebKit::NetworkCache::readOrMakeSalt):
877
878 2020-06-15  Chris Dumez  <cdumez@apple.com>
879
880         Revert r260856 as it seems to have regressed PLT on iOS
881         https://bugs.webkit.org/show_bug.cgi?id=213194
882         <rdar://problem/64331458>
883
884         Unreviewed, revert r260856 due to regression.
885
886         * NetworkProcess/NetworkProcess.cpp:
887         (WebKit::NetworkProcess::NetworkProcess):
888         (WebKit::NetworkProcess::prepareToSuspend):
889         (WebKit::NetworkProcess::resume):
890         * NetworkProcess/NetworkProcess.h:
891         * Shared/WebSQLiteDatabaseTracker.cpp: Added.
892         (WebKit::WebSQLiteDatabaseTracker::WebSQLiteDatabaseTracker):
893         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
894         (WebKit::WebSQLiteDatabaseTracker::setIsSuspended):
895         (WebKit::WebSQLiteDatabaseTracker::willBeginFirstTransaction):
896         (WebKit::WebSQLiteDatabaseTracker::didFinishLastTransaction):
897         (WebKit::WebSQLiteDatabaseTracker::setIsHoldingLockedFiles):
898         * Shared/WebSQLiteDatabaseTracker.h: Added.
899         * SourcesCocoa.txt:
900         * UIProcess/Network/NetworkProcessProxy.cpp:
901         (WebKit::NetworkProcessProxy::didClose):
902         (WebKit::NetworkProcessProxy::setIsHoldingLockedFiles):
903         * UIProcess/Network/NetworkProcessProxy.h:
904         * UIProcess/Network/NetworkProcessProxy.messages.in:
905         * UIProcess/WebProcessProxy.cpp:
906         (WebKit::WebProcessProxy::shutDown):
907         (WebKit::WebProcessProxy::setIsHoldingLockedFiles):
908         * UIProcess/WebProcessProxy.h:
909         * UIProcess/WebProcessProxy.messages.in:
910         * WebKit.xcodeproj/project.pbxproj:
911         * WebProcess/WebProcess.cpp:
912         (WebKit::m_webSQLiteDatabaseTracker):
913         (WebKit::WebProcess::prepareToSuspend):
914         (WebKit::WebProcess::processDidResume):
915         * WebProcess/WebProcess.h:
916
917 2020-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
918
919         [GTK][WPE] Add API to expose UIClient::requestStorageAccessConfirm
920         https://bugs.webkit.org/show_bug.cgi?id=210422
921
922         Reviewed by Michael Catanzaro.
923
924         Add WebKitWebsiteDataAccessPermissionRequest to ask for permission to the user using the existing permission
925         request API.
926
927         * PlatformGTK.cmake:
928         * PlatformWPE.cmake:
929         * SourcesGTK.txt:
930         * SourcesWPE.txt:
931         * UIProcess/API/glib/WebKitUIClient.cpp:
932         * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequest.cpp: Added.
933         (webkitWebsiteDataAccessPermissionRequestAllow):
934         (webkitWebsiteDataAccessPermissionRequestDeny):
935         (webkit_permission_request_interface_init):
936         (webkitWebsiteDataAccessPermissionRequestDispose):
937         (webkit_website_data_access_permission_request_class_init):
938         (webkitWebsiteDataAccessPermissionRequestCreate):
939         (webkit_website_data_access_permission_request_get_requesting_domain):
940         (webkit_website_data_access_permission_request_get_current_domain):
941         * UIProcess/API/glib/WebKitWebsiteDataAccessPermissionRequestPrivate.h: Added.
942         * UIProcess/API/gtk/WebKitWebsiteDataAccessPermissionRequest.h: Added.
943         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
944         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
945         * UIProcess/API/gtk/webkit2.h:
946         * UIProcess/API/wpe/WebKitWebsiteDataAccessPermissionRequest.h: Added.
947         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
948         * UIProcess/API/wpe/docs/wpe-docs.sgml:
949         * UIProcess/API/wpe/webkit.h:
950
951 2020-06-14  Sam Weinig  <weinig@apple.com>
952
953         [WPT] html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html fails due to lack of caching of Plugin objects
954         https://bugs.webkit.org/show_bug.cgi?id=213185
955
956         Reviewed by Darin Adler.
957
958         * UIProcess/Plugins/PluginInfoStore.h:
959         Add missing #include that is now needed due to pruning of unnecessary #includes
960         in WebCore.
961
962         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
963         (WebKit::pluginSupportsExtension):
964         Update to use new webVisibleMimeTypes() rather than the clunky getWebVisibleMimesAndPluginIndices().
965
966 2020-06-14  David Kilzer  <ddkilzer@apple.com>
967
968         [IPC hardening] Return type of -[NSCoder validateClassSupportsSecureCoding:] is incorrect
969         <https://webkit.org/b/213161>
970         <rdar://problem/64050085>
971
972         Reviewed by Darin Adler.
973
974         * Shared/API/Cocoa/WKRemoteObjectCoder.mm:
975         (validateClass):
976         - Fix return type of
977           -[NSCoder validateClassSupportsSecureCoding:].  Throw an
978           NSException in case the method ever returns NO without
979           throwing its own NSException.  (Currently this method does
980           throw an NSException instead of returning NO.)
981
982 2020-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
983
984         [SOUP] Disable HSTS for requests when cookies will be blocked by ITP
985         https://bugs.webkit.org/show_bug.cgi?id=210739
986
987         Reviewed by Michael Catanzaro.
988
989         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
990         (WebKit::NetworkDataTaskSoup::shouldAllowHSTSProtocolUpgrade const):
991
992 2020-06-13  Richard Houle  <rhoule@apple.com>
993
994         Fix Overrelease in makeFailureSetForAllTextManipulationItems
995         https://bugs.webkit.org/show_bug.cgi?id=213165
996         <rdar://problem/61389164>
997
998         Reviewed by Wenson Hsieh.
999
1000         * UIProcess/API/Cocoa/WKWebView.mm:
1001         (makeFailureSetForAllTextManipulationItems):
1002
1003 2020-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1004
1005         [Mac Catalyst] Color inputs and selects fail to display popovers when clicked
1006         https://bugs.webkit.org/show_bug.cgi?id=213157
1007         <rdar://problem/64004135>
1008
1009         Reviewed by Tim Horton.
1010
1011         In Mac Catalyst, presenting popovers using `UIPopoverController` causes the first responder to change. This
1012         means that the WKContentView will resign first responder, which in turn causes the currently presented popover
1013         to be dismissed. This means that popovers for color inputs and select elements will be dismissed immediately
1014         after presentation.
1015
1016         To mitigate this, adapt the approach taken in r259840 to `WKColorPopover` and `WKSelectPopover` by teaching the
1017         base class (`WKRotatingPopover`) to temporarily preserve the focused element in light of first responder changes
1018         while presenting a popover on Mac Catalyst.
1019
1020         * UIProcess/ios/forms/WKFormPopover.mm:
1021         (-[WKRotatingPopover presentPopoverAnimated:]):
1022         (-[WKRotatingPopover dismissPopoverAnimated:]):
1023
1024 2020-06-13  Sam Weinig  <weinig@apple.com>
1025
1026         Extended Color: Experiment with strongly typed ColorComponents
1027         https://bugs.webkit.org/show_bug.cgi?id=212396
1028
1029         Reviewed by Darin Adler.
1030
1031         * UIProcess/API/wpe/WebKitColor.cpp:
1032         (webkitColorFillFromWebCoreColor):
1033         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
1034         (WebKit::ViewGestureController::beginSwipeGesture):
1035         * WebProcess/WebPage/WebFrame.cpp:
1036         (WebKit::WebFrame::getDocumentBackgroundColor):
1037         Update to call toSRGBALossy() rather than toSRGBAComponentsLossy().
1038
1039 2020-06-13  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
1040
1041         Remove FileError.h
1042         https://bugs.webkit.org/show_bug.cgi?id=213119
1043
1044         Reviewed by Chris Dumez.
1045
1046         * WebProcess/Network/WebSocketChannel.cpp:
1047         (WebKit::WebSocketChannel::createMessageQueue):
1048
1049 2020-06-12  Brian Burg  <bburg@apple.com>
1050
1051         Automation.computeElementLayout should return iframe-relative element rects (when coordinate system is 'Page')
1052         https://bugs.webkit.org/show_bug.cgi?id=213139
1053         <rdar://problem/55042445>
1054
1055         Reviewed by Devin Rousso.
1056
1057         Automation.computeElementLayout has two coordinate systems it can use, LayoutViewport (used for hit testing)
1058         and Page (used for Get Element Rect). Since Get Element Rect expects coordinates relative to the current
1059         browsing context, make the mode simpler by reporting the bounds from Element::boundingClientRect() which
1060         are frame-relative.
1061
1062         Covered by existing WPT suite. The semantics of this command are under review, as
1063         the remote end steps seem to describe a different result than what the non-normative text does.
1064
1065         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1066         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1067
1068 2020-06-12  David Kilzer  <ddkilzer@apple.com>
1069
1070         [IPC hardening] Check enum values in IPC::Decoder::decodeEnum() an IPC::Encoder::encodeEnum()
1071         <https://webkit.org/b/211988>
1072         <rdar://problem/63137695>
1073
1074         Reviewed by Darin Adler.
1075
1076         Replace decodeEnum() with decode() and encodeEnum() with
1077         operator<<().
1078
1079         * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h:
1080         (WebKit::TextTrackPrivateRemoteConfiguration::encode const):
1081         * GPUProcess/media/TrackPrivateRemoteConfiguration.h:
1082         (WebKit::TrackPrivateRemoteConfiguration::encode const):
1083         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1084         (WebKit::NetworkProcessCreationParameters::encode const):
1085         (WebKit::NetworkProcessCreationParameters::decode):
1086         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1087         (WebKit::NetworkResourceLoadParameters::encode const):
1088         (WebKit::NetworkResourceLoadParameters::decode):
1089         * Platform/IPC/Decoder.h:
1090         (IPC::Decoder::decode):
1091         (IPC::Decoder::operator>>):
1092         - Make use of std::underlying_type_t<>.
1093         (IPC::Decoder::decodeEnum): Delete.
1094         - Replace with calls to decode().
1095         * Platform/IPC/Encoder.h:
1096         (IPC::Encoder::operator<<):
1097         (IPC::Encoder::encode):
1098         - Make use of WTF::enumToUnderlyingType<>.
1099         (IPC::Encoder::encodeEnum): Delete.
1100         - Replace with calls to operator<<().
1101         * Shared/Cocoa/ArgumentCodersCocoa.mm:
1102         (IPC::decodeObject):
1103         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1104         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::encode):
1105         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode):
1106         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::encode):
1107         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest::LineItem>::decode):
1108         * Shared/ContextMenuContextData.cpp:
1109         (WebKit::ContextMenuContextData::encode const):
1110         (WebKit::ContextMenuContextData::decode):
1111         * Shared/FocusedElementInformation.cpp:
1112         (WebKit::FocusedElementInformation::encode const):
1113         (WebKit::FocusedElementInformation::decode):
1114         * Shared/LoadParameters.cpp:
1115         (WebKit::LoadParameters::encode const):
1116         (WebKit::LoadParameters::decode):
1117         * Shared/NavigationActionData.cpp:
1118         (WebKit::NavigationActionData::encode const):
1119         (WebKit::NavigationActionData::decode):
1120         * Shared/PlatformPopupMenuData.cpp:
1121         (WebKit::PlatformPopupMenuData::encode const):
1122         (WebKit::PlatformPopupMenuData::decode):
1123         * Shared/Plugins/PluginProcessCreationParameters.cpp:
1124         (WebKit::PluginProcessCreationParameters::encode const):
1125         (WebKit::PluginProcessCreationParameters::decode):
1126         * Shared/PrintInfo.cpp:
1127         (WebKit::PrintInfo::encode const):
1128         (WebKit::PrintInfo::decode):
1129         * Shared/RTCPacketOptions.cpp:
1130         (WebKit::RTCPacketOptions::encode const):
1131         (WebKit::RTCPacketOptions::decode):
1132         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1133         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
1134         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
1135         (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
1136         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1137         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1138         (ArgumentCoder<ScrollingStateNode>::encode):
1139         (ArgumentCoder<RequestedScrollData>::encode):
1140         (ArgumentCoder<RequestedScrollData>::decode):
1141         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1142         * Shared/SessionState.cpp:
1143         (WebKit::HTTPBody::Element::encode const):
1144         (WebKit::HTTPBody::Element::decode):
1145         (WebKit::PageState::encode const):
1146         (WebKit::PageState::decode):
1147         * Shared/TouchBarMenuItemData.cpp:
1148         (WebKit::TouchBarMenuItemData::encode const):
1149         (WebKit::TouchBarMenuItemData::decode):
1150         * Shared/UserData.cpp:
1151         (WebKit::UserData::encode):
1152         (WebKit::UserData::decode):
1153         * Shared/WebContextMenuItemData.cpp:
1154         (WebKit::WebContextMenuItemData::encode const):
1155         (WebKit::WebContextMenuItemData::decode):
1156         * Shared/WebCoreArgumentCoders.cpp:
1157         (IPC::ArgumentCoder<LinearTimingFunction>::encode):
1158         (IPC::ArgumentCoder<CubicBezierTimingFunction>::encode):
1159         (IPC::ArgumentCoder<CubicBezierTimingFunction>::decode):
1160         (IPC::ArgumentCoder<StepsTimingFunction>::encode):
1161         (IPC::ArgumentCoder<SpringTimingFunction>::encode):
1162         (IPC::ArgumentCoder<PluginInfo>::encode):
1163         (IPC::ArgumentCoder<PluginInfo>::decode):
1164         (IPC::ArgumentCoder<ProtectionSpace>::encode):
1165         (IPC::ArgumentCoder<ProtectionSpace>::decode):
1166         (IPC::ArgumentCoder<Credential>::encode):
1167         (IPC::ArgumentCoder<Credential>::decode):
1168         (IPC::ArgumentCoder<Cursor>::encode):
1169         (IPC::ArgumentCoder<Cursor>::decode):
1170         (IPC::ArgumentCoder<ResourceError>::encode):
1171         (IPC::ArgumentCoder<ResourceError>::decode):
1172         (IPC::ArgumentCoder<DragData>::encode):
1173         (IPC::ArgumentCoder<DragData>::decode):
1174         (IPC::ArgumentCoder<CompositionUnderline>::encode):
1175         (IPC::ArgumentCoder<CompositionUnderline>::decode):
1176         (IPC::ArgumentCoder<FileChooserSettings>::encode):
1177         (IPC::ArgumentCoder<FileChooserSettings>::decode):
1178         (IPC::ArgumentCoder<TextCheckingRequestData>::encode):
1179         (IPC::ArgumentCoder<TextCheckingRequestData>::decode):
1180         (IPC::ArgumentCoder<TextCheckingResult>::encode):
1181         (IPC::ArgumentCoder<TextCheckingResult>::decode):
1182         (IPC::ArgumentCoder<UserStyleSheet>::encode):
1183         (IPC::ArgumentCoder<UserStyleSheet>::decode):
1184         (IPC::ArgumentCoder<ScrollableAreaParameters>::encode):
1185         (IPC::ArgumentCoder<ScrollableAreaParameters>::decode):
1186         (IPC::ArgumentCoder<FilterOperation>::encode):
1187         (IPC::decodeFilterOperation):
1188         (IPC::ArgumentCoder<FontAttributes>::encode):
1189         (IPC::ArgumentCoder<FontAttributes>::decode):
1190         (IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::encode):
1191         (IPC::ArgumentCoder<WebCore::SerializedPlatformDataCueValue>::decode):
1192         * Shared/WebPageCreationParameters.cpp:
1193         (WebKit::WebPageCreationParameters::encode const):
1194         (WebKit::WebPageCreationParameters::decode):
1195         * Shared/WebPopupItem.cpp:
1196         (WebKit::WebPopupItem::encode const):
1197         (WebKit::WebPopupItem::decode):
1198         * Shared/WebProcessCreationParameters.cpp:
1199         (WebKit::WebProcessCreationParameters::encode const):
1200         (WebKit::WebProcessCreationParameters::decode):
1201         * Shared/WebsiteData/WebsiteData.cpp:
1202         (WebKit::WebsiteData::Entry::encode const):
1203         (WebKit::WebsiteData::Entry::decode):
1204         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1205         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
1206         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
1207         (IPC::ArgumentCoder<ProtectionSpace>::encodePlatformData):
1208         (IPC::ArgumentCoder<ProtectionSpace>::decodePlatformData):
1209         * Shared/glib/InputMethodState.cpp:
1210         (WebKit::InputMethodState::encode const):
1211         (WebKit::InputMethodState::decode):
1212         * Shared/glib/UserMessage.cpp:
1213         (WebKit::UserMessage::encode const):
1214         (WebKit::UserMessage::decode):
1215         * Shared/mac/ColorSpaceData.mm:
1216         (WebKit::ColorSpaceData::encode const):
1217         (WebKit::ColorSpaceData::decode):
1218         * Shared/mac/SecItemRequestData.cpp:
1219         (WebKit::SecItemRequestData::encode const):
1220         (WebKit::SecItemRequestData::decode):
1221         * Shared/mac/WebCoreArgumentCodersMac.mm:
1222         (IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData):
1223         (IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData):
1224         (IPC::ArgumentCoder<WebCore::CertificateInfo>::encode):
1225         (IPC::ArgumentCoder<WebCore::CertificateInfo>::decode):
1226         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
1227         (IPC::ArgumentCoder<SoupNetworkProxySettings>::encode):
1228         (IPC::ArgumentCoder<SoupNetworkProxySettings>::decode):
1229         * WebProcess/GPU/media/RemoteMediaPlayerState.h:
1230         (WebKit::RemoteMediaPlayerState::encode const):
1231         (WebKit::RemoteMediaPlayerState::decode):
1232         * WebProcess/Network/NetworkProcessConnectionInfo.h:
1233         (WebKit::NetworkProcessConnectionInfo::decode):
1234         * WebProcess/Plugins/Plugin.cpp:
1235         (WebKit::Plugin::Parameters::encode const):
1236         (WebKit::Plugin::Parameters::decode):
1237         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1238         (WebKit::PlatformCAAnimationRemote::KeyframeValue::encode const):
1239         (WebKit::PlatformCAAnimationRemote::KeyframeValue::decode):
1240         (WebKit::PlatformCAAnimationRemote::Properties::encode const):
1241         (WebKit::PlatformCAAnimationRemote::Properties::decode):
1242
1243 2020-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1244
1245         [iPadOS] Focusing selects and color inputs should not bring up the software keyboard
1246         https://bugs.webkit.org/show_bug.cgi?id=213149
1247         <rdar://problem/64312450>
1248
1249         Reviewed by Darin Adler.
1250
1251         After <trac.webkit.org/r261658>, we now opt into bringing up the software keyboard when focusing color inputs
1252         and select elements. This is due to the changes in `-_shouldShowAutomaticKeyboardUIIgnoringInputMode`, which
1253         were intended to make us return `NO` for date and time inputs, but also unintentionally makes us return `YES`
1254         on iPadOS.
1255
1256         This patch fixes the bug by returning `!WebKit::currentUserInterfaceIdiomIsPad()` instead, and additionally
1257         preserves the existing behavior of now showing a color picker for `<input type="color" readonly>` on iPhone.
1258
1259         Test: fast/forms/ios/ipad/select-should-not-bring-up-software-keyboard.html
1260
1261         * UIProcess/ios/WKContentViewInteraction.mm:
1262         (-[WKContentView becomeFirstResponderForWebView]):
1263         (-[WKContentView resignFirstResponderForWebView]):
1264         (-[WKContentView _shouldShowAutomaticKeyboardUIIgnoringInputMode]):
1265         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
1266
1267 2020-06-12  Alex Christensen  <achristensen@webkit.org>
1268
1269         Make API tests tolerant of our relatively new use of WebPageProxy::preconnectTo
1270         https://bugs.webkit.org/show_bug.cgi?id=213144
1271
1272         Reviewed by Geofferey Garen.
1273
1274         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1275         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1276         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1277         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
1278         (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
1279         (WebKit::NetworkSessionCocoa::taskServerConnectionSucceeded):
1280         (WebKit::NetworkSessionCocoa::taskReceivedBytes): Deleted.
1281         Fix our logic that remembers successful client certificate connections.
1282         If a task completes with no error (like a preconnect task does), consider that a successful connection.
1283
1284         * UIProcess/Network/NetworkProcessProxy.cpp:
1285         (WebKit::NetworkProcessProxy::preconnectTo):
1286         Remove the check to not preconnect to loopback addresses.
1287         This was making our tests different than the real internet and prevented me from landing a perfectly good test
1288         in https://bugs.webkit.org/show_bug.cgi?id=213109
1289
1290 2020-06-12  Per Arne Vollan  <pvollan@apple.com>
1291
1292         [iOS] Preferences are not being observed if the process pool is being created after activation
1293         https://bugs.webkit.org/show_bug.cgi?id=213145
1294
1295         Reviewed by Brent Fulgham.
1296
1297         If the app is creating the Web process pool after being activated, preferences will not be observed until the app is being backgrounded
1298         and then foregrounded again, since the preference observer is initialized when handling the app activation notification.
1299
1300         No new tests, since an API test would make sense in this case, but API tests aren't run on iOS.
1301
1302         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1303         (WebKit::WebProcessPool::platformInitializeWebProcess):
1304
1305 2020-06-12  Takashi Komori  <Takashi.Komori@sony.com>
1306
1307         [Curl] Implement functions to use ResourceLoadStatistics.
1308         https://bugs.webkit.org/show_bug.cgi?id=207692
1309
1310         Reviewed by Don Olmstead.
1311
1312         Implement functions which are required to implement ResourceLoadStatistics for Curl port.
1313
1314         In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed.
1315
1316         Tests: http/tests/resourceLoadStatistics/
1317
1318         * NetworkProcess/NetworkDataTask.cpp:
1319         (WebKit::NetworkDataTask::create):
1320         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1321         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
1322         (WebKit::NetworkDataTaskCurl::createCurlRequest):
1323         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
1324         (WebKit::NetworkDataTaskCurl::blockCookies):
1325         (WebKit::NetworkDataTaskCurl::unblockCookies):
1326         (WebKit::NetworkDataTaskCurl::shouldBlockCookies):
1327         (WebKit::NetworkDataTaskCurl::isThirdPartyRequest):
1328         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1329         * NetworkProcess/curl/NetworkSessionCurl.cpp:
1330         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
1331         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1332         (WKWebsiteDataStoreGetAllStorageAccessEntries):
1333         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1334         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1335         (WebKit::WebsiteDataStore::parameters):
1336
1337 2020-06-12  Antoine Quint  <graouts@webkit.org>
1338
1339         Double tap to zoom out doesn't work after upgrading to iOS 13
1340         https://bugs.webkit.org/show_bug.cgi?id=205158
1341         <rdar://problem/205158>
1342
1343         Reviewed by Wenson Hsieh.
1344
1345         Test: fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html
1346
1347         In order to determine whether a significant zoom to happen, we should use the current page scale
1348         factor and not the initial page scale factor.
1349
1350         * UIProcess/ios/WKContentViewInteraction.mm:
1351         (-[WKContentView _handleSmartMagnificationInformationForPotentialTap:renderRect:fitEntireRect:viewportMinimumScale:viewportMaximumScale:nodeIsRootLevel:]):
1352
1353 2020-06-12  Alex Christensen  <achristensen@webkit.org>
1354
1355         Add WKUserScript initializer SPI with alternative names
1356         https://bugs.webkit.org/show_bug.cgi?id=213096
1357
1358         Reviewed by Youenn Fablet.
1359
1360         And deprecate the existing ones so we can remove them soon.
1361
1362         * UIProcess/API/Cocoa/WKUserScript.mm:
1363         (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:includeMatchPatternStrings:excludeMatchPatternStrings:associatedURL:contentWorld:deferRunningUntilNotification:]):
1364         * UIProcess/API/Cocoa/WKUserScriptPrivate.h:
1365
1366 2020-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1367
1368         Unreviewed. Fix GTK4 build
1369
1370         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1371         (webkitWebViewBaseSynthesizeKeyEvent):
1372
1373 2020-06-11  Sam Weinig  <weinig@apple.com>
1374
1375         Document.currentScript does not work for SVGScriptElements
1376         https://bugs.webkit.org/show_bug.cgi?id=213104
1377
1378         Reviewed by Yusuke Suzuki.
1379
1380         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1381         (webkit_dom_document_get_current_script):
1382         Update to account for change in Document::currentScript() now returning an
1383         Element* that can be either an HTMLScriptElement or an SVGScriptElement. To
1384         keep API compatibility, only return non-null for HTMLScriptElements.
1385
1386 2020-06-12  Charlie Turner  <cturner@igalia.com>
1387
1388         [GTK] Add an internal API to run javascript without forced user gestures
1389         https://bugs.webkit.org/show_bug.cgi?id=212969
1390
1391         Reviewed by Carlos Garcia Campos.
1392
1393         To be used by tests in a follow-up commit.
1394
1395         * UIProcess/API/glib/WebKitWebView.cpp:
1396         (webkitWebViewRunJavaScriptWithParams): Factor out the glue to run
1397         JavaScript in the page.
1398         (webkitWebViewRunJavascriptWithoutForcedUserGestures): Add a new
1399         internal API for use by tests.
1400         (webkit_web_view_run_javascript): Modified to use factored out
1401         glue.
1402         * UIProcess/API/glib/WebKitWebViewInternal.h: Added. Place to keep
1403         API test-specific internal APIs.
1404
1405 2020-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1406
1407         [GTK4] Make WebDriver work
1408         https://bugs.webkit.org/show_bug.cgi?id=212316
1409
1410         Reviewed by Adrian Perez de Castro.
1411
1412         Fix UIClient::setWindowFrame to wait for surface size-changed signal after resizing the window and implement
1413         maximize, minimize and restore windows for GTK4.
1414
1415         * UIProcess/API/glib/WebKitUIClient.cpp:
1416         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
1417         (surfaceStateChangedCallback):
1418         (webkitWebViewMonitorWindowState):
1419         (webkitWebViewMaximizeWindow):
1420         (webkitWebViewMinimizeWindow):
1421         (webkitWebViewRestoreWindow):
1422
1423 2020-06-11  David Kilzer  <ddkilzer@apple.com>
1424
1425         [IPC] Add WTF::EnumTraits<> for every enum type used in IPC
1426         <https://webkit.org/b/213093>
1427
1428         Reviewed by Darin Adler.
1429
1430         Summary:
1431         - Change underlying type of enum class to `bool` when there are
1432           only two values.  In some cases, reorder the two values so the
1433           mapping to 0 and 1 makes more sense.  Converting every enum to
1434           an enum class is not a goal of this patch, so some two-value
1435           enums stil have WTF::EnumTraits<> defined as noted below.
1436         - Add WTF::EnumTraits<> for the remaining enum types that are
1437           used by IPC::Encoder::encodeEnum() and
1438           IPC::Decoder::decodeEnum() so that WTF::isValidEnum<>() checks
1439           may be added next.
1440         - Add #include <WebCore/LibWebRTCEnumTraits.h> as needed.
1441
1442         * GPUProcess/GPUConnectionToWebProcess.h:
1443         * GPUProcess/GPUProcess.h:
1444         * NetworkProcess/NetworkLoadParameters.h:
1445         * Shared/API/APIObject.h:
1446         * Shared/ContextMenuContextData.h:
1447         * Shared/DrawingAreaInfo.h:
1448         * Shared/FocusedElementInformation.h:
1449         * Shared/PrintInfo.h:
1450         (WTF::EnumTraits<WebKit::PrintInfo::PrintMode>):
1451         - Define this since PrintMode is not an enum class.
1452         * Shared/RTCPacketOptions.cpp:
1453         * Shared/SessionState.h:
1454         * Shared/TouchBarMenuItemData.h:
1455         * Shared/WebEvent.h:
1456         * Shared/WebPopupItem.cpp:
1457         (WebKit::WebPopupItem::WebPopupItem):
1458         - Fix reference to WebPopupItem::Type enum.
1459         * Shared/WebPopupItem.h:
1460         (WebKit::WebPopupItem::Type):
1461         - Convert from enum to enum class.
1462         * Shared/WebsiteData/WebsiteDataType.h:
1463         * Shared/glib/InputMethodState.h:
1464         * Shared/glib/UserMessage.h:
1465         * Shared/mac/ColorSpaceData.mm:
1466         * Shared/mac/SecItemRequestData.h:
1467         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1468         (WebKit::WebPopupMenuProxyMac::populate):
1469         - Fix reference to WebPopupItem::Type enum.
1470         * WebProcess/Plugins/Plugin.cpp:
1471         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
1472         (WebKit::WebPopupMenu::populateItems):
1473         - Fix reference to WebPopupItem::Type enum.
1474         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
1475
1476 2020-06-11  Alex Christensen  <achristensen@webkit.org>
1477
1478         Re-enable download resume tests
1479         https://bugs.webkit.org/show_bug.cgi?id=213098
1480         <rdar://problem/63512518>
1481
1482         Reviewed by Geoffrey Garen.
1483
1484         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1485         (-[WKNetworkSessionDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:]):
1486
1487 2020-06-11  Beth Dakin  <bdakin@apple.com>
1488
1489         Replace instances of whitelist in WebCore with allowlist
1490         https://bugs.webkit.org/show_bug.cgi?id=213068
1491
1492         Reviewed by Tim Horton.
1493
1494         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1495         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
1496         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
1497         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
1498         * Shared/WebCoreArgumentCoders.cpp:
1499         (IPC::ArgumentCoder<UserStyleSheet>::encode):
1500         (IPC::ArgumentCoder<UserStyleSheet>::decode):
1501         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1502         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
1503         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
1504         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
1505         * WebProcess/cocoa/WebProcessCocoa.mm:
1506         (WebKit::WebProcess::platformInitializeWebProcess):
1507
1508 2020-06-11  Jonathan Bedard  <jbedard@apple.com>
1509
1510         WebKit: Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT)
1511         https://bugs.webkit.org/show_bug.cgi?id=213076
1512         <rdar://problem/64254698>
1513
1514         Reviewed by Tim Horton.
1515
1516         No new tests, behavior unchanged.
1517
1518         * Platform/spi/ios/UIKitSPI.h:
1519         * UIProcess/API/ios/WKWebViewTestingIOS.mm:
1520         (-[WKWebView _requestDocumentContext:completionHandler:]): Guard requestDocumentContext with HAVE(UI_WK_DOCUMENT_CONTEXT).
1521         (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Ditto.
1522
1523 2020-06-11  Jonathan Bedard  <jbedard@apple.com>
1524
1525         WebKit: Add UIKit SPI for watchOS and tvOS
1526         https://bugs.webkit.org/show_bug.cgi?id=213077
1527         <rdar://problem/64255131>
1528
1529         Reviewed by Tim Horton.
1530
1531         No new tests, behavior unchanged.
1532
1533         * Platform/spi/ios/UIKitSPI.h:
1534
1535 2020-06-11  David Kilzer  <ddkilzer@apple.com>
1536
1537         [IPC] Adopt enum class for DragSourceAction
1538         <https://webkit.org/b/212885>
1539         <rdar://problem/64094134>
1540
1541         Reviewed by Darin Adler.
1542
1543         Summary:
1544         - Convert argument parameters from uint64_t to
1545           OptionSet<DragSourceAction>.
1546         - Convert DragSourceAction to OptionSet<DragSourceAction>.
1547
1548         * Scripts/webkit/messages.py:
1549         - Map DragSourceAction enum to DragActions.h header.
1550         * UIProcess/WebPageProxy.h:
1551         * UIProcess/ios/DragDropInteractionState.h:
1552         * UIProcess/ios/DragDropInteractionState.mm:
1553         (WebKit::shouldUseDragImageToCreatePreviewForDragSource):
1554         (WebKit::shouldUseVisiblePathToCreatePreviewForDragSource):
1555         (WebKit::shouldUseTextIndicatorToCreatePreviewForDragSource):
1556         (WebKit::canUpdatePreviewForActiveDragSource):
1557         (WebKit::DragDropInteractionState::anyActiveDragSourceIs const):
1558         (WebKit::DragDropInteractionState::stageDragItem):
1559         (WebKit::DragDropInteractionState::hasStagedDragSource const):
1560         (WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):
1561         * UIProcess/ios/WKContentViewInteraction.mm:
1562         (-[WKContentView _startDrag:item:]):
1563         (-[WKContentView _allowedDragSourceActions]):
1564         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
1565         * UIProcess/ios/WebPageProxyIOS.mm:
1566         (WebKit::WebPageProxy::requestDragStart):
1567         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1568         * WebProcess/WebCoreSupport/WebDragClient.cpp:
1569         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
1570         * WebProcess/WebCoreSupport/WebDragClient.h:
1571         * WebProcess/WebPage/WebPage.h:
1572         (WebKit::WebPage::allowedDragSourceActions const):
1573         * WebProcess/WebPage/WebPage.messages.in:
1574         * WebProcess/WebPage/ios/WebPageIOS.mm:
1575         (WebKit::WebPage::requestDragStart):
1576         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1577
1578 2020-06-11  Eric Carlson  <eric.carlson@apple.com>
1579
1580         [Cocoa] MediaUsageManagerCocoa should use a different USVideoUsage initializer
1581         https://bugs.webkit.org/show_bug.cgi?id=213058
1582
1583         Reviewed by Jer Noble.
1584
1585         No new tests, tested manually.
1586
1587         * UIProcess/Media/cocoa/MediaUsageManagerCocoa.mm:
1588         (WebKit::MediaUsageManagerCocoa::reset): Drive-by fix: don't call -stop unless the
1589         element was playing.
1590         (WebKit::MediaUsageManagerCocoa::updateMediaUsage): Use a different initializer so
1591         we can pass in the state.
1592
1593 2020-06-11  ChangSeok Oh  <changseok@webkit.org>
1594
1595         [GTK] Implement button-press-event, button-release-event, and absolute-axis-event of GAMEPAD API.
1596         https://bugs.webkit.org/show_bug.cgi?id=133850
1597
1598         Reviewed by Carlos Garcia Campos.
1599
1600         * UIProcess/Gamepad/UIGamepadProvider.cpp: Add the OS(LINUX) guard.
1601         * UIProcess/Gamepad/gtk/UIGamepadProviderGtk.cpp:
1602         (WebKit::getWebPageProxy): Build fix. WebKitWebViewBase is used, not WebKitWebViewPrivate.
1603         * UIProcess/Gamepad/manette/UIGamepadProviderManette.cpp: Add the OS(LINUX) guard.
1604
1605 2020-06-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1606
1607         [macOS]: The File Picker of the <input> file element should show the selection filter
1608         https://bugs.webkit.org/show_bug.cgi?id=212485
1609
1610         Reviewed by Darin Adler.
1611
1612         Add two private helpers to WKOpenPanelParameters.
1613
1614         * UIProcess/API/Cocoa/WKOpenPanelParameters.mm:
1615         (-[WKOpenPanelParameters _allowedFileExtensions]):
1616         Returns an array of strings representing the allowed extensions.
1617
1618         (-[WKOpenPanelParameters _allowedFileExtensionsDescription]):
1619         Returns a string representing a description for the allowed extensions.
1620
1621         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
1622
1623 2020-06-10  Beth Dakin  <bdakin@apple.com>
1624
1625         Replace instances of blacklist in WebCore with blocklist
1626         https://bugs.webkit.org/show_bug.cgi?id=213064
1627
1628         Reviewed by Tim Horton.
1629
1630         * Shared/WebCoreArgumentCoders.cpp:
1631         (IPC::ArgumentCoder<UserStyleSheet>::encode):
1632         (IPC::ArgumentCoder<UserStyleSheet>::decode):
1633
1634 2020-06-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1635
1636         [iOS] editing/pasteboard/dom-paste tests consistently time out
1637         https://bugs.webkit.org/show_bug.cgi?id=213061
1638         <rdar://problem/64211161>
1639
1640         Reviewed by Darin Adler.
1641
1642         On recent versions of iOS, system changes have moved the timing of the call to
1643         `-requestAutocorrectionContextWithCompletionHandler:` when focusing an editable element. This results in a
1644         consistently reproducible deadlock between the UI process and web process if a page tries to request
1645         programmatic clipboard access during the click event (importantly, in the same runloop as element focus).
1646
1647         What ends up happening is that the autocorrection context is requested by the UI process shortly after the
1648         (unbounded) sync IPC message for the DOM paste arrives, so we end up waiting forever for the sync-IPC-blocked
1649         web process to respond. Normally this just results in a 1 second hang, and the DOM paste proceeds as normal.
1650         However these layout tests purposefully opt out of sync IPC timeouts (precisely so that we can catch bugs like
1651         this). See below for more details.
1652
1653         * UIProcess/ios/WKContentViewInteraction.h:
1654
1655         Keep track of the most recent autocorrection context that arrived in the UI process.
1656
1657         * UIProcess/ios/WKContentViewInteraction.mm:
1658         (-[WKContentView cleanUpInteraction]):
1659
1660         Clear out the autocorrection context, in case the web process crashes.
1661
1662         (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
1663
1664         If the autocorrection context is requested while handling a DOM paste, we know that the latest autocorrection
1665         context must be up to date, since the autocorrection context is computed and sent immediately before a DOM paste
1666         request. Use this to immediately invoke the completion handler, without any sync IPC back to the web process.
1667
1668         (-[WKContentView _handleAutocorrectionContext:]):
1669
1670 2020-06-10  Hiro (mzp) Mizuno  <mzp@apple.com>
1671
1672         [iOS] Option + Forward Delete should delete next word
1673         https://bugs.webkit.org/show_bug.cgi?id=213062
1674         rdar://64225458
1675
1676         Reviewed by Daniel Bates.
1677
1678         Implement support for pressing Option + Forward Delete to delete the next word. This makes text editing
1679         in WebKit more closely match the platform conventions.
1680
1681         * UIProcess/ios/WKContentViewInteraction.mm:
1682         (-[WKContentView canPerformAction:withSender:]): Handle _deleteForwardByWord.
1683         (-[WKContentView _deleteForwardByWord]): Added.
1684
1685 2020-06-10  Geoffrey Garen  <ggaren@apple.com>
1686
1687         Some style improvements to main thread code
1688         https://bugs.webkit.org/show_bug.cgi?id=213051
1689
1690         Reviewed by Darin Adler.
1691
1692         Updated for rename.
1693
1694         * Shared/Cocoa/WebKit2InitializeCocoa.mm:
1695         (WebKit::runInitializationCode):
1696         (WebKit::InitializeWebKit2):
1697         * Shared/WebKit2Initialize.cpp:
1698         (WebKit::InitializeWebKit2):
1699
1700 2020-06-10  Jonathan Bedard  <jbedard@apple.com>
1701
1702         WebKit:Add PepperUICoreSPI.h (Follow-up fix 2)
1703         https://bugs.webkit.org/show_bug.cgi?id=212996
1704         <rdar://problem/64182627>
1705
1706         Unreviewed build fix.
1707
1708         * UIProcess/ios/forms/WKNumberPadViewController.mm:
1709         (-[WKNumberPadViewController addContentViewAnimations:]): Correct APPLE_INTERNAL_SDK macro.
1710         * UIProcess/ios/forms/WKQuickboardListViewController.mm:
1711         (-[WKQuickboardListViewController initWithDelegate:]): Ditto.
1712
1713 2020-06-10  Jonathan Bedard  <jbedard@apple.com>
1714
1715         WebKit:Add PepperUICoreSPI.h (Follow-up fix)
1716         https://bugs.webkit.org/show_bug.cgi?id=212996
1717         <rdar://problem/64182627>
1718
1719         Unreviewed build fix.
1720
1721         * Platform/spi/watchos/PepperUICoreSPI.h: Add PUICPickerView headers.
1722
1723 2020-06-10  David Kilzer  <ddkilzer@apple.com>
1724
1725         REGRESSION (r262858): Fix macOS build when building EndowmentStateTracker.mm
1726
1727         * UIProcess/EndowmentStateTracker.mm:
1728         - Move #if PLATFORM(IOS_FAMILY) to fix macOS build.
1729
1730 2020-06-10  Per Arne Vollan  <pvollan@apple.com>
1731
1732         [Cocoa] Return early from preference change notification handler if there is no observer
1733         https://bugs.webkit.org/show_bug.cgi?id=213050
1734
1735         Reviewed by Darin Adler.
1736
1737         Currently, the observer member is checked inside the loop iterating over all the keys,
1738         but this check should be moved outside of the loop.
1739
1740         No new tests, since this is not a change in behavior.
1741
1742         * UIProcess/Cocoa/PreferenceObserver.mm:
1743         (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]):
1744
1745 2020-06-10  Brady Eidson  <beidson@apple.com>
1746
1747         Crash growing a CFData with incremental PDF loading.
1748         <rdar://problem/63670403> and https://bugs.webkit.org/show_bug.cgi?id=213035
1749
1750         Reviewed by Alex Christensen.
1751
1752         No test - No reliable way to trigger.
1753
1754         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1755         (WebKit::PDFPlugin::ensureDataBufferLength): When you call CFDataCreateMutable with a size other than 0,
1756           your data object can never grow beyond that size.
1757           And, in fact, CFData will crash on purpose when this is attempted.
1758           So always create our mutable CFDatas with size 0 even if we immediately plan to grow them.
1759
1760 2020-06-10  Jonathan Bedard  <jbedard@apple.com>
1761
1762         WebKit: Add ClockKitSPI.h
1763         https://bugs.webkit.org/show_bug.cgi?id=212994
1764         <rdar://problem/64181092>
1765
1766         Reviewed by Wenson Hsieh.
1767
1768         No new tests, behavior unchanged.
1769
1770         * Platform/spi/watchos: Added.
1771         * Platform/spi/watchos/ClockKitSPI.h: Added.
1772         * UIProcess/ios/forms/WKTimePickerViewController.mm: Import ClockKitSPI.h and UIKitSPI.h.
1773         * WebKit.xcodeproj/project.pbxproj: Include ClockKitSPI.
1774
1775 2020-06-10  Brian Burg  <bburg@apple.com>
1776
1777         WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it
1778         https://bugs.webkit.org/show_bug.cgi?id=208232
1779         <rdar://problem/59859491>
1780
1781         Reviewed by Devin Rousso.
1782
1783         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1784         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
1785         The provided coordinates are in LayoutViewport coordinate system, which does
1786         not take topContentInset into account. Add back in the topContentInset
1787         when translating to flipped window coordinates.
1788
1789         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1790         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1791         The calculations of element bounds and IVCP have an incorrect handling of
1792         root coordinates as contents/absolute coordinates. Add the missing conversion.
1793
1794 2020-06-10  Brent Fulgham  <bfulgham@apple.com>
1795
1796         [iOS] Update sandbox rules for correct sanitizer paths in current OS releases
1797         https://bugs.webkit.org/show_bug.cgi?id=213040
1798         <rdar://problem/64187043>
1799
1800         Reviewed by Per Arne Vollan.
1801
1802         Update the sandbox rules on iOS platforms to allow access to the
1803         new system locations for Asan libraries.
1804
1805         * Resources/SandboxProfiles/ios/com.apple.WebKit.GPU.sb:
1806         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1807         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1808
1809 2020-06-10  Jer Noble  <jer.noble@apple.com>
1810
1811         Catalyst WebKit apps continue to play audio after quitting
1812         https://bugs.webkit.org/show_bug.cgi?id=212981
1813         <rdar://problem/57089471>
1814
1815         Reviewed by Chris Dumez.
1816
1817         RunningBoard will track whether a process (and it's associated child processes) are "user-visible" by
1818         granting those processes an "endowment", similar to the existing endowment for application visibility.
1819         Track changes to these endowments using a RBSProcessMonitor, and for Catalyst apps, react to losing the
1820         "user-visible" endowment by suspending all media playback.
1821
1822         Move all the endowment-related code into a new class, EndowmentStateTracker, which is a singleton object
1823         that can have mulitple WebPageProxy clients. Update references to the previously global static
1824         isApplicationForeground() function to refer to EndowmentStateTracker instead.
1825
1826         Drive-by fix: move some iOS-only functions in WebPageProxy.cpp into WebPageProxyIOS.mm.
1827
1828         * UIProcess/ApplicationStateTracker.h:
1829         * UIProcess/ApplicationStateTracker.mm:
1830         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1831         (WebKit::isApplicationForeground): Deleted.
1832         * UIProcess/EndowmentStateTracker.h: Added.
1833         (WebKit::EndowmentStateTracker::isVisible const):
1834         (WebKit::EndowmentStateTracker::isUserFacing const):
1835         * UIProcess/EndowmentStateTracker.mm: Added.
1836         (WebKit::handleForPID):
1837         (WebKit::EndowmentStateTracker::isApplicationForeground):
1838         (WebKit::EndowmentStateTracker::isApplicationUserFacing):
1839         (WebKit::EndowmentStateTracker::singleton):
1840         (WebKit::EndowmentStateTracker::EndowmentStateTracker):
1841         (WebKit::EndowmentStateTracker::addClient):
1842         (WebKit::EndowmentStateTracker::removeClient):
1843         (WebKit::EndowmentStateTracker::setIsUserFacing):
1844         (WebKit::EndowmentStateTracker::setIsVisible):
1845         * UIProcess/WebPageProxy.cpp:
1846         (WebKit::m_limitsNavigationsToAppBoundDomains):
1847         (WebKit::WebPageProxy::~WebPageProxy):
1848         (WebKit::WebPageProxy::processWillBecomeSuspended): Deleted.
1849         (WebKit::WebPageProxy::processWillBecomeForeground): Deleted.
1850         * UIProcess/WebPageProxy.h:
1851         * UIProcess/ios/PageClientImplIOS.mm:
1852         (WebKit::PageClientImpl::isApplicationVisible):
1853         * UIProcess/ios/WebPageProxyIOS.mm:
1854         (WebKit::WebPageProxy::processWillBecomeSuspended):
1855         (WebKit::WebPageProxy::processWillBecomeForeground):
1856         (WebKit::WebPageProxy::isUserFacingChanged):
1857         (WebKit::WebPageProxy::isVisibleChanged):
1858         * WebKit.xcodeproj/project.pbxproj:
1859
1860 2020-06-10  Antoine Quint  <graouts@webkit.org>
1861
1862         Subframes should not autosize independently
1863         https://bugs.webkit.org/show_bug.cgi?id=212984
1864         <rdar://problem/64175493>
1865
1866         Reviewed by Simon Fraser.
1867
1868         Ensure we only call FrameView::enableSizeToContentAutoSizeMode() for the main frame.
1869
1870         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1871         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1872
1873 2020-06-10  Jonathan Bedard  <jbedard@apple.com>
1874
1875         WebKit:Add PepperUICoreSPI.h
1876         https://bugs.webkit.org/show_bug.cgi?id=212996
1877         <rdar://problem/64182627>
1878
1879         Reviewed by Tim Horton.
1880
1881         No new tests, behavior unchanged.
1882
1883         * Platform/spi/watchos: Added.
1884         * Platform/spi/watchos/PepperUICoreSPI.h: Added.
1885         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: Include PepperUICoreSPI header.
1886         * UIProcess/ios/WKScrollView.mm: Ditto.
1887         * UIProcess/ios/forms/WKDatePickerViewController.mm: Remove headers duplicated in PepperUICoreSPI.h.
1888         * UIProcess/ios/forms/WKFocusedFormControlView.mm: Ditto.
1889         * UIProcess/ios/forms/WKNumberPadView.mm: Include PepperUICoreSPI header.
1890         * UIProcess/ios/forms/WKNumberPadViewController.h: Remove headers duplicated in PepperUICoreSPI.h.
1891         * UIProcess/ios/forms/WKNumberPadViewController.mm: Ditto.
1892         (-[WKNumberPadViewController addContentViewAnimations:]): Limit addAnimation to Internal builds.
1893         * UIProcess/ios/forms/WKQuickboardListViewController.h: Include PepperUICoreSPI header.
1894         * UIProcess/ios/forms/WKQuickboardListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h.
1895         (-[WKQuickboardListViewController initWithDelegate:]):
1896         * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Remove headers duplicated in PepperUICoreSPI.h.
1897         * UIProcess/ios/forms/WKTextInputListViewController.mm: Ditto.
1898         * WebKit.xcodeproj/project.pbxproj: Add PepperUICoreSPI.h.
1899
1900 2020-06-10  Per Arne Vollan  <pvollan@apple.com>
1901
1902         [iOS] Add entitlement for PAC exceptions
1903         https://bugs.webkit.org/show_bug.cgi?id=213027
1904         <rdar://problem/63985737>
1905
1906         Reviewed by Brent Fulgham.
1907
1908         On iOS, add entitlement for PAC exceptions.
1909
1910         * Scripts/process-entitlements.sh:
1911
1912 2020-06-10  James Savage  <james.savage@apple.com>
1913
1914         Swift Overlay API refinements
1915         https://bugs.webkit.org/show_bug.cgi?id=212939
1916         <rdar://problem/64140013>
1917
1918         Reviewed by Darin Adler.
1919
1920         This patch cleans up some inconsistencies in the various Swift projections,
1921         and modifies JavaScript evaluation callbacks to be optional to account for
1922         scripts which may not evaluate to a useful result (such as ones that simply
1923         modify the DOM without reporting a status). It also standardizes on using
1924         completionHandler as an argument label to match the rest of WebKit API, and
1925         the majority of the Swift API refinements.
1926         
1927         It also fixes a module issue where the WebKit.h umbrella was missing an
1928         import of WKScriptReplyWithMessageHandler.h, making the type unusable from
1929         Swift source files/
1930
1931         * Shared/API/Cocoa/WebKit.h: Add missing header.
1932         * UIProcess/API/Cocoa/WebKitSwiftOverlay.swift:
1933         (callAsyncJavaScript(_:arguments:in:completionHandler:)): Rename completion
1934             argument, and make optional. Note: Optional closures are implicitly
1935             @escaping, making the annotation redundant and incompatible, so it must
1936             be removed. In Swift, Optional.map()'s closure is invoked iff the Optional
1937             contains some value, and the result of that transform is returned, else
1938             nil is propagated. This allows us to apply the closure transform if the
1939             client value is non-nil, without using intermediary variables or if/let.
1940         (evaluateJavaScript(_:in:completionHandler:)): Ditto.
1941         * SwiftOverlay/Tests/WebKitTests.swift:
1942         (WebKitTests.testAPI): Update names to reflect changes.
1943         * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything (Catalyst).xcscheme:
1944             Ensure that the unit test files get built as part of Build & Run, so that
1945             any changes to names get flagged without even running the tests.
1946         * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/xcshareddata/xcschemes/Everything.xcscheme:
1947             Ditto.
1948
1949 2020-06-10  Kate Cheney  <katherine_cheney@apple.com>
1950
1951         ASSERTION FAILED: suspendedState == State::Running in WebKit::WebResourceLoadStatisticsStore::suspend
1952         https://bugs.webkit.org/show_bug.cgi?id=213031
1953         <rdar://problem/64131092>
1954
1955         Reviewed by Chris Dumez.
1956
1957         There is a race condition if two calls are made to
1958         WebResourceLoadStatisticsStore::suspend() simultanously.
1959         WebResourceLoadStatisticsStore::resume() notifies the background
1960         thread to continue and releases a lock, then sometimes the second call
1961         to suspend obtains the lock and updates the suspendedState variable
1962         before the background thread resumes and checks the result. This patch allows the
1963         suspendedState to be either State::Running or State::WillSuspend to
1964         account for this.
1965
1966         No new tests, this should fix http/wpt/service-workers/service-worker-spinning-fetch.https.html.
1967
1968         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1969         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1970         (WebKit::WebResourceLoadStatisticsStore::suspend):
1971
1972 2020-06-10  Alex Christensen  <achristensen@webkit.org>
1973
1974         Revert r259770
1975         https://bugs.webkit.org/show_bug.cgi?id=210097
1976         <rdar://problem/64175992>
1977
1978         * UIProcess/WebPageProxy.cpp:
1979         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1980
1981 2020-06-10  Alex Christensen  <achristensen@webkit.org>
1982
1983         Add some null checks in PDFPlugin::updatePageAndDeviceScaleFactors
1984         https://bugs.webkit.org/show_bug.cgi?id=213009
1985         <rdar://problem/63756100>
1986
1987         Reviewed by Chris Dumez.
1988
1989         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1990         (WebKit::PDFPlugin::updatePageAndDeviceScaleFactors):
1991
1992 2020-06-09  Fujii Hironori  <Hironori.Fujii@sony.com>
1993
1994         Unreviewed, reverting r262791.
1995
1996         WinCairo WebKit1 is crashing.
1997
1998         Reverted changeset:
1999
2000         "[Curl] Implement functions to use ResourceLoadStatistics."
2001         https://bugs.webkit.org/show_bug.cgi?id=207692
2002         https://trac.webkit.org/changeset/262791
2003
2004 2020-06-09  Tim Horton  <timothy_horton@apple.com>
2005
2006         Stop using the wrong LaunchServices SPI for getting an app's localized name
2007         https://bugs.webkit.org/show_bug.cgi?id=213003
2008         <rdar://problem/64169000>
2009
2010         Reviewed by Sam Weinig.
2011
2012         * UIProcess/ios/WKActionSheetAssistant.mm:
2013         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
2014
2015 2020-06-09  Mark Lam  <mark.lam@apple.com>
2016
2017         Disambiguate the OverridesGetPropertyNames structure flag
2018         https://bugs.webkit.org/show_bug.cgi?id=212909
2019         <rdar://problem/63823557>
2020
2021         Reviewed by Saam Barati.
2022
2023         * WebProcess/Plugins/Netscape/JSNPObject.h:
2024
2025 2020-06-09  Dean Jackson  <dino@apple.com>
2026
2027         Stop using discriminatory names for WebGL and Plugin blocking
2028         https://bugs.webkit.org/show_bug.cgi?id=213000
2029
2030         Reviewed by Simon Fraser.
2031
2032         * Shared/Plugins/Netscape/mac/PluginInformationMac.mm:
2033         (WebKit::getPlatformPluginModuleInformation):
2034         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
2035         (WKContextIsPlugInUpdateAvailable):
2036         (WKContextShouldBlockWebGL):
2037         (WKContextShouldSuggestBlockWebGL):
2038         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2039         (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin):
2040
2041 2020-06-09  Brian Burg  <bburg@apple.com>
2042
2043         [Cocoa] Element Send Keys can hang when an automation window becomes unfocused
2044         https://bugs.webkit.org/show_bug.cgi?id=212985
2045         <rdar://problem/56354471>
2046
2047         Reviewed by Devin Rousso.
2048
2049         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2050         (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
2051         Make sure to focus the window and set first responder so sending keys doesn't hang.
2052
2053
2054 2020-06-09  Jonathan Bedard  <jbedard@apple.com>
2055
2056         WebKit: Import NSURLConnectionSPI.h instead of CFNSURLConnection.h
2057         https://bugs.webkit.org/show_bug.cgi?id=212980
2058         <rdar://problem/64172694>
2059
2060         Unreviewed build fix.
2061
2062         No new tests, behavior unchanged.
2063
2064         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2065
2066 2020-06-09  Dean Jackson  <dino@apple.com>
2067
2068         REGRESSION: [Safari Mojave for High Sierra] Accessing some of the featured pages on apple.com causes the webpage to crash
2069         https://bugs.webkit.org/show_bug.cgi?id=212940
2070
2071         Reviewed by Tim Horton.
2072
2073         The code to use the singleton for a SwitchingGPUClient was assuming it
2074         has always been set, which was not the case when
2075         ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) was not true.
2076
2077         * WebProcess/cocoa/WebProcessCocoa.mm: Set the singleton unconditionally.
2078         (WebKit::WebProcess::platformInitializeProcess):
2079
2080 2020-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2081
2082         REGRESSION (r260820): [macCatalyst] Web process crashes when uploading a file
2083         https://bugs.webkit.org/show_bug.cgi?id=212976
2084         <rdar://problem/64033186>
2085
2086         Reviewed by Tim Horton.
2087
2088         On Mac Catalyst, we attempt to take a sandbox extension for `com.apple.frontboard.systemappservices` when
2089         uploading a file; this service does not exist in Catalyst, and we consequently encounter a release assertion
2090         under `WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon`.
2091
2092         Fix this by introducing `HAVE(FRONTBOARD_SYSTEM_APP_SERVICES)`, and using it to guard codepaths that attempt to
2093         grab a mach extension to this service. (As a followup, we should consider adopting this in other places that
2094         currently reference `com.apple.frontboard.systemappservices`).
2095
2096         * UIProcess/WebPageProxy.cpp:
2097         (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2098         * WebProcess/WebPage/WebPage.cpp:
2099         (WebKit::WebPage::didChooseFilesForOpenPanelWithDisplayStringAndIcon):
2100
2101 2020-06-09  Jonathan Bedard  <jbedard@apple.com>
2102
2103         WebKit: Support watchOS and tvOS in xcconfigs
2104         https://bugs.webkit.org/show_bug.cgi?id=212977
2105         <rdar://problem/64170532>
2106
2107         Reviewed by Tim Horton.
2108
2109         No new tests, behavior unchanged.
2110
2111         * Configurations/Base.xcconfig: Add tvOS and watchOS major version macros.
2112         * Configurations/BaseTarget.xcconfig: Include tvOS and watchOS framework stubs.
2113         * Configurations/BaseXPCService.xcconfig: Generalize excluded files for all embedded platforms.
2114         * Configurations/GPUService.xcconfig: Generalize INFOPLIST for embedded platforms.
2115         * Configurations/NetworkService.xcconfig: Ditto.
2116         * Configurations/WebContentService.xcconfig: Ditto.
2117
2118 2020-06-09  Alex Christensen  <achristensen@webkit.org>
2119
2120         Expose PDF file URL in shouldAllowPDFToOpenFromFrame SPI
2121         https://bugs.webkit.org/show_bug.cgi?id=212974
2122
2123         Reviewed by Tim Horton.
2124
2125         * UIProcess/API/APIUIClient.h:
2126         (API::UIClient::confirmPDFOpening):
2127         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2128         * UIProcess/Cocoa/UIDelegate.h:
2129         * UIProcess/Cocoa/UIDelegate.mm:
2130         (WebKit::UIDelegate::setDelegate):
2131         (WebKit::UIDelegate::UIClient::confirmPDFOpening):
2132         * UIProcess/mac/WebPageProxyMac.mm:
2133         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
2134         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
2135
2136 2020-06-09  Takashi Komori  <Takashi.Komori@sony.com>
2137
2138         [Curl] Implement functions to use ResourceLoadStatistics.
2139         https://bugs.webkit.org/show_bug.cgi?id=207692
2140
2141         Reviewed by Don Olmstead.
2142
2143         Implement functions which are required to implement ResourceLoadStatistics for Curl port.
2144
2145         In NetworkDataTaskCurl.cpp we check if we should block cookies and block if needed.
2146
2147         Tests: http/tests/resourceLoadStatistics/
2148
2149         * NetworkProcess/NetworkDataTask.cpp:
2150         (WebKit::NetworkDataTask::create):
2151         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2152         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
2153         (WebKit::NetworkDataTaskCurl::createCurlRequest):
2154         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
2155         (WebKit::NetworkDataTaskCurl::blockCookies):
2156         (WebKit::NetworkDataTaskCurl::unblockCookies):
2157         (WebKit::NetworkDataTaskCurl::shouldBlockCookies):
2158         (WebKit::NetworkDataTaskCurl::isThirdPartyRequest):
2159         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2160         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2161         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
2162         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2163         (WKWebsiteDataStoreGetAllStorageAccessEntries):
2164         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2165         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2166         (WebKit::WebsiteDataStore::parameters):
2167
2168 2020-06-09  Lauro Moura  <lmoura@igalia.com>
2169
2170         [WebDriver][WPE] Follow up WPE fix after r262703
2171         https://bugs.webkit.org/show_bug.cgi?id=212948
2172
2173         Reviewed by Carlos Garcia Campos.
2174
2175         Covered by existing tests.
2176
2177         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp:
2178         (WebKit::WebAutomationSession::platformWebModifiersFromRaw):
2179
2180 2020-06-08  David Kilzer  <ddkilzer@apple.com>
2181
2182         [IPC] Adopt enum class for IPC::CFType
2183         <https://webkit.org/b/212921>
2184         <rdar://problem/64134506>
2185
2186         Reviewed by Darin Adler.
2187
2188         Summary:
2189         - Convert IPC::CFType to enum class.
2190         - Rule for new enum names is to remove "Ref" suffix from the
2191           actual type name.
2192         - Special enum CFType::Null renamed to CFType::Nullptr to
2193           differentiate from CFType::CFNull objects.
2194
2195         * Shared/cf/ArgumentCodersCF.cpp:
2196         (IPC::tokenNullTypeRef): Delete.
2197         (IPC::tokenNullptrTypeRef): Add.
2198         - Rename tokenNullTypeRef() to tokenNullptrTypeRef().
2199         (IPC::CFType):
2200         - Convert to enum class.
2201         (IPC::typeFromCFTypeRef):
2202         (IPC::encode):
2203         - Switch from encodeEnum() to operator<<().
2204         (IPC::decode):
2205         - Switch from decodeEnum() to decode().
2206         (WTF::EnumTraits<IPC::CFType>): Add.
2207         * Shared/cf/ArgumentCodersCF.h:
2208         (IPC::tokenNullTypeRef): Delete.
2209         (IPC::tokenNullptrTypeRef): Add.
2210         - Rename tokenNullTypeRef() to tokenNullptrTypeRef().
2211         * Shared/mac/WebCoreArgumentCodersMac.mm:
2212         (IPC::ArgumentCoder<WebCore::ResourceRequest>::encodePlatformData):
2213         (IPC::ArgumentCoder<WebCore::ResourceRequest>::decodePlatformData):
2214         - Switch to use tokenNullptrTypeRef().
2215         * mac/WebKit2.order:
2216         - Update symbol name after renaming tokenNullTypeRef().
2217
2218 2020-06-08  Kate Cheney  <katherine_cheney@apple.com>
2219
2220         ResourceLoadStatisticsDatabaseStore::domainIDFromString failed, error message: bad parameter or other API misuse
2221         https://bugs.webkit.org/show_bug.cgi?id=212916
2222         <rdar://problem/64127238>
2223
2224         Reviewed by Sihui Liu.
2225
2226         Make sure m_domainIDFromStringStatement is accessed in a separate
2227         scope in ensureResourceStatisticsForRegistrableDomain() so it will be
2228         reset before being used again.
2229
2230         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2231         (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
2232         Add debug assert to ensure that tests catch this case.
2233
2234         (WebKit::ResourceLoadStatisticsDatabaseStore::ensureResourceStatisticsForRegistrableDomain const):
2235
2236 2020-06-08  Chris Dumez  <cdumez@apple.com>
2237
2238         Turn some WebPageProxy logging into error logging
2239         https://bugs.webkit.org/show_bug.cgi?id=212922
2240         <rdar://problem/63894722>
2241
2242         Reviewed by Geoffrey Garen.
2243
2244         * UIProcess/WebPageProxy.cpp:
2245         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2246         (WebKit::WebPageProxy::didFailLoadForFrame):
2247         (WebKit::WebPageProxy::processDidTerminate):
2248         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
2249         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
2250         (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
2251         (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
2252
2253 2020-06-08  David Kilzer  <ddkilzer@apple.com>
2254
2255         [IPC] Adopt enum class for DragOperation
2256         <https://webkit.org/b/212870>
2257         <rdar://problem/64069940>
2258
2259         Reviewed by Darin Adler.
2260
2261         * Scripts/webkit/messages.py:
2262         - Remove FIXME now that it's not needed.
2263         * Shared/API/Cocoa/_WKDragActionsInternal.h:
2264         (WebKit::coreDragOperationMask):
2265         * UIProcess/Cocoa/WebViewImpl.mm:
2266         (WebKit::kit):
2267         * UIProcess/ios/WKContentViewInteraction.mm:
2268         (dropOperationForWebCoreDragOperation):
2269         (coreDragOperationForUIDropOperation):
2270         (-[WKContentView dragDataForDropSession:dragDestinationAction:]):
2271
2272 2020-06-08  Commit Queue  <commit-queue@webkit.org>
2273
2274         Unreviewed, reverting r262685.
2275         https://bugs.webkit.org/show_bug.cgi?id=212914
2276
2277         caused flakey crashes in an iOS test
2278
2279         Reverted changeset:
2280
2281         "Clear WebPageProxy event state between tests"
2282         https://bugs.webkit.org/show_bug.cgi?id=212864
2283         https://trac.webkit.org/changeset/262685
2284
2285 2020-06-08  Sam Weinig  <weinig@apple.com>
2286
2287         Extended Color: Unify rounding / clamping conversions between 0-1 float components and 0-255 byte components
2288         https://bugs.webkit.org/show_bug.cgi?id=212871
2289
2290         Reviewed by Simon Fraser.
2291
2292         * UIProcess/API/ios/WKWebViewIOS.mm:
2293         (scrollViewBackgroundColor):
2294         Replaces uses of colorWithAlphaUsingAlternativeRounding() with colorWithAlpha().
2295
2296 2020-06-08  Richard Houle  <rhoule@apple.com>
2297
2298         Links in NSAttributedString passed to -[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:] are ignored
2299         https://bugs.webkit.org/show_bug.cgi?id=212801
2300         <rdar://problem/63027631>
2301
2302         Reviewed by Alex Christensen.
2303
2304         * UIProcess/API/Cocoa/WKWebView.mm:
2305         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]): Call the new detailsWithLinks
2306         implementation, asserting if an URL is non nil.
2307         (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]): Ditto.
2308         (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]): Pass the URL to
2309         the completion handler when appropriate.
2310         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2311
2312 2020-06-08  Per Arne Vollan  <pvollan@apple.com>
2313
2314         [Cocoa] Adopt read-only mode for preferences in the WebContent process
2315         https://bugs.webkit.org/show_bug.cgi?id=212411
2316
2317         Reviewed by Darin Adler.
2318
2319         Change name of HAVE define to match SPI name.
2320
2321         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2322         (WebKit::XPCServiceMain):
2323
2324 2020-06-08  Per Arne Vollan  <pvollan@apple.com>
2325
2326         [Cocoa] CFPrefs synchronization does not always work for global preference changes
2327         https://bugs.webkit.org/show_bug.cgi?id=212783
2328
2329         Reviewed by Tim Horton.
2330
2331         In CFPrefs direct mode, synchronization of global preference changes from the UI process to the WebContent process does not always work.
2332         This is caused by the KVO notification being sent to all or some of the NSUserDefault objects, which leads us to believe a non-global
2333         preference was changed. Since a global preference change always leads to some NSUserDefaults object receiving the notification, we can
2334         work around this by checking if the preference being changed really belongs to the domain of the NSUserDefaults object, or if it is a
2335         global preference. Also, stop creating NSUserDefaults object for the global domain, since this is an error according to the docs.
2336
2337         API test: WebKit.GlobalPreferenceChangesUsingDefaultsWrite
2338
2339         * UIProcess/Cocoa/PreferenceObserver.mm:
2340         (-[WKUserDefaults _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:]):
2341         * WebProcess/cocoa/WebProcessCocoa.mm:
2342         (WebKit::WebProcess::platformInitializeWebProcess):
2343         (WebKit::WebProcess::notifyPreferencesChanged):
2344
2345 2020-06-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2346
2347         [iOS] Hit-testing on icloud.com is offset after closing a tab
2348         https://bugs.webkit.org/show_bug.cgi?id=212890
2349         <rdar://problem/58775297>
2350
2351         Reviewed by Simon Fraser.
2352
2353         After tapping to create a new tab on the icloud.com settings page (with no other tabs open) and then closing the
2354         new tab, all hit-testing on the page is offset by -33px until the page is reloaded. This bug appears to be a
2355         corner case triggered by a combination of the following three changes:
2356
2357         - <https://trac.webkit.org/r170463>
2358         - <https://trac.webkit.org/r245006>
2359         - <rdar://problem/53660458> (which is an iOS-specific Safari change)
2360
2361         We start on icloud.com's settings page. When closing the newly created tab, Safari hides the tab bar, causing
2362         both the top content inset and top obscured inset to decrease by 33 points. When applying the top content inset
2363         change, Safari (after <rdar://problem/53660458>) temporarily sets `_automaticContentOffsetAdjustmentEnabled` on
2364         `WKScrollView` to `NO`, which means that the scroll view doesn't automatically adjust its content offset to -70;
2365         instead, it remains at -103 (the content offset when the tab bar is shown).
2366
2367         Because of this, during the next remote layer tree commit where the content size changes,
2368         `-_setContentSizePreservingContentOffsetDuringRubberband:` will believe that we're currently rubber-banding by
2369         33px, and therefore try to adjust the content offset of the scroll view to be -103 instead of allowing it to be
2370         adjusted back to -70 (see r170463 and `-_restoreContentOffsetWithRubberbandAmount:`).
2371
2372         This results in the scroll position on the page (`document.scrollingElement.scrollTop`) reporting -33, even
2373         though the top of the page is flush with the bottom of Safari's browser chrome. Finally, because `WKScrollView`
2374         is made unscrollable due to `overflow: hidden;` (r245006), we end up permanently stuck in this state until the
2375         next page load, rather than the next remote layer tree commit that causes any scrolling.
2376
2377         To fix this, add an additional restriction on the rubberbanding offset restoration code in
2378         `-_setContentSizePreservingContentOffsetDuringRubberband:`, such that we only try to preserve the current
2379         rubberbanded offset if we're actually rubberbanding (that is, dragging or bouncing against the edge of the
2380         scroll view). Note that when rubberbanding against the top of the scroll view on iPad using a trackpad, the
2381         `-isDragging` property is also true, which matches behavior when panning via touch.
2382
2383         Test: ScrollViewInsetTests.ChangeInsetWithoutAutomaticAdjustmentWhileWebProcessIsUnresponsive
2384
2385         * Platform/spi/ios/UIKitSPI.h:
2386         * UIProcess/ios/WKScrollView.mm:
2387         (-[WKScrollView _setContentSizePreservingContentOffsetDuringRubberband:]):
2388
2389         Also, split out the `CGSizeEqualToSize(currentContentSize, contentSize)` case into a separate early return that
2390         skips the call to `-setContentSize:` altogether.
2391
2392 2020-06-08  Andy Estes  <aestes@apple.com>
2393
2394         [Apple Pay] Remove -respondsToSelector: check before calling -[PKPaymentRequest setBoundInterfaceIdentifier:]
2395         https://bugs.webkit.org/show_bug.cgi?id=212884
2396         <rdar://problem/64090963>
2397
2398         Reviewed by Youenn Fablet.
2399
2400         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2401         (WebKit::WebPaymentCoordinatorProxy::platformPaymentRequest): Relied on the definition of
2402         HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER to ensure that PKPaymentRequest will respond to
2403         -setBoundInterfaceIdentifier:.
2404
2405 2020-06-08  Andy Estes  <aestes@apple.com>
2406
2407         [Apple Pay] Remove ENABLE_APPLE_PAY_SETUP, ENABLE_APPLE_PAY_SESSION_V7, and HAVE_PASSKIT_PAYMENT_SETUP
2408         https://bugs.webkit.org/show_bug.cgi?id=212883
2409         <rdar://problem/64090763>
2410
2411         Reviewed by Youenn Fablet.
2412
2413         These macros evaluate to true whenever ENABLE(APPLE_PAY) is true on platforms supported by
2414         trunk WebKit, so we can either remove them or replace them with ENABLE(APPLE_PAY).
2415
2416         * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm:
2417         * Shared/ApplePay/ApplePayPaymentSetupFeaturesWebKit.h:
2418         * Shared/ApplePay/PaymentSetupConfiguration.mm:
2419         * Shared/ApplePay/PaymentSetupConfigurationWebKit.h:
2420         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
2421         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
2422         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2423         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2424         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2425
2426 2020-06-08  youenn fablet  <youenn@apple.com>
2427
2428         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
2429         https://bugs.webkit.org/show_bug.cgi?id=206582
2430         <rdar://problem/58985368>
2431
2432         Reviewed by Eric Carlson.
2433
2434         Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate.
2435
2436         * GPUProcess/GPUConnectionToWebProcess.cpp:
2437         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
2438         * GPUProcess/GPUConnectionToWebProcess.h:
2439         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
2440         * GPUProcess/webrtc/RemoteMediaRecorder.h:
2441         * GPUProcess/webrtc/RemoteMediaRecorder.messages.in:
2442         * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp:
2443         * GPUProcess/webrtc/RemoteMediaRecorderManager.h:
2444         * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in:
2445         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
2446         * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
2447         * WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
2448         * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp:
2449         (WebKit::MediaRecorderProvider::createMediaRecorderPrivate):
2450
2451 2020-06-07  Lauro Moura  <lmoura@igalia.com>
2452
2453         [WebDriver] Allow platform-dependent modifier keys conversion to WebEvent::Modifier
2454         https://bugs.webkit.org/show_bug.cgi?id=212848
2455
2456         Reviewed by Brian Burg.
2457
2458         WebEvent::Modifier flags does not map directly to the platform flags,
2459         so we can't directly convert the modifier flags to the OptionSet.
2460
2461         Covered by existing WebDriver tests.
2462
2463         * UIProcess/Automation/WebAutomationSession.cpp:
2464         (WebKit::WebAutomationSession::simulateMouseInteraction): Use
2465         platform-specific method to convert the modifiers.
2466         * UIProcess/Automation/WebAutomationSession.h:
2467         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp: Added
2468         conversion from GDK modifier mask to WebEvent::Modifier.
2469         (WebKit::WebAutomationSession::platformWebModifiersFromRaw):
2470         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Added
2471         conversion from NSModifierFlag to WebEvent::Modifier.
2472         (WebKit::WebAutomationSession::platformWebModifiersFromRaw):
2473         * UIProcess/Automation/wpe/WebAutomationSessionWPE.cpp: Added
2474         conversion from wpe_input_keyboard_modifier to WebEvent::Modifier.
2475         (WebKit::WebAutomationSession::platformWebModifiersFromRaw):
2476
2477 2020-06-07  Lauro Moura  <lmoura@igalia.com>
2478
2479         [WPE] Behave like GDK_CURRENT_TIME when the timestamp is zero
2480         https://bugs.webkit.org/show_bug.cgi?id=212797
2481
2482         WebDriver tests come with zero timestamp. So behave like
2483         GDK_CURRENT_TIME and assume zero timestamp == WallTime::now().
2484
2485         Reviewed by Carlos Garcia Campos.
2486
2487         Covered by existing tests.
2488
2489         * Shared/libwpe/WebEventFactory.cpp:
2490         (WebKit::wallTimeForEventTime):
2491
2492 2020-06-07  Philippe Normand  <pnormand@igalia.com>
2493
2494         Remove ENABLE_VIDEO_TRACK ifdef guards
2495         https://bugs.webkit.org/show_bug.cgi?id=212568
2496
2497         Reviewed by Youenn Fablet.
2498
2499         * Configurations/FeatureDefines.xcconfig:
2500         * GPUProcess/GPUConnectionToWebProcess.cpp:
2501         (WebKit::GPUConnectionToWebProcess::dispatchMessage):
2502         * GPUProcess/GPUConnectionToWebProcess.h:
2503         * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
2504         (WebKit::RemoteMediaPlayerProxy::textTrackSetMode):
2505         (WebKit::RemoteMediaPlayerProxy::notifyTrackModeChanged):
2506         * GPUProcess/media/RemoteMediaPlayerProxy.h:
2507         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.cpp:
2508         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.h:
2509         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRenderer.messages.in:
2510         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.cpp:
2511         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.h:
2512         * GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager.messages.in:
2513         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
2514         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
2515         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.messages.in:
2516         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
2517         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
2518         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.messages.in:
2519         * Shared/WebPreferences.yaml:
2520         * WebProcess/GPU/GPUProcessConnection.cpp:
2521         (WebKit::GPUProcessConnection::dispatchMessage):
2522         * WebProcess/GPU/GPUProcessConnection.h:
2523         * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
2524         (WebKit::MediaPlayerPrivateRemote::tracksChanged):
2525         * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
2526         * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
2527         (WebKit::RemoteMediaPlayerManager::updatePreferences):
2528         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.cpp:
2529         * WebProcess/GPU/webrtc/AudioMediaStreamTrackRenderer.h:
2530         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
2531         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
2532         * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.messages.in:
2533         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
2534         * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h:
2535         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2536         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2537         * WebProcess/Network/WebLoaderStrategy.cpp:
2538         (WebKit::maximumBufferingTime):
2539
2540 2020-06-06  Simon Fraser  <simon.fraser@apple.com>
2541
2542         Clear WebPageProxy event state between tests
2543         https://bugs.webkit.org/show_bug.cgi?id=212864
2544
2545         Reviewed by Anders Carlsson.
2546
2547         Make sure that event state doesn't leak between tests via events queued in WebPageProxy.
2548
2549         * UIProcess/API/C/WKPage.cpp:
2550         (WKPageClearEventState):
2551         * UIProcess/API/C/WKPage.h:
2552         * UIProcess/WebPageProxy.cpp:
2553         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2554         (WebKit::WebPageProxy::clearEventState):
2555         * UIProcess/WebPageProxy.h:
2556
2557 2020-06-06  Rob Buis  <rbuis@igalia.com>
2558
2559         Move URL scheme check to NetworkLoadChecker
2560         https://bugs.webkit.org/show_bug.cgi?id=191924
2561
2562         Reviewed by Joseph Pecoraro.
2563
2564         Reduce includes for CustomHeaderFields, I guess these were needed
2565         at some point but not anymore.
2566
2567         * Shared/WebsitePoliciesData.cpp:
2568
2569 2020-06-06  David Kilzer  <ddkilzer@apple.com>
2570
2571         Use OptionSet<DragOperation> for mask values
2572         <https://webkit.org/b/212605>
2573
2574         Reviewed by Darin Adler.
2575
2576         In broad strokes:
2577         - Replace use of DragOperation with OptionSet<DragOperation> or
2578           Optional<DragOperation>.
2579         - Rename function parameters and local variables to denote use
2580           of mask values.
2581         - Remove DragOperationNone enum value.
2582         - Replace DragOperationEvery enum value with anyDragOperation().
2583
2584         * Platform/spi/ios/UIKitSPI.h:
2585         (UIDragOperation):
2586         - Remove unused (and misnamed) UIDragOperation enum typedef.
2587         * Scripts/webkit/messages.py:
2588         (types_that_cannot_be_forward_declared):
2589         (headers_for_type):
2590         - Add support for WebCore::DragOperation enum.
2591         * Shared/API/Cocoa/_WKDragActionsInternal.h:
2592         (WebKit::coreDragOperationMask): Add conversion function.
2593         * Shared/WebCoreArgumentCoders.cpp:
2594         (IPC::ArgumentCoder<DragData>::encode):
2595         (IPC::ArgumentCoder<DragData>::decode):
2596         - Update to encode/decode OptionSet<DragOperation>.
2597
2598         * UIProcess/API/gtk/DragSource.h:
2599         (WebKit::DragSource::begin):
2600         * UIProcess/API/gtk/DragSourceGtk3.cpp:
2601         (WebKit::DragSource::begin):
2602         * UIProcess/API/gtk/DragSourceGtk4.cpp:
2603         (WebKit::DragSource::begin):
2604         * UIProcess/API/gtk/DropTarget.h:
2605         * UIProcess/API/gtk/DropTargetGtk3.cpp:
2606         (WebKit::DropTarget::didPerformAction):
2607         (WebKit::DropTarget::leaveTimerFired):
2608         * UIProcess/API/gtk/DropTargetGtk4.cpp:
2609         (WebKit::DropTarget::DropTarget):
2610         (WebKit::DropTarget::didPerformAction):
2611         * UIProcess/API/gtk/PageClientImpl.cpp:
2612         (WebKit::PageClientImpl::startDrag):
2613         * UIProcess/API/gtk/PageClientImpl.h:
2614         (WebKit::PageClientImpl::startDrag):
2615         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2616         (webkitWebViewBaseStartDrag):
2617         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
2618         (webkitWebViewBaseStartDrag):
2619
2620         * UIProcess/Cocoa/WebViewImpl.mm:
2621         (WebKit::WebViewImpl::sendDragEndToPage):
2622         (WebKit::WebViewImpl::draggingEntered):
2623         (WebKit::kit): Add conversion function.
2624         (WebKit::WebViewImpl::draggingUpdated):
2625         (WebKit::WebViewImpl::draggingExited):
2626         (WebKit::WebViewImpl::performDragOperation):
2627         - Make use of coreDragOperationMask() conversion function.
2628         * UIProcess/PageClient.h:
2629         (WebKit::WebViewImpl::startDrag):
2630         * UIProcess/WebPageProxy.cpp:
2631         (WebKit::WebPageProxy::didPerformDragControllerAction):
2632         - Remove MESSAGE_CHECK now that we're using the actual type.
2633         (WebKit::WebPageProxy::startDrag):
2634         (WebKit::WebPageProxy::dragEnded):
2635         (WebKit::WebPageProxy::resetCurrentDragInformation):
2636         * UIProcess/WebPageProxy.h:
2637         (WebKit::WebPageProxy::didPerformDragControllerAction):
2638         (WebKit::WebPageProxy::dragEnded):
2639         (WebKit::WebPageProxy::startDrag):
2640         (WebKit::WebPageProxy::currentDragOperation const):
2641         * UIProcess/WebPageProxy.messages.in:
2642         (WebPageProxy::DidPerformDragControllerAction):
2643         (WebPageProxy::StartDrag):
2644         * UIProcess/ios/WKContentViewInteraction.mm:
2645         (-[WKContentView _didHandleDragStartRequest:]):
2646         (dropOperationForWebCoreDragOperation):
2647         (coreDragOperationForUIDropOperation): Add conversion function.
2648         - Note that this was not being converted from UIDropOperation to
2649           WebCore::DragOperation previously, and UIDropOperationMove
2650           (0x3) was not being properly converted to DragOperationMove
2651           (0x16).
2652         (-[WKContentView dragDataForDropSession:dragDestinationAction:]):
2653         (-[WKContentView _didPerformDragOperation:]):
2654         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2655         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
2656         (-[WKContentView dropInteraction:sessionDidEnd:]):
2657         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
2658         (WebKit::WebDragClient::startDrag):
2659         * WebProcess/WebPage/WebPage.cpp:
2660         (WebKit::WebPage::performDragControllerAction):
2661         (WebKit::WebPage::dragEnded):
2662         * WebProcess/WebPage/WebPage.h:
2663         (WebKit::WebPage::performDragControllerAction):
2664         (WebKit::WebPage::dragEnded):
2665         * WebProcess/WebPage/WebPage.messages.in:
2666         (WebPage::PerformDragControllerAction):
2667         (WebPage::DragEnded):
2668         * WebProcess/WebPage/ios/WebPageIOS.mm:
2669         (WebKit::WebPage::requestAdditionalItemsForDragSession):
2670
2671 2020-06-06  Devin Rousso  <drousso@apple.com>
2672
2673         Web Inspector: unify the naming scheme for agents used by instrumentation
2674         https://bugs.webkit.org/show_bug.cgi?id=212859
2675
2676         Reviewed by Timothy Hatcher.
2677
2678         Inspector agents fall into one of three categories:
2679          - "persistent" when Web Inspector is connected
2680          - "enabled" when that agent is `enable`d, such as if the corresponding tab is visible
2681          - "tracking" when that agent is part of a timeline recording.
2682
2683         The only exception to this is the Console agent, as that exists regardless of whether Web
2684         Inspector is connected as it needs to preserve messages logged before Web Inspector connects.
2685
2686         Also remove the "Inspector" prefix from getter/setter methods as it adds confusion if that
2687         agent also has subclasses (e.g. `InspectorRuntimeAgent` and `PageRuntimeAgent`).
2688
2689         * UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp:
2690         * UIProcess/Inspector/WebInspectorProxy.cpp:
2691         * UIProcess/Inspector/WebPageInspectorController.h:
2692         Simple naming changes elided to avoid a long ChangeLog.
2693
2694 2020-06-05  David Kilzer  <ddkilzer@apple.com>
2695
2696         [IPC] Adopt enum class for AutocapitalizeType
2697         <https://webkit.org/b/212846>
2698         <rdar://problem/64042825>
2699
2700         Reviewed by Darin Adler.
2701
2702         Summary:
2703         - Move AutocapitalizeType into WebCore namespace.
2704         - Convert AutocapitalizeType to an enum class.
2705         - Add WTF::EnumTraits<AutocapitalizeType> for IPC.
2706
2707         * Shared/FocusedElementInformation.cpp:
2708         (WebKit::FocusedElementInformation::encode const):
2709         (WebKit::FocusedElementInformation::decode):
2710         - Stop using decodeEnum() and encodeEnum() now that
2711           WTF::EnumTraits<AutocapitalizeType> exists.
2712         * Shared/FocusedElementInformation.h:
2713         * Shared/glib/InputMethodState.cpp:
2714         (WebKit::InputMethodState::addHintsForAutocapitalizeType):
2715         * Shared/glib/InputMethodState.h:
2716         * UIProcess/ios/WKContentViewInteraction.mm:
2717         (toUITextAutocapitalize):
2718         * WebProcess/WebPage/ios/WebPageIOS.mm:
2719         (WebKit::WebPage::getFocusedElementInformation):
2720
2721 2020-06-05  Brent Fulgham  <bfulgham@apple.com>
2722
2723         [iOS] Silence telemetry generated during download operations
2724         https://bugs.webkit.org/show_bug.cgi?id=212854
2725         <rdar://problem/63909414>
2726
2727         Reviewed by Per Arne Vollan.
2728
2729         Remove reporting and telemetry for the 'com.apple.ProgressReporting' service
2730         from the Network Process sandbox, since this is a critical part of supplying
2731         download status to the WebKit UI.
2732
2733         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2734
2735 2020-06-05  Ryan Haddad  <ryanhaddad@apple.com>
2736
2737         Unreviewed, reverting r262619, r262625, and r262641.
2738
2739         Caused mediarecorder layout test crashes.
2740
2741         Reverted changesets:
2742
2743         "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder"
2744         https://bugs.webkit.org/show_bug.cgi?id=206582
2745         https://trac.webkit.org/changeset/262619
2746
2747         "[Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder"
2748         https://bugs.webkit.org/show_bug.cgi?id=206582
2749         https://trac.webkit.org/changeset/262625
2750
2751         "Unreviewed, silence deprecation warning to fix build with
2752         latest SDK."
2753         https://trac.webkit.org/changeset/262641
2754
2755 2020-06-05  Kate Cheney  <katherine_cheney@apple.com>
2756
2757         ITP SQLite Database should only vacuum once per day
2758         https://bugs.webkit.org/show_bug.cgi?id=212712
2759         <rdar://problem/63939711>
2760
2761         Reviewed by Brent Fulgham.
2762
2763         Followup to https://trac.webkit.org/changeset/262538/webkit. We should
2764         run incremental auto vacuum, not a full vacuum, once per-day, because
2765         it is less expensive.
2766
2767         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
2768         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2769         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2770         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
2771
2772 2020-06-05  Daniel Bates  <dabates@apple.com>
2773
2774         -_focusTextInputContext should reposition the caret if called for an already focused text input context
2775         https://bugs.webkit.org/show_bug.cgi?id=212830
2776         <rdar://problem/64032956>
2777
2778         Reviewed by Wenson Hsieh.
2779
2780         Update the code based on new feedback: the caret should now be re-positioned when -_focusTextInputContext
2781         is called on an already assisted text input context.
2782
2783         * UIProcess/ios/WKContentViewInteraction.h:
2784         * UIProcess/ios/WKContentViewInteraction.mm:
2785         (-[WKContentView cleanUpInteraction]):
2786         (-[WKContentView _didCommitLoadForMainFrame]): Reset state. See below for why.
2787
2788         (-[WKContentView _focusTextInputContext:placeCaretAt:completionHandler:]): I cannot simply remove the early
2789         return in -_focusTextInputContext that detects if the specified text input context is already focused because
2790         it could effect user-visible responsiveness due to an Apple internal client invoking this function more times
2791         than necessary with the same point during a text interaction. See <rdar://problem/59430806>. That radar
2792         represents a correctness issue. I didn't actually evaluate whether responsiveness is affected by this patch,
2793         but I would feel more confident that there would be 0 impact when removing the early branch after that radar
2794         is fixed without the need to even perform a responsiveness analysis. Note that there is already a comment about
2795         that radar at the top of this function.
2796
2797 2020-06-05  Alex Christensen  <achristensen@webkit.org>
2798
2799         Fix PDF opening after r262592
2800         https://bugs.webkit.org/show_bug.cgi?id=212795
2801
2802         * UIProcess/mac/WebPageProxyMac.mm:
2803         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
2804         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
2805         As Darin mentioned and I was about to discover, my last-minute switching things around got the boolean condition backwards.
2806         We want to do nothing if we're not allowed to open the PDF, and we want to open the PDF if we are allowed to.s
2807
2808 2020-06-05  David Kilzer  <ddkilzer@apple.com>
2809
2810         [IPC] Adopt enum class for PluginLoadClientPolicy
2811         <https://webkit.org/b/212827>
2812         <rdar://problem/64030431>
2813
2814         Reviewed by Alex Christensen.
2815
2816         Summary:
2817         - Update for renamed PluginLoadClientPolicy enums.
2818         - Update to make PluginLoadClientPolicy type work with IPC.
2819         - Replace uint8_t with strongly-typed PluginLoadClientPolicy.
2820
2821         * Scripts/webkit/messages.py:
2822         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
2823         (WebKit::NetscapePluginModule::getPluginInfo):
2824         * Shared/WebProcessCreationParameters.h:
2825         * UIProcess/API/C/WKAPICast.h:
2826         (WebKit::toWKPluginLoadClientPolicy):
2827         (WebKit::toPluginLoadClientPolicy):
2828         * UIProcess/API/Cocoa/WKProcessPool.mm:
2829         (toPluginLoadClientPoliciesHashMap):
2830         (policiesHashMapToDictionary):
2831         (isPluginLoadClientPolicyAcceptable): Delete.
2832         - Replace with
2833           WTF::isValidEnum<WebCore::PluginLoadClientPolicy>().
2834         * UIProcess/WebProcessPool.cpp:
2835         (WebKit::WebProcessPool::setPluginLoadClientPolicy):
2836         (WebKit::WebProcessPool::resetPluginLoadClientPolicies):
2837         * UIProcess/WebProcessPool.h:
2838         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2839         (WebKit::PDFPlugin::pluginInfo):
2840         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2841         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
2842         * WebProcess/WebProcess.cpp:
2843         (WebKit::WebProcess::setPluginLoadClientPolicy):
2844         (WebKit::WebProcess::resetPluginLoadClientPolicies):
2845         * WebProcess/WebProcess.h:
2846         * WebProcess/WebProcess.messages.in:
2847
2848 2020-06-05  Alex Christensen  <achristensen@webkit.org>
2849
2850         Update header documentation for WKPreferences.fraudulentWebsiteWarningEnabled
2851         https://bugs.webkit.org/show_bug.cgi?id=212843
2852         <rdar://problem/64010164>
2853
2854         Reviewed by Geoffrey Garen.
2855
2856         * UIProcess/API/Cocoa/WKPreferences.h:
2857
2858 2020-06-05  Brent Fulgham  <bfulgham@apple.com>
2859
2860         [iOS] Remove message filtering telemetry for expected case
2861         https://bugs.webkit.org/show_bug.cgi?id=212841
2862         <rdar://problem/63893460>
2863
2864         Reviewed by Per Arne Vollan.
2865
2866         Remove unintentional telemetry being captured for expected behavior.
2867
2868         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2869
2870 2020-06-05  Per Arne Vollan  <pvollan@apple.com>
2871
2872         [Cocoa] Adopt read-only mode for preferences in the WebContent process
2873         https://bugs.webkit.org/show_bug.cgi?id=212411
2874         <rdar://problem/63640788>
2875
2876         Reviewed by Darin Adler.
2877
2878         The WebContent process should never write preferences. Adopt read-only mode for preferences.
2879         This will fix some sandbox violations when the UI process is notifying the WebContent process
2880         about preference changes. When notified, the WebContent process will use the preferences API
2881         to write those preferences in-process, but there should be no attempt at writing these new
2882         values to disk, which this patch will ensure.
2883
2884         No new tests, since this is fixing a benign sandbox violation.
2885
2886         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
2887         (WebKit::XPCServiceMain):
2888
2889 2020-06-05  Per Arne Vollan  <pvollan@apple.com>
2890
2891         [iOS] Fix message filter sandbox violation
2892         https://bugs.webkit.org/show_bug.cgi?id=212837
2893         <rdar://problem/63830368>
2894
2895         Reviewed by Darin Adler.
2896
2897         Add required message to message filter in the iOS WebContent sandbox.
2898
2899         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2900
2901 2020-06-05  Peng Liu  <peng.liu6@apple.com>
2902
2903         REGRESSION (r262456?): [macOS] media/picture-in-picture/picture-in-picture-api tests are flaky timeouts
2904         https://bugs.webkit.org/show_bug.cgi?id=212762
2905
2906         Reviewed by Eric Carlson.
2907
2908         The Picture-in-Picture implementation expects the two callbacks HTMLVideoElement::didBecomeFullscreenElement()
2909         and HTMLVideoElement::setVideoFullscreenFrame() to come in order. So we need to remove the dispatch_async()
2910         and call HTMLVideoElement::didBecomeFullscreenElement() directly.
2911
2912         * WebProcess/cocoa/VideoFullscreenManager.mm:
2913         (WebKit::VideoFullscreenManager::didEnterFullscreen):
2914
2915 2020-06-05  Adrian Perez de Castro  <aperez@igalia.com>
2916
2917         Non-unified build fixes, early summer 2020 edition
2918         https://bugs.webkit.org/show_bug.cgi?id=212819
2919
2920         Unreviewed build fix.
2921
2922         * Shared/gtk/NativeWebMouseEventGtk.cpp:
2923         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent): Add missing WebCore:: namespace to
2924         a couple of uses of WebCore::FloatSize.
2925         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp: Add missing Logging.h header.
2926
2927 2020-06-05  Andy Estes  <aestes@apple.com>
2928
2929         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)
2930         https://bugs.webkit.org/show_bug.cgi?id=212541
2931         <rdar://problem/63781452>
2932
2933         Reviewed by Darin Adler.
2934
2935         APPLE_PAY_SESSION_V(3|4) is now enabled whenever APPLE_PAY itself is enabled.
2936
2937         * Configurations/FeatureDefines.xcconfig:
2938
2939 2020-06-05  youenn fablet  <youenn@apple.com>
2940
2941         [Cocoa] Use AVAssetWriterDelegate to implement MediaRecorder
2942         https://bugs.webkit.org/show_bug.cgi?id=206582
2943         <rdar://problem/58985368>
2944
2945         Reviewed by Eric Carlson.
2946
2947         Enable RemoteMediaRecorder only for systems supporting AVAssetWriterDelegate.
2948
2949         * GPUProcess/GPUConnectionToWebProcess.cpp:
2950         (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
2951         * GPUProcess/GPUConnectionToWebProcess.h:
2952         * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
2953         * GPUProcess/webrtc/RemoteMediaRecorder.h:
2954         * GPUProcess/webrtc/RemoteMediaRecorder.messages.in:
2955         * GPUProcess/webrtc/RemoteMediaRecorderManager.cpp:
2956         * GPUProcess/webrtc/RemoteMediaRecorderManager.h:
2957         * GPUProcess/webrtc/RemoteMediaRecorderManager.messages.in:
2958         * GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:
2959         * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
2960         * WebProcess/GPU/webrtc/MediaRecorderPrivate.h:
2961         * WebProcess/GPU/webrtc/MediaRecorderProvider.cpp:
2962         (WebKit::MediaRecorderProvider::createMediaRecorderPrivate):
2963
2964 2020-06-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2965
2966         REGRESSION(r262184): [GTK] Two fast/forms tests are crashing
2967         https://bugs.webkit.org/show_bug.cgi?id=212747
2968
2969         Reviewed by Adrian Perez de Castro.
2970
2971         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
2972         (WebKit::WebPopupMenuProxyGtk::handleKeyPress): Return early if the menu has already been closed.
2973
2974 2020-06-05  Youenn Fablet  <youenn@apple.com>
2975
2976         Generate code to set the runtime settings for a service worker process
2977         https://bugs.webkit.org/show_bug.cgi?id=212467
2978
2979         Reviewed by Alex Christensen.
2980
2981         Split the code generated to handle web preference changes to have one method for process wide flags and one for page settings.
2982         Make the process wide flag method static and reuse it in WebSWContextManagerConnection.
2983         Covered by existing tests.
2984
2985         * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
2986         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2987         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
2988         * WebProcess/WebPage/WebPage.cpp:
2989         (WebKit::WebPage::updatePreferences):
2990         * WebProcess/WebPage/WebPage.h:
2991
2992 2020-06-04  David Kilzer  <ddkilzer@apple.com>
2993
2994         [IPC] Adopt enum class for PluginProcessType and PluginProcessSandboxPolicy
2995         <https://webkit.org/b/212758>
2996
2997         Reviewed by Darin Adler.
2998
2999         * PluginProcess/mac/PluginProcessMac.mm:
3000         (WebKit::PluginProcess::platformInitializePluginProcess):
3001         * Scripts/webkit/messages.py:
3002         * Shared/Plugins/PluginProcessAttributes.h:
3003         (WebKit::PluginProcessType): Convert to enum class.
3004         (WebKit::PluginProcessSandboxPolicy): Ditto.
3005         * UIProcess/Plugins/PluginProcessManager.cpp:
3006         (WebKit::PluginProcessManager::fetchWebsiteData):
3007         (WebKit::PluginProcessManager::deleteWebsiteData):
3008         (WebKit::PluginProcessManager::deleteWebsiteDataForHostNames):
3009         * UIProcess/Plugins/PluginProcessProxy.cpp:
3010         (WebKit::PluginProcessProxy::didFinishLaunching):
3011         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
3012         (WebKit::PluginProcessProxy::platformGetLaunchOptionsWithAttributes):
3013         * UIProcess/WebPageProxy.cpp:
3014         (WebKit::WebPageProxy::findPlugin):
3015         * UIProcess/WebPageProxy.h:
3016         * UIProcess/WebPageProxy.messages.in:
3017         * WebProcess/WebPage/WebPage.cpp:
3018         (WebKit::WebPage::createPlugin):
3019         (WebKit::WebPage::canPluginHandleResponse):
3020
3021 2020-06-04  Alex Christensen  <achristensen@webkit.org>
3022
3023         Add WKUIDelegate SPI to confirm before opening a PDF
3024         https://bugs.webkit.org/show_bug.cgi?id=212795
3025         <rdar://problem/58715847>
3026
3027         Reviewed by Tim Horton.
3028
3029         * UIProcess/API/APIUIClient.h:
3030         (API::UIClient::confirmPDFOpening):
3031         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3032         * UIProcess/Cocoa/UIDelegate.h:
3033         * UIProcess/Cocoa/UIDelegate.mm:
3034         (WebKit::UIDelegate::setDelegate):
3035         (WebKit::UIDelegate::UIClient::confirmPDFOpening):
3036         * UIProcess/WebPageProxy.h:
3037         * UIProcess/WebPageProxy.messages.in:
3038         * UIProcess/ios/WebPageProxyIOS.mm:
3039         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
3040         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
3041         * UIProcess/mac/WebPageProxyMac.mm:
3042         (WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
3043         (WebKit::WebPageProxy::openPDFFromTemporaryFolderWithNativeApplication):
3044         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3045         (WebKit::PDFPlugin::openWithNativeApplication):
3046         * WebProcess/WebPage/WebPage.cpp:
3047         (WebKit::WebPage::savePDFToTemporaryFolderAndOpenWithNativeApplication):
3048         * WebProcess/WebPage/WebPage.h:
3049
3050 2020-06-04  Chris Dumez  <cdumez@apple.com>
3051
3052         UIProcess may crash after its prewarmed WebProcess gets terminated
3053         https://bugs.webkit.org/show_bug.cgi?id=212790
3054         <rdar://problem/63696191>
3055
3056         Reviewed by Geoffrey Garen.
3057
3058         Query WebProcessProxy::isDummyProcessProxy() because trying to look up the process
3059         in m_dummyProcessProxies. The key for m_dummyProcessProxies is a sessionID but
3060         not all processes have a sessionID. In particular, prewarmed web processes have
3061         no associated WebsiteDataStore and thus not sessionID.
3062
3063         * UIProcess/WebProcessPool.cpp:
3064         (WebKit::WebProcessPool::disconnectProcess):
3065
3066 2020-06-04  Brent Fulgham  <bfulgham@apple.com>
3067
3068         Reduce telemetry and report generation for WebContent Process sandbox
3069         https://bugs.webkit.org/show_bug.cgi?id=212779
3070         <rdar://problem/63769879>
3071
3072         Reviewed by Per Arne Vollan.
3073
3074         This patch cleans up a set of telemetry and reports generated during normal
3075         WebKit operation. Now that we understand the uses of these XPC services, we
3076         can reduce the logging traffic.
3077
3078         This is important to do now, since generating the telemetry and reports has
3079         a non-zero power cost.
3080
3081         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3082         * WebProcess/com.apple.WebProcess.sb.in:
3083
3084 2020-06-04  Jiewen Tan  <jiewen_tan@apple.com>
3085
3086         Disable CFNetwork AppSSO interception for Mac Catalyst
3087         https://bugs.webkit.org/show_bug.cgi?id=212787
3088         <rdar://problem/63738783>
3089
3090         Reviewed by Chris Dumez.
3091
3092         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3093         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3094
3095 2020-06-04  Brent Fulgham  <bfulgham@apple.com>
3096
3097         Reduce telemetry and report generation for Network Process sandbox
3098         https://bugs.webkit.org/show_bug.cgi?id=212778
3099         <rdar://problem/63891745>
3100
3101         Reviewed by Per Arne Vollan.
3102
3103         This patch cleans up a set of telemetry and reports generated during normal
3104         WebKit operation. Now that we understand the uses of these XPC services, we
3105         can reduce the logging traffic.
3106
3107         This is important to do now, since telemetry and report generation has
3108         battery life and performance impact.
3109
3110         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3111         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3112
3113 2020-06-04  Jacob Uphoff  <jacob_uphoff@apple.com>
3114
3115         Unreviewed, reverting r262546.
3116
3117         This commit caused internal build failures
3118
3119         Reverted changeset:
3120
3121         "[Cocoa] Adopt read-only mode for preferences in the
3122         WebContent process"
3123         https://bugs.webkit.org/show_bug.cgi?id=212411
3124         https://trac.webkit.org/changeset/262546
3125
3126 2020-06-04  Chris Dumez  <cdumez@apple.com>
3127
3128         [iOS] Drop DependentProcessLink ProcessAssertion as it creates power leaks
3129         https://bugs.webkit.org/show_bug.cgi?id=212768
3130         <rdar://problem/62408828>
3131
3132         Reviewed by Alex Christensen.
3133
3134         Drop DependentProcessLink ProcessAssertion since it creates a process assertion cycle between
3135         the UIProcess and the WebContent process and leads to power leaks.
3136
3137         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3138         * Shared/WebProcessCreationParameters.cpp:
3139         (WebKit::WebProcessCreationParameters::encode const):
3140         (WebKit::WebProcessCreationParameters::decode):
3141         * Shared/WebProcessCreationParameters.h:
3142         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3143         (WebKit::WebProcessPool::platformInitializeWebProcess):
3144         * UIProcess/ProcessAssertion.h:
3145         * UIProcess/ProcessThrottler.cpp:
3146         (WebKit::ProcessThrottler::assertionName const):
3147         * UIProcess/WebProcessProxy.cpp:
3148         (WebKit::WebProcessProxy::didSetAssertionType):
3149         * UIProcess/ios/ProcessAssertionIOS.mm:
3150         (WebKit::runningBoardNameForAssertionType):
3151         (WebKit::flagsForAssertionType):
3152         (WebKit::toBKSProcessAssertionReason):
3153         * WebProcess/WebProcess.h:
3154         * WebProcess/cocoa/WebProcessCocoa.mm:
3155         (WebKit::WebProcess::platformInitializeWebProcess):
3156
3157 2020-06-04  Brent Fulgham  <bfulgham@apple.com>
3158
3159         Revise sandbox to support network stack telemetry without sandbox violation reports
3160         https://bugs.webkit.org/show_bug.cgi?id=212720
3161         <rdar://problem/63895783>
3162
3163         Reviewed by Per Arne Vollan.
3164
3165         Telemetry captured for various networking configurations has revealed a handful of mach service
3166         connections that should be allowed in the Network Process to support troubleshooting and field diagnostics.
3167
3168         This patch revises the sandbox to avoid logging these accesses during normal operation.
3169
3170         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Do not generate traces for 'com.apple.diagnosticd'.
3171         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb: Ditto.
3172         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb: Allow 'com.apple.osanalytics.osanalyticshelper' to
3173           be used on internal development builds.
3174         * Shared/WebProcessCreationParameters.cpp:
3175         (WebKit::WebProcessCreationParameters::encode const): Update to handle both 'diagnosticd' and 'osanalyticshelper'
3176         as optional services for internal builds.
3177         (WebKit::WebProcessCreationParameters::decode): Ditto.
3178         * Shared/WebProcessCreationParameters.h:
3179         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3180         (WebKit::diagnosticServices): Ditto.
3181         (WebKit::WebProcessPool::platformInitializeWebProcess): Ditto.
3182         * WebProcess/cocoa/WebProcessCocoa.mm:
3183         (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
3184
3185 2020-06-04  Per Arne Vollan  <pvollan@apple.com>
3186
3187         [Cocoa] Adopt read-only mode for preferences in the WebContent process
3188         https://bugs.webkit.org/show_bug.cgi?id=212411
3189         <rdar://problem/63640788>
3190
3191         Reviewed by Darin Adler.
3192
3193         The WebContent process should never write preferences. Adopt read-only mode for preferences.
3194         This will fix some sandbox violations when the UI process is notifying the WebContent process
3195         about preference changes. When notified, the WebContent process will use the preferences API
3196         to write those preferences in-process, but there should be no attempt at writing these new
3197         values to disk, which this patch will ensure.
3198
3199         No new tests, since this is fixing a benign sandbox violation.
3200
3201         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
3202         (WebKit::XPCServiceMain):
3203
3204 2020-06-04  Per Arne Vollan  <pvollan@apple.com>
3205
3206         [iOS] The WebContent process should be allowed to consume an extension to the runningboard service
3207         https://bugs.webkit.org/show_bug.cgi?id=212753
3208         <rdar://problem/63948859>
3209
3210         Reviewed by Chris Dumez.
3211
3212         The WebContent process on iOS is failing to consume an extension to the runningboard service, because it is not allowed to do so.
3213
3214         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3215
3216 2020-06-04  Tim Horton  <timothy_horton@apple.com>
3217
3218         Work around broken system version macro
3219         https://bugs.webkit.org/show_bug.cgi?id=212726
3220
3221         Reviewed by Dan Bernstein.
3222
3223         * Configurations/DebugRelease.xcconfig:
3224
3225 2020-06-04  Andy Estes  <aestes@apple.com>
3226
3227         [watchOS] Re-enable content filtering in the simulator build
3228         https://bugs.webkit.org/show_bug.cgi?id=212711
3229         <rdar://problem/63938350>
3230
3231         Reviewed by Wenson Hsieh.
3232
3233         * Configurations/FeatureDefines.xcconfig:
3234
3235 2020-06-04  Kate Cheney  <katherine_cheney@apple.com>
3236
3237         ITP SQLite Database should only vacuum once per day
3238         https://bugs.webkit.org/show_bug.cgi?id=212712
3239         <rdar://problem/63939711>
3240
3241         Reviewed by Brent Fulgham.
3242
3243         Currently the SQLite Database runs a vacuum command each time statistics
3244         are processed. This is probably too frequent, because the database
3245         rarely needs to delete large amounts of data. We can cut this down to once a day.
3246
3247         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3248         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3249         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3250         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
3251
3252 2020-06-04  Youenn Fablet  <youenn@apple.com>
3253
3254         Minor optimisation to RemoteAudioBusData::decode
3255         https://bugs.webkit.org/show_bug.cgi?id=212692
3256
3257         Reviewed by Eric Carlson.
3258
3259         * WebProcess/GPU/media/RemoteAudioBusData.h:
3260         (WebKit::RemoteAudioBusData::decode):
3261         Use releaseNonNull to remove some count churn.
3262
3263 2020-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3264
3265         [watchOS] fast/events/watchos/change-focus-during-change-event.html crashes
3266         https://bugs.webkit.org/show_bug.cgi?id=212722
3267         <rdar://problem/60633339>
3268
3269         Reviewed by Andy Estes.
3270
3271         When HAVE(QUICKBOARD_COLLECTION_VIEWS) is enabled, the codepath that's used to simulate interacting with the
3272         select menu view controller on watchOS will crash, since it tries to pretend that the user has selected an item
3273         in a table view section (`PUICQuickboardListSectionTextOptions`) that only exists when Quickboard collection
3274         views are disabled. Fix the crash by adjusting the testing codepath to select the item in the first section when
3275         HAVE(QUICKBOARD_COLLECTION_VIEWS) is defined.
3276
3277         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
3278         (-[WKSelectMenuListViewController selectItemAtIndex:]):
3279
3280 2020-06-03  Jer Noble  <jer.noble@apple.com>
3281
3282         [iOS] Hide the PiP button in fullscreen mode if PiP is disabled in preferences
3283         https://bugs.webkit.org/show_bug.cgi?id=212699
3284         <rdar://problem/60391437>
3285
3286         Reviewed by Eric Carlson.
3287
3288         In r260474, we hid the PiP button in fullscreen when PiP was unsupported on the
3289         current device; we must also hide the PiP button when clients have disabled PiP
3290         via preferences.
3291
3292         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3293         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3294
3295 2020-06-03  Kate Cheney  <katherine_cheney@apple.com>
3296
3297         Any active sqlite transactions for the ITP database should be aborted when the network process suspends.
3298         https://bugs.webkit.org/show_bug.cgi?id=212608
3299         <rdar://problem/60540768>
3300
3301         Reviewed by Chris Dumez.
3302
3303         Calls to WebResourceLoadStatisticsStore::suspend() should abort any
3304         active SQLite transactions. Unfinished transactions will hold the lock
3305         of a database file and could cause the network process to crash when
3306         suspending.
3307
3308         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
3309         (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
3310         (WebKit::ResourceLoadStatisticsDatabaseStore::~ResourceLoadStatisticsDatabaseStore):
3311         Store all ResourceLoadStatisticsDatabaseStore instances in a static
3312         HashSet so existing transactions can be aborted when the process is
3313         preparing to suspend.
3314
3315         (WebKit::ResourceLoadStatisticsDatabaseStore::interrupt):
3316         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3317         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3318         (WebKit::WebResourceLoadStatisticsStore::suspend):
3319
3320 2020-06-03  Chris Dumez  <cdumez@apple.com>
3321
3322         WebProcessPool::notifyPreferencesChanged() is unsafely called on a background thread
3323         https://bugs.webkit.org/show_bug.cgi?id=212697
3324         <rdar://problem/63876652>
3325
3326         Reviewed by Per Arne Vollan.
3327
3328         Make sure we dispatch to the main thread in [WKPreferenceObserver preferenceDidChange] before
3329         we iterate over the process pools and call WebProcessPool::notifyPreferencesChanged() on each
3330         one.
3331
3332         * UIProcess/Cocoa/PreferenceObserver.mm:
3333         (-[WKPreferenceObserver preferenceDidChange:key:encodedValue:]):
3334
3335 2020-06-03  Brent Fulgham  <bfulgham@apple.com>
3336
3337         [iOS] Reduce sandbox logging by permitting necessary sysctl
3338         https://bugs.webkit.org/show_bug.cgi?id=212710
3339         <rdar://problem/63900239>
3340
3341         Reviewed by Per Arne Vollan.
3342
3343         Telemetry indicates that we need to access "sysctl.name2oid" in the
3344         Network process during error handling for HTTP connections. Allow this
3345         access and avoid generating unnecessary logging for this case.
3346
3347         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3348
3349 2020-06-03  Youenn Fablet  <youenn@apple.com>
3350
3351         Add more logging related to service worker fetch event handling
3352         https://bugs.webkit.org/show_bug.cgi?id=212632
3353         <rdar://problem/63913271>
3354
3355         Unreviewed.
3356         Build fix.
3357
3358         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3359         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
3360
3361 2020-06-03  Alex Christensen  <achristensen@webkit.org>
3362
3363         Pass WebPageProxyIdentifier to PreconnectTask
3364         https://bugs.webkit.org/show_bug.cgi?id=212648
3365
3366         Reviewed by Chris Dumez.
3367
3368         Otherwise, AuthenticationManager::didReceiveAuthenticationChallenge sometimes returned early because there was no pageID.
3369         Observed connecting to real websites from my home wifi.  Unable to test using local servers because connecting happens too fast.
3370
3371         * NetworkProcess/NetworkProcess.cpp:
3372         (WebKit::NetworkProcess::preconnectTo):
3373         * NetworkProcess/NetworkProcess.h:
3374         * NetworkProcess/NetworkProcess.messages.in:
3375         * UIProcess/Network/NetworkProcessProxy.cpp:
3376         (WebKit::NetworkProcessProxy::preconnectTo):
3377         * UIProcess/Network/NetworkProcessProxy.h:
3378         * UIProcess/WebPageProxy.cpp:
3379         (WebKit::WebPageProxy::preconnectTo):
3380
3381 2020-06-03  Rob Buis  <rbuis@igalia.com>
3382
3383         Make generated C++ code use modern C++
3384         https://bugs.webkit.org/show_bug.cgi?id=190714
3385
3386         Reviewed by Jonathan Bedard.
3387
3388         Replace typedef usage by alias-declaration.
3389
3390         * Scripts/test-legacyMessages.h:
3391         * Scripts/test-superclassMessages.h:
3392         * Scripts/testMessages.h:
3393         * Scripts/webkit/messages.py:
3394
3395 2020-06-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3396
3397         [GTK4] WTR: Forward key events to the active popup menu
3398         https://bugs.webkit.org/show_bug.cgi?id=212690
3399
3400         Reviewed by Adrian Perez de Castro.
3401
3402         I forgot to remove the ifdefs when added support for popup menus in r262414.
3403
3404         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3405         (webkitWebViewBaseSynthesizeKeyEvent):
3406
3407 2020-06-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3408
3409         [GTK4] Fix input methods
3410         https://bugs.webkit.org/show_bug.cgi?id=212317
3411
3412         Reviewed by Adrian Perez de Castro.
3413
3414         Stop using GdkEvent to synthesize compositing events, add a specific NativeWebKeyboardEvent constructor for them.
3415
3416         * Shared/NativeWebKeyboardEvent.h:
3417         * Shared/gtk/NativeWebKeyboardEventGtk.cpp:
3418         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
3419         * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.cpp:
3420         (webkitInputMethodContextImplGtkSetClientWidget):
3421         (webkitInputMethodContextImplGtkSetClientWindow): Deleted.
3422         * UIProcess/API/gtk/WebKitInputMethodContextImplGtk.h:
3423         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3424         (webkitWebViewBaseRealize):
3425         (webkitWebViewBaseUnrealize):
3426         (webkitWebViewBaseKeyPressEvent):
3427         (webkitWebViewBaseKeyReleaseEvent):
3428         (webkitWebViewBaseFocusEnter):
3429         (webkitWebViewBaseFocusLeave):
3430         (webkitWebViewBaseKeyPressed):
3431         (webkitWebViewBaseKeyReleased):
3432         (toplevelWindowIsActiveChanged):
3433         (webkitWebViewBaseSynthesizeCompositionKeyPress):
3434
3435 2020-06-03  Santosh Mahto  <santosh.mahto@collabora.com>
3436
3437         [GTK4] Implement file chooser
3438         https://bugs.webkit.org/show_bug.cgi?id=212322
3439
3440         Reviewed by Carlos Garcia Campos.
3441
3442         Port FileChooser to gtk4, Now FileChooser uses undeprecated api's.
3443         Covered by existing tests.
3444
3445         * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
3446         (fileChooserDialogResponseCallback):
3447         (webkitWebViewRunFileChooser):
3448
3449 2020-06-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3450
3451         [GTK4] Implement emoji chooser
3452         https://bugs.webkit.org/show_bug.cgi?id=212330
3453
3454         Reviewed by Adrian Perez de Castro.
3455
3456         GtkEmojiChooser is public API in GTK4, so just use that instead of our own.
3457
3458         * UIProcess/API/gtk/WebKitEmojiChooser.cpp:
3459         (emojiActivated): Close the popover before emitting emoji-picked for consistency with GTK.
3460         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3461         (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
3462         (_WebKitWebViewBasePrivate::releaseEmojiChooserTimerFired):
3463         (webkitWebViewBaseDispose):
3464         (emojiChooserClosed):
3465         (webkitWebViewBaseShowEmojiChooser):
3466
3467 2020-06-03  Youenn Fablet  <youenn@apple.com>
3468
3469         Add more logging related to service worker fetch event handling
3470         https://bugs.webkit.org/show_bug.cgi?id=212632
3471
3472         Reviewed by Chris Dumez.
3473
3474         Add logging to identify the page ID and frame ID used by a service worker.
3475         Add logging to identify what is happening in the case of a response being buffered for navigation purposes.
3476
3477         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3478         (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient):
3479         (WebKit::WebSWContextManagerConnection::installServiceWorker):
3480         (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
3481         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
3482         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
3483         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
3484         (WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
3485
3486 2020-06-02  Chris Dumez  <cdumez@apple.com>
3487
3488         [iOS] WKProcessAssertionBackgroundTaskManager incorrectly ignores expiration notifications for daemons
3489         https://bugs.webkit.org/show_bug.cgi?id=212619
3490
3491         Reviewed by Alex Christensen.
3492
3493         WKProcessAssertionBackgroundTaskManager was incorrectly ignoring process assertion expiration notifications
3494         for daemons, because it was relying on visibility to make decisions. For daemons (or ViewServices), we would
3495         not get application visibility notifications and would therefore always assume the app is visible.
3496         As a result, _handleBackgroundTaskExpiration would think it received an outdated expiration notification for
3497         a visible app and would simply re-take the assertion right away.
3498
3499         To address the issue, we now rely on a RunningBoard API that lets us know if the suspension timer has been
3500         started or not (and how much remains on the timer). If the suspension timer is not active when get receive
3501         the expiration notification, we know it is an outdated notification and we ignore it (release and re-take
3502         assertion right away). This can happen if we did not have time to process the expiration notification before
3503         suspended and thus only get it upon resuming. It can also happen if the user re-activates the app right after
3504         the expiration notice has been sent.
3505
3506         * Platform/spi/ios/RunningBoardServicesSPI.h:
3507         * UIProcess/ios/ProcessAssertionIOS.mm:
3508         (processHasActiveRunTimeLimitation):
3509         (-[WKProcessAssertionBackgroundTaskManager init]):
3510         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
3511         (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]):
3512         (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]):
3513         (-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
3514
3515 2020-06-02  Christopher Reid  <chris.reid@sony.com>
3516
3517         REGRESSION[r260844]: [GTK][WPE] Inspector GResource no longer updated after WebInspectorUI file updates
3518         https://bugs.webkit.org/show_bug.cgi?id=212583
3519
3520         Reviewed by Adrian Perez de Castro.
3521
3522         Add a cmake dependency on inspector resource stamp so the Glib
3523         Inspector resources rebuild when the stamp is updated.
3524
3525         * InspectorGResources.cmake:
3526
3527 2020-06-02  Keith Rollin  <krollin@apple.com>
3528
3529         Revert FEATURES_DEFINES related changes
3530         https://bugs.webkit.org/show_bug.cgi?id=212664
3531         <rdar://problem/63893033>
3532
3533         Reviewed by Andy Estes.
3534
3535         Bug 262310, Bug 262311, Bug 262318, and Bug 262331 involve changes to
3536         FEATURE_DEFINES and how the values there relate to those found in the
3537         Platform*.h files. Those changes break XCBuild (by removing the
3538         .xcfilelist related to UnifiedSources and the process for generating
3539         them), and so are being reverted.
3540
3541         * Configurations/FeatureDefines.xcconfig:
3542
3543 2020-06-02  Ryan Haddad  <ryanhaddad@apple.com>
3544
3545         Unreviewed, reverting r262424.
3546
3547         Caused webkitpy test failure
3548
3549         Reverted changeset:
3550
3551         "Make generated C++ code use modern C++"
3552         https://bugs.webkit.org/show_bug.cgi?id=190714
3553         https://trac.webkit.org/changeset/262424
3554
3555 2020-06-02  Peng Liu  <peng.liu6@apple.com>
3556
3557         Stressing webkitSetPresentationMode leads to wrong inline video dimensions
3558         https://bugs.webkit.org/show_bug.cgi?id=202425
3559
3560         Reviewed by Eric Carlson.
3561
3562         * WebProcess/cocoa/VideoFullscreenManager.mm:
3563         (WebKit::VideoFullscreenManager::didEnterFullscreen):
3564         (WebKit::VideoFullscreenManager::didCleanupFullscreen):
3565
3566 2020-06-02  Kate Cheney  <katherine_cheney@apple.com>
3567
3568         Assert network process is not suspended when trying to merge new ITP data
3569         https://bugs.webkit.org/show_bug.cgi?id=212663
3570         <rdar://problem/63892899>
3571
3572         Reviewed by Chris Dumez.
3573
3574         Add a debug assert to check if statistics are being merged into the
3575         ITP database after prepareToSuspend() has been called. If this assert
3576         is hit, it means the ITP database thread is not being stopped when
3577         the process is suspended.
3578
3579         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3580         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
3581
3582 2020-06-02  Per Arne Vollan  <pvollan@apple.com>
3583
3584         REGRESSION(r261387): Introduced sandbox violations
3585         https://bugs.webkit.org/show_bug.cgi?id=212634
3586
3587         Reviewed by Darin Adler.
3588
3589         The change set r261387 introduced some new mach lookup sandbox violations, when attempting to close Launch Services connections that were not open.
3590         Fix this by only attempting to close open connections, and do it while holding the extension to the database mapping service.
3591
3592         No new tests, since this patch is fixing benign sandbox violations.
3593
3594         * WebProcess/cocoa/WebProcessCocoa.mm:
3595         (WebKit::WebProcess::platformInitializeWebProcess):
3596
3597 2020-06-02  Youenn Fablet  <youenn@apple.com>
3598
3599         Allow using web processes for service workers even though they loaded about URLs
3600         https://bugs.webkit.org/show_bug.cgi?id=212464
3601
3602         Reviewed by Chris Dumez.
3603
3604         Before the patch, a web process that loads about:blank will not be able to run service workers.
3605         A web process that is running service workers and is loading an about:blank page will also kill its service workers.
3606         To prevent this, do not take into account about:blank URLs for the computation of the registrable domain of a process.
3607
3608         Covered by API tests.
3609
3610         * UIProcess/WebProcessProxy.cpp:
3611         (WebKit::WebProcessProxy::didStartProvisionalLoadForMainFrame):
3612
3613 2020-06-02  Tim Horton  <timothy_horton@apple.com>
3614
3615         macCatalyst: WKWebView's tint color is not propagated to Web Content process
3616         https://bugs.webkit.org/show_bug.cgi?id=212630
3617
3618         Reviewed by Anders Carlsson.
3619
3620         * Shared/WebPageCreationParameters.cpp:
3621         (WebKit::WebPageCreationParameters::encode const):
3622         (WebKit::WebPageCreationParameters::decode):
3623         * Shared/WebPageCreationParameters.h:
3624         * UIProcess/Cocoa/PageClientImplCocoa.h:
3625         * UIProcess/PageClient.h:
3626         * UIProcess/WebPageProxy.cpp:
3627         (WebKit::WebPageProxy::creationParameters):
3628         * WebProcess/WebPage/WebPage.cpp:
3629         * WebProcess/WebPage/WebPage.h:
3630
3631 2020-06-02  Tim Horton  <timothy_horton@apple.com>
3632
3633         REGRESSION (r258949): Dynamic user accent color changes are not respected by WKWebView
3634         https://bugs.webkit.org/show_bug.cgi?id=212628
3635         <rdar://problem/63436275>
3636
3637         Reviewed by Per Arne Vollan.
3638
3639         Two issues with the "CFPrefs Direct Mode" mechanism caused dynamic changes to the
3640         user accent color preference to not be respected anymore:
3641
3642         - the default change, when synchronized to the Web Content process, was
3643         written into the wrong domain, because of bug 212627.
3644
3645         - AppKit caches the resolved accent color; the cache is invalidated when the
3646         a CoreUI notification is posted. Since we synchronize preferences ourselves,
3647         the ordering of the default change and notification are no longer guaranteed,
3648         so AppKit sometimes reads and re-caches the old accent color.
3649
3650         * WebProcess/cocoa/WebProcessCocoa.mm:
3651         (WebKit::userAccentColorPreferenceKey):
3652         (WebKit::shouldWriteToAppDomainForPreferenceKey):
3653         (WebKit::WebProcess::notifyPreferencesChanged):
3654         To fix the first problem, write the default into the standardUserDefaults.
3655         This is just a workaround, we need a more general solution to this problem
3656         for all global preferences. We know it's OK in this case, because AppKit
3657         happens to read from standardUserDefaults.
3658
3659         (WebKit::dispatchSimulatedNotificationsForPreferenceChange):
3660         To fix the second problem, re-emit the notification once we have synchronized
3661         the preference to the Web Content process.
3662
3663 2020-06-02  Rob Buis  <rbuis@igalia.com>
3664
3665         Make generated C++ code use modern C++
3666         https://bugs.webkit.org/show_bug.cgi?id=190714
3667
3668         Reviewed by Sam Weinig.
3669
3670         Replace typedef usage by alias-declaration.
3671
3672         * Scripts/webkit/messages.py:
3673
3674 2020-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3675
3676         [GTK4] Implement data list drop down menu
3677         https://bugs.webkit.org/show_bug.cgi?id=212333
3678
3679         Reviewed by Adrian Perez de Castro.
3680
3681         Use a GtkPopover for GTK4 instead of a GtkMenu.
3682
3683         * UIProcess/API/gtk/PageClientImpl.cpp:
3684         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
3685         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:
3686         (WebKit::WebDataListSuggestionsDropdownGtk::WebDataListSuggestionsDropdownGtk):
3687         (WebKit::WebDataListSuggestionsDropdownGtk::~WebDataListSuggestionsDropdownGtk):
3688         (WebKit::WebDataListSuggestionsDropdownGtk::show):
3689         * UIProcess/gtk/WebDataListSuggestionsDropdownGtk.h:
3690
3691 2020-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3692
3693         [GTK4] Make popup menus work
3694         https://bugs.webkit.org/show_bug.cgi?id=211178
3695
3696         Reviewed by Adrian Perez de Castro.
3697
3698         Use a GtkPopover for GTK4 instead of a GtkMenu.
3699
3700         * UIProcess/API/gtk/PageClientImpl.cpp:
3701         (WebKit::PageClientImpl::createPopupMenuProxy):
3702         * UIProcess/API/gtk/WebKitPopupMenu.cpp:
3703         (WebKit::WebKitPopupMenu::WebKitPopupMenu):
3704         (WebKit::menuCloseCallback):
3705         (WebKit::WebKitPopupMenu::showPopupMenu):
3706         (WebKit::WebKitPopupMenu::hidePopupMenu):
3707         (WebKit::WebKitPopupMenu::cancelTracking):
3708         (WebKit::WebKitPopupMenu::activateItem):
3709         * UIProcess/API/gtk/WebKitPopupMenu.h:
3710         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3711         (webkitWebViewBaseSizeAllocate): Iterate children and call check_resize on every native one.
3712         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3713         (WebKit::WebPopupMenuProxyGtk::treeViewButtonReleaseEventCallback):
3714         (WebKit::WebPopupMenuProxyGtk::createPopupMenu):
3715         (WebKit::WebPopupMenuProxyGtk::showPopupMenu):
3716         (WebKit::WebPopupMenuProxyGtk::hidePopupMenu):
3717         (WebKit::WebPopupMenuProxyGtk::treeViewRowActivatedCallback): Deleted.
3718         * UIProcess/gtk/WebPopupMenuProxyGtk.h:
3719
3720 2020-06-01  Chris Dumez  <cdumez@apple.com>
3721
3722         Fix thread-safety issue in [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]
3723         https://bugs.webkit.org/show_bug.cgi?id=212615
3724         <rdar://problem/63569049>
3725
3726         Reviewed by Geoffrey Garen.
3727
3728         [WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration] may get called on a background thread
3729         by RunningBoard. When this happened it would check the _applicationIsBackgrounded flag on a background thread,
3730         which was not safe, it would also call _releaseBackgroundTask on the background thread which definitely was not
3731         safe and could lead to crashes such as the one in the radar.
3732
3733         To address the issue, we now call callOnMainRunLoopAndWait() as soon as _handleBackgroundTaskExpiration gets
3734         called and run the whole implementation on the main thread. Previously, we were already doing a dispatch_sync()
3735         to the main thread but only for part of the implementation.
3736
3737         * UIProcess/ios/ProcessAssertionIOS.mm:
3738         (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpiration]):
3739         (-[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread]):
3740
3741 2020-06-01  Brent Fulgham  <bfulgham@apple.com>
3742
3743         Remove unused WebContent process sandbox syscall
3744         https://bugs.webkit.org/show_bug.cgi?id=212609
3745         <rdar://problem/63764590>
3746
3747         Reviewed by Per Arne Vollan.
3748
3749         After further testing we have determined that the syscall added in
3750         Bug 206260 is not always enabled. Check if the Sandbox recognizes
3751         the rule before using it.
3752
3753         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3754         * WebProcess/com.apple.WebProcess.sb.in:
3755
3756 2020-06-01  David Kilzer  <ddkilzer@apple.com>
3757
3758         Don't use casts to convert between WebCore::DragDestinationAction and {Web,WK}DragDestinationAction types
3759         <https://webkit.org/b/212507>
3760
3761         Reviewed by Darin Adler.
3762
3763         * Shared/API/Cocoa/_WKDragActionsInternal.h: Add.
3764         (WebKit::coreDragDestinationActionMask):
3765         - Add conversion function to avoid casting.
3766         * UIProcess/Cocoa/WebViewImpl.mm:
3767         (WebKit::WebViewImpl::draggingEntered):
3768         (WebKit::WebViewImpl::draggingUpdated):
3769         * UIProcess/ios/WKContentViewInteraction.mm:
3770         (-[WKContentView dragDataForDropSession:dragDestinationAction:]):
3771         - Make use of coreDragDestinationActionMask() conversion
3772           function.
3773         - Extract `dragOperationMask` varible for future updates.
3774         * WebKit.xcodeproj/project.pbxproj:
3775         - Add _WKDragActionsInternal.h to project.
3776
3777 2020-06-01  Alex Christensen  <achristensen@webkit.org>
3778
3779         Fix Glib build after r262391
3780         https://bugs.webkit.org/show_bug.cgi?id=212604
3781
3782         * UIProcess/API/glib/WebKitWebContext.cpp:
3783         (webkitWebContextConstructed):
3784
3785 2020-06-01  Alex Christensen  <achristensen@webkit.org>
3786
3787         Revert r250312
3788         https://bugs.webkit.org/show_bug.cgi?id=212604
3789         <rdar://problem/63779241>
3790
3791         Reviewed by Tim Horton.
3792
3793         r250312 was a step towards a network process singleton.
3794         We aren't there yet, so revert it until we are.  There was something trying to keep HSTS storages separate, so let them keep trying.
3795
3796         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3797         (API::ProcessPoolConfiguration::copy):
3798         * UIProcess/API/APIProcessPoolConfiguration.h:
3799         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3800         (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
3801         (-[_WKProcessPoolConfiguration hstsStorageDirectory]):
3802         * UIProcess/LegacyGlobalSettings.h:
3803         (WebKit::LegacyGlobalSettings::setHSTSStorageDirectory): Deleted.
3804         (WebKit::LegacyGlobalSettings::hstsStorageDirectory const): Deleted.
3805         * UIProcess/WebProcessPool.cpp:
3806         (WebKit::WebProcessPool::ensureNetworkProcess):
3807
3808 2020-06-01  Chris Dumez  <cdumez@apple.com>
3809
3810         ASSERTION FAILURE (r220931): !m_function in ~CompletionHandler() after switch tabs
3811         https://bugs.webkit.org/show_bug.cgi?id=212537
3812         <rdar://problem/63766838>
3813
3814         Reviewed by Alex Christensen.
3815
3816         When WebPage::markAllLayersVolatile(), it would destroy m_pageMarkingLayersAsVolatileCounter,
3817         which may not have called its completion handler yet. As a result, we would hit an assertion
3818         in the CompletionHandler destructor.
3819
3820         * WebProcess/WebPage/WebPage.cpp:
3821         (WebKit::WebPage::callVolatilityCompletionHandlers):
3822         (WebKit::WebPage::markLayersVolatile):
3823         (WebKit::WebPage::cancelMarkLayersVolatile):
3824         * WebProcess/WebPage/WebPage.h:
3825         (WebKit::WebPage::markLayersVolatile):
3826         * WebProcess/WebProcess.cpp:
3827         (WebKit::WebProcess::prepareToSuspend):
3828         (WebKit::WebProcess::markAllLayersVolatile):
3829         (WebKit::WebProcess::cancelMarkAllLayersVolatile):
3830         * WebProcess/WebProcess.h:
3831
3832 2020-06-01  Sam Weinig  <weinig@apple.com>
3833
3834         Extended Color: Replace Color constructors taking numeric values with type specific factory functions
3835         https://bugs.webkit.org/show_bug.cgi?id=212576
3836
3837         Reviewed by Tim Horton.
3838
3839         Replaces all remaining implicit and explicit uses of the Color constructors taking numeric
3840         values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor,
3841         giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible.
3842
3843         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3844         (WebKit::RemoteLayerBackingStore::drawInContext):
3845         * UIProcess/API/wpe/WebKitColor.cpp:
3846         (webkitColorToWebCoreColor):
3847         * UIProcess/ios/WKContentViewInteraction.mm:
3848         (-[WKContentView _tapHighlightColorForFastClick:]):
3849         * WebProcess/Inspector/WebInspectorClient.cpp:
3850         (WebKit::WebInspectorClient::showPaintRect):
3851         * WebProcess/WebPage/FindController.cpp:
3852         (WebKit::FindController::drawRect):
3853         * WebProcess/WebPage/WebPage.cpp:
3854         (WebKit::WebPage::paintSnapshotAtSize):
3855         * WebProcess/WebPage/ios/FindControllerIOS.mm:
3856         (WebKit::FindIndicatorOverlayClientIOS::drawRect):
3857         (WebKit::highlightColor): Deleted.
3858
3859 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3860
3861         [GTK4] Add printing support
3862         https://bugs.webkit.org/show_bug.cgi?id=212320
3863
3864         Reviewed by Adrian Perez de Castro.
3865
3866         Printing API hasn't changed, the only problem was that we were using gtk_dialog_run() and gdk threads deprecated API.
3867
3868         * UIProcess/API/gtk/WebKitPrintOperation.cpp:
3869         (webkitPrintOperationRunDialog): Remove GTK4 ifdefs.
3870         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
3871         (WebKit::WebPrintOperationGtk::print): Use g_idle_add_full() instead of gdk threads deprecated API.
3872
3873 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3874
3875         [GTK4] Wheel events are always handled by the main frame view
3876         https://bugs.webkit.org/show_bug.cgi?id=212593
3877
3878         Reviewed by Adrian Perez de Castro.
3879
3880         It's not possible scroll other scrollable areas with the mouse wheel. This is because we are using the given x,
3881         y delta in the scroll signal as the position. In GTK4 the scroll event doesn't include a position, so we have to
3882         use the last motion event.
3883
3884         * Shared/NativeWebWheelEvent.h:
3885         * Shared/gtk/NativeWebWheelEventGtk.cpp:
3886         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent): Add wheelTicks parameter.
3887         * Shared/gtk/WebEventFactory.cpp:
3888         (WebKit::WebEventFactory::createWebWheelEvent): New create function that receives the wheelTicks.
3889         * Shared/gtk/WebEventFactory.h:
3890         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3891         (webkitWebViewBaseScroll): Use the x, y parameters as the delta and take the position from the last motion event.
3892
3893 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3894
3895         [GTK4] Monitor root window to update activity state
3896         https://bugs.webkit.org/show_bug.cgi?id=212581
3897
3898         Reviewed by Adrian Perez de Castro.
3899
3900         To update ActivityState::IsInWindow and ActivityState::WindowIsActive.
3901
3902         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3903         (toplevelWindowStateEvent):
3904         (webkitWebViewBaseSetToplevelOnScreenWindow):
3905         (webkitWebViewBaseDispose):
3906         (toplevelWindowIsActiveChanged):
3907         (toplevelWindowStateChanged):
3908         (toplevelWindowRealized):
3909         (toplevelWindowUnrealized):
3910         (webkitWebViewBaseRoot):
3911         (webkitWebViewBaseUnroot):
3912         (webkit_web_view_base_class_init):
3913
3914 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3915
3916         [GTK4] Fix pointer lock in X11
3917         https://bugs.webkit.org/show_bug.cgi?id=212592
3918
3919         Reviewed by Adrian Perez de Castro.
3920
3921         I forgot to forward the motion events for X11 in GTK4.
3922
3923         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3924         (MotionEvent::MotionEvent): Add a constructor that receives the positions and state.
3925         (webkitWebViewBaseMotion): Notify the pointer lock manager about the event. Also save the last motion event and
3926         compute the movement delta.
3927
3928 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3929
3930         [GTK4] Make inspector work
3931         https://bugs.webkit.org/show_bug.cgi?id=212321
3932
3933         Reviewed by Adrian Perez de Castro.
3934
3935         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
3936         (webkitWebViewBaseRemoveDialog): Added instead of the generic webkitWebViewBaseRemoveChild that has been removed.
3937         (webkitWebViewBaseRemoveWebInspector): Just unparent the inspector view instead of caling webkitWebViewBaseRemoveChild.
3938         (webkitWebViewBaseDispose): Use specific functions to remove the children.
3939         (webkitWebViewBaseSnapshot): Call gtk_widget_snapshot_child() on inspector view if present.
3940         (webkitWebViewBaseRemoveChild): Deleted.
3941         * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp:
3942         (WebKit::RemoteWebInspectorProxy::platformSave): Remove GTK4 ifdefs.
3943         * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp:
3944         (WebKit::WebInspectorProxy::platformSave): Ditto.
3945         * UIProcess/Inspector/gtk/WebKitInspectorWindow.cpp:
3946         (webkit_inspector_window_init): Show title buttons in inspector window.
3947         * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
3948         (WebKit::AcceleratedBackingStoreWayland::snapshot): Use the texture size instead of the view size, since it's
3949         different when the inspector is attached.
3950
3951 2020-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
3952
3953         REGRESSION(r262184): fast/forms/implicit-submission.html is crashing
3954         https://bugs.webkit.org/show_bug.cgi?id=212520
3955
3956         Reviewed by Adrian Perez de Castro.
3957
3958         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
3959         (WebKit::WebPopupMenuProxyGtk::activateSelectedItem): Return early if the popup has already been closed.
3960
3961 2020-06-01  Rob Buis  <rbuis@igalia.com>
3962
3963         Rename ResourceResponseBase::isHTTP to isInHTTPFamily
3964         https://bugs.webkit.org/show_bug.cgi?id=208782
3965
3966         Reviewed by Sam Weinig.
3967
3968         Adapt to API change.
3969
3970         * NetworkProcess/cache/NetworkCache.cpp:
3971         (WebKit::NetworkCache::makeStoreDecision):
3972         * WebProcess/Plugins/PluginView.cpp:
3973         (WebKit::buildHTTPHeaders):
3974
3975 2020-06-01  Michael Catanzaro  <mcatanzaro@gnome.org>
3976
3977         [WPE][GTK] pthread_create() fails with EPERM in the second WebKitWebProcess with sandbox on
3978         https://bugs.webkit.org/show_bug.cgi?id=212380
3979
3980         Reviewed by Adrian Perez de Castro.
3981
3982         Dereference scmp_arg_cmp before use.
3983
3984         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3985         (WebKit::setupSeccomp):
3986
3987 2020-05-30  Alex Christensen  <achristensen@webkit.org>
3988
3989         Deprecate WKBundlePostSynchronousMessage
3990         https://bugs.webkit.org/show_bug.cgi?id=212536
3991
3992         Reviewed by Anders Carlsson.
3993
3994         * WebProcess/InjectedBundle/API/c/WKBundle.h:
3995
3996 2020-05-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3997
3998         [GTK] WebDriver: stop using GdkEvent API in preparation for GTK4
3999         https://bugs.webkit.org/show_bug.cgi?id=212465
4000
4001         Reviewed by Adrian Perez de Castro.
4002
4003         Use the new internal API to synthesize events.
4004
4005         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
4006         (webkitWebViewBaseSynthesizeKeyEvent): Add type parameter, since WebDriver can send press and release events
4007         separately. Also add a parameter to indicate that keyval should be translated according to current state that is
4008         required by WebDriver.
4009         * UIProcess/API/gtk/WebKitWebViewBaseInternal.h:
4010         * UIProcess/Automation/WebAutomationSession.cpp:
4011         (WebKit::WebAutomationSession::documentLoadedForFrame): Call resetClickCount().
4012         (WebKit::WebAutomationSession::updateClickCount): Update the click count for the given button position and
4013         maximum time and distance.
4014         (WebKit::WebAutomationSession::resetClickCount): Reset the click count.
4015         * UIProcess/Automation/WebAutomationSession.h:
4016         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
4017         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Use webkitWebViewBaseSynthesizeMouseEvent().
4018         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Use webkitWebViewBaseSynthesizeKeyEvent().
4019         (WebKit::WebAutomationSession::platformSimulateKeySequence): Ditto.
4020         (WebKit::doMouseEvent): Deleted.
4021         (WebKit::doMotionEvent): Deleted.
4022         (WebKit::doKeyStrokeEvent): Deleted.
4023         * UIProcess/gtk/KeyBindingTranslator.cpp: Add missing key shortcuts to predefined list.
4024
4025 2020-05-29  Alex Christensen  <achristensen@webkit.org>
4026
4027         Use correct encoding when converting a WTF::URL to CFURLRef
4028         https://bugs.webkit.org/show_bug.cgi?id=212486
4029
4030         Reviewed by Darin Adler.
4031
4032         * Shared/API/c/cf/WKURLCF.mm:
4033         (WKURLCopyCFURL):
4034         * Shared/cf/ArgumentCodersCF.cpp:
4035         (IPC::decode):
4036
4037 2020-05-29  Peng Liu  <peng.liu6@apple.com>
4038
4039         Replace callOnMainThread() with callOnMainRunLoop() in AudioSessionRoutingArbitratorProxyCocoa.mm
4040         https://bugs.webkit.org/show_bug.cgi?id=212553
4041
4042         Reviewed by Chris Dumez.
4043
4044         Use callOnMainRunLoop() instead of callOnMainThread() in the UIProcess. Also move
4045         m_setupArbitrationOngoing flag to the end of the completion handler.
4046
4047         No new tests, no functional change.
4048
4049         * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
4050         (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
4051
4052 2020-05-29  Brent Fulgham  <bfulgham@apple.com>
4053
4054         [Cocoa] Improve logging quality for non-ephemeral sessions
4055         https://bugs.webkit.org/show_bug.cgi?id=212551
4056         <rdar://problem/62461099>
4057
4058         Reviewed by David Kilzer.
4059
4060         In Bug 209522 I switched normal mode logging to use the same privacy-protecting mode we use for ephemeral sessions.
4061         This had the unintended consequence of removing network load data used to investigate networking issues.
4062
4063         This patch adopts the more fine-grained logging provided by the low-level 'nw_context_privacy_level' setting.
4064
4065         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
4066         (WebKit::configurationForSessionID): Adopt 'nw_context_privacy_level' setting.
4067
4068 2020-05-29  Andy Estes  <aestes@apple.com>
4069
4070         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)
4071         https://bugs.webkit.org/show_bug.cgi?id=212541
4072
4073         Reviewed by Darin Adler.
4074
4075         APPLE_PAY_SESSION_V(3|4) is now enabled