Send delayed Ad Click Attribution conversion requests to the click source
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-15  John Wilander  <wilander@apple.com>
2
3         Send delayed Ad Click Attribution conversion requests to the click source
4         https://bugs.webkit.org/show_bug.cgi?id=196838
5         <rdar://problem/47650157>
6
7         Reviewed by Chris Dumez and Youenn Fablet.
8
9         This patch schedules a conversion request with appropriate data going to the
10         click source as a result of an ad click conversion.
11
12         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
13         infrastructure to make the request. This will probably be reworked into a
14         dedicated load class further on.
15
16         New test infrastructure allows for an override of both the conversion URL
17         and the 24-48 hour timer.
18
19         * NetworkProcess/AdClickAttributionManager.cpp: Added.
20         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
21         (WebKit::AdClickAttributionManager::store):
22         (WebKit::AdClickAttributionManager::startTimer):
23             Convenience function to support test override.
24         (WebKit::AdClickAttributionManager::convert):
25             This function now sets the timer.
26         (WebKit::AdClickAttributionManager::fireConversionRequest):
27             Fire an individual request.
28         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
29             This is the timer function that iterates over all pending attributions.
30         (WebKit::AdClickAttributionManager::clear):
31             Now clears the two new test settings members.
32         (WebKit::AdClickAttributionManager::toString const):
33         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
34         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
35         (WebKit::AdClickAttributionManager::setPingLoadFunction):
36         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
37         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
38         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
39         * NetworkProcess/NetworkProcess.cpp:
40         (WebKit::NetworkProcess::storeAdClickAttribution):
41         (WebKit::NetworkProcess::dumpAdClickAttribution):
42         (WebKit::NetworkProcess::clearAdClickAttribution):
43         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
44         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
45         * NetworkProcess/NetworkProcess.h:
46         * NetworkProcess/NetworkProcess.messages.in:
47         * NetworkProcess/NetworkSession.cpp:
48         (WebKit::NetworkSession::NetworkSession):
49         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
50         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
51         * NetworkProcess/NetworkSession.h:
52         * NetworkProcess/PingLoad.cpp:
53         (WebKit::PingLoad::PingLoad):
54         (WebKit::m_blobFiles):
55         (WebKit::PingLoad::initialize):
56             The PingLoad constructor is now split in two to allow for construction
57             without a WebKit::NetworkConnectionToWebProcess object. The body of
58             the constructor was moved into the new initialize() function which is
59             shared between constructors.
60         * NetworkProcess/PingLoad.h:
61         * Sources.txt:
62             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
63             NetworkProcess/NetworkAdClickAttribution.cpp.
64         * UIProcess/API/C/WKPage.cpp:
65         (WKPageSetAdClickAttributionOverrideTimerForTesting):
66         (WKPageSetAdClickAttributionConversionURLForTesting):
67         * UIProcess/API/C/WKPagePrivate.h:
68         * UIProcess/Network/NetworkProcessProxy.cpp:
69         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
70         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
71         * UIProcess/Network/NetworkProcessProxy.h:
72         * UIProcess/WebPageProxy.cpp:
73         (WebKit::WebPageProxy::dumpAdClickAttribution):
74         (WebKit::WebPageProxy::clearAdClickAttribution):
75         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
76         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
77         * UIProcess/WebPageProxy.h:
78         * UIProcess/WebProcessPool.cpp:
79         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
80         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
81         * UIProcess/WebProcessPool.h:
82         * WebKit.xcodeproj/project.pbxproj:
83
84 2019-04-15  Devin Rousso  <drousso@apple.com>
85
86         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
87         https://bugs.webkit.org/show_bug.cgi?id=196872
88         <rdar://problem/49233240>
89
90         Reviewed by Joseph Pecoraro.
91
92         * UIProcess/Automation/WebAutomationSession.cpp:
93         (WebKit::WebAutomationSession::addSingleCookie):
94         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
95         itself to figure out which domain it should be set on.
96
97 2019-04-15  Philippe Normand  <pnormand@igalia.com>
98
99         [GTK][WPE] Add enable-media websetting
100         https://bugs.webkit.org/show_bug.cgi?id=196863
101
102         Reviewed by Michael Catanzaro.
103
104         It can be useful for headless browsers, for instance. The setting is enabled by default.
105
106         * Shared/WebPreferences.yaml:
107         * UIProcess/API/glib/WebKitSettings.cpp:
108         (webKitSettingsSetProperty):
109         (webKitSettingsGetProperty):
110         (webkit_settings_class_init):
111         (webkit_settings_get_enable_media):
112         (webkit_settings_set_enable_media):
113         * UIProcess/API/gtk/WebKitSettings.h:
114         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
115         * UIProcess/API/wpe/WebKitSettings.h:
116         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
117
118 2019-04-14  Rob Buis  <rbuis@igalia.com>
119
120         Link prefetch not useful for top-level navigation
121         https://bugs.webkit.org/show_bug.cgi?id=195623
122
123         Reviewed by Youenn Fablet.
124
125         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
126         to the same url is done within a threshold (5 seconds), reuse the
127         prefetch cache entry, move it to the disk cache and navigate to
128         the url, meaning no extra network trip is needed. When not used within
129         the threshold period, the prefetch entry will be erased using a timer.
130
131         * NetworkProcess/NetworkProcess.cpp:
132         (WebKit::NetworkProcess::lowMemoryHandler):
133         * NetworkProcess/NetworkProcess.h:
134         (WebKit::NetworkProcess::prefetchCache):
135         * NetworkProcess/NetworkResourceLoader.cpp:
136         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
137         (WebKit::NetworkResourceLoader::didReceiveResponse):
138         (WebKit::NetworkResourceLoader::didReceiveBuffer):
139         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
140         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
141         * NetworkProcess/NetworkResourceLoader.h:
142         * NetworkProcess/cache/PrefetchCache.cpp: Added.
143         (WebKit::PrefetchCache::Entry::Entry):
144         (WebKit::PrefetchCache::PrefetchCache):
145         (WebKit::PrefetchCache::~PrefetchCache):
146         (WebKit::PrefetchCache::clear):
147         (WebKit::PrefetchCache::take):
148         (WebKit::PrefetchCache::store):
149         (WebKit::PrefetchCache::sessionPrefetchMap const):
150         (WebKit::PrefetchCache::clearExpiredEntries):
151         * NetworkProcess/cache/PrefetchCache.h: Added.
152         (WebKit::PrefetchCache::Entry::response const):
153         (WebKit::PrefetchCache::Entry::releaseBuffer):
154         * Shared/WebPreferences.yaml:
155         * Sources.txt:
156         * WebKit.xcodeproj/project.pbxproj:
157
158 2019-04-14  Andy Estes  <aestes@apple.com>
159
160         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
161         https://bugs.webkit.org/show_bug.cgi?id=196893
162         <rdar://problem/48318983>
163
164         Reviewed by Anders Carlsson.
165
166         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
167         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
168         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
169         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
170         the LegacyCustomProtocolManagerProxy has been destroyed.
171
172         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
173         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
174         (-[WKCustomProtocolLoader cancel]):
175         (-[WKCustomProtocolLoader connection:didFailWithError:]):
176         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
177         (-[WKCustomProtocolLoader connection:didReceiveData:]):
178         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
179         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
180         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
181         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
182         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
183         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
184
185 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
186
187         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
188         https://bugs.webkit.org/show_bug.cgi?id=196742
189
190         Reviewed by Konstantin Tokarev.
191
192         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
193
194         * CMakeLists.txt:
195         * PlatformWin.cmake:
196         
197         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
198
199 2019-04-13  Chris Dumez  <cdumez@apple.com>
200
201         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
202         https://bugs.webkit.org/show_bug.cgi?id=196548
203         <rdar://problem/49567254>
204
205         Reviewed by Darin Adler.
206
207         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
208         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
209         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
210         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
211         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
212         incoming IPC that is not for its associated navigation.
213
214         * UIProcess/ProvisionalPageProxy.cpp:
215         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
216         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
217         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
218         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
219         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
220         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
221         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
222         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
223         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
224         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
225         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
226
227 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
228
229         Unreviewed, try to fix the internal build after r244239
230
231         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
232         import that was missing anyways.
233
234         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
235
236 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
237
238         Enable modern compatibility mode by default in WKWebView on some devices
239         https://bugs.webkit.org/show_bug.cgi?id=196883
240         <rdar://problem/49864527>
241
242         Reviewed by Tim Horton.
243
244         Make some minor adjustments to new API.
245
246         * Shared/WebCompatibilityMode.h:
247
248         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
249
250         * Shared/WebPreferences.yaml:
251         * Shared/WebPreferencesDefaultValues.h:
252
253         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
254         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
255
256         * UIProcess/API/APIWebsitePolicies.h:
257         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
258
259         Rename the withPreferences: label to just preferences:.
260
261         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
262         * UIProcess/Cocoa/NavigationState.mm:
263         (WebKit::NavigationState::setNavigationDelegate):
264         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
265         * UIProcess/Cocoa/VersionChecks.h:
266         * UIProcess/ios/WebPageProxyIOS.mm:
267
268 2019-04-12  Brian Burg  <bburg@apple.com>
269
270         WebDriver: fix typo in EnterFullscreen.js in error-handling code
271         https://bugs.webkit.org/show_bug.cgi?id=196882
272         <rdar://problem/49867122>
273
274         Reviewed by Devin Rousso.
275
276         * UIProcess/Automation/atoms/EnterFullscreen.js:
277         (enterFullscreen):
278
279 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
280
281         Unreviewed fix for non-unified build.
282
283         * Shared/PrintInfo.cpp:
284         Add missing include from r244202.
285
286 2019-04-12  Saam barati  <sbarati@apple.com>
287
288         Sometimes we need to user fewer CPUs in our threading calculations
289         https://bugs.webkit.org/show_bug.cgi?id=196794
290         <rdar://problem/49389497>
291
292         Reviewed by Yusuke Suzuki.
293
294         * WebProcess/com.apple.WebProcess.sb.in:
295
296 2019-04-12  Devin Rousso  <drousso@apple.com>
297
298         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
299         https://bugs.webkit.org/show_bug.cgi?id=196847
300         <rdar://problem/49609396>
301
302         Reviewed by Brian Burg.
303
304         * UIProcess/Automation/WebAutomationSession.cpp:
305         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
306
307 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
308
309         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
310         https://bugs.webkit.org/show_bug.cgi?id=196845
311
312         Reviewed by Ryosuke Niwa.
313
314         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
315         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
316         * NetworkProcess/NetworkDataTask.cpp:
317         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
318         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
319         * NetworkProcess/NetworkProcess.cpp:
320         * NetworkProcess/NetworkResourceLoadMap.cpp:
321         * NetworkProcess/NetworkResourceLoadMap.h:
322         * NetworkProcess/NetworkResourceLoader.cpp:
323         * NetworkProcess/PingLoad.h:
324         * Shared/WebCompiledContentRuleListData.cpp:
325         * Shared/gtk/WebEventFactory.cpp:
326         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
327         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
328         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
329         (WKWebsiteDataStoreStatisticsResetToConsistentState):
330         * UIProcess/Downloads/DownloadProxyMap.cpp:
331         * UIProcess/InspectorTargetProxy.cpp:
332         * UIProcess/PageClient.h:
333         * UIProcess/ProcessAssertion.cpp:
334         * UIProcess/ProvisionalPageProxy.h:
335         * UIProcess/WebPageInspectorTargetAgent.h:
336         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
337         * WebProcess/Cache/WebCacheStorageConnection.cpp:
338         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
339         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
340         (WKBundleSetDatabaseQuota):
341         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
342         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
343
344 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
345
346         Update AudioSession route sharing policy
347         https://bugs.webkit.org/show_bug.cgi?id=196776
348         <rdar://problem/46501611>
349
350         Reviewed by Jer Noble.
351
352         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
353         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
354
355 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
356
357         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
358         https://bugs.webkit.org/show_bug.cgi?id=196862
359
360         Reviewed by Darin Adler.
361
362         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
363         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
364
365         * UIProcess/API/APIWebsitePolicies.cpp:
366         (API::WebsitePolicies::copy const):
367
368 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
369
370         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
371         https://bugs.webkit.org/show_bug.cgi?id=196803
372         rdar://problem/49078202
373
374         Reviewed by Antti Koivisto.
375
376         Flip LegacyOverflowScrollingTouchEnabled to false.
377
378         * Shared/WebPreferences.yaml:
379
380 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
381
382         [iOS] Software keyboard is shown too frequently on some websites
383         https://bugs.webkit.org/show_bug.cgi?id=195856
384         <rdar://problem/49191395>
385
386         Reviewed by Darin Adler.
387
388         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
389         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
390         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
391         when the element is focused.
392
393         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
394         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
395         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
396         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
397         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
398         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
399         hardware keyboard is not attached.
400
401         * UIProcess/API/Cocoa/WKWebView.mm:
402         (hardwareKeyboardAvailabilityChangedCallback):
403         * UIProcess/ios/WKContentViewInteraction.h:
404         * UIProcess/ios/WKContentViewInteraction.mm:
405         (-[WKContentView shouldShowAutomaticKeyboardUI]):
406
407         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
408
409         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
410
411         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
412         element with inputmode="none", we'll show the input accessory view once again.
413
414 2019-04-12  Antoine Quint  <graouts@apple.com>
415
416         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
417         https://bugs.webkit.org/show_bug.cgi?id=196830
418         <rdar://problem/49124313>
419
420         Reviewed by Wenson Hsieh.
421
422         We add a new policy to determine whether simulated mouse events dispatch are allowed.
423
424         * Shared/WebsitePoliciesData.cpp:
425         (WebKit::WebsitePoliciesData::encode const):
426         (WebKit::WebsitePoliciesData::decode):
427         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
428         * Shared/WebsitePoliciesData.h:
429         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
430         * UIProcess/API/APIWebsitePolicies.cpp:
431         (API::WebsitePolicies::copy const):
432         (API::WebsitePolicies::data):
433         * UIProcess/API/APIWebsitePolicies.h:
434         * WebKit.xcodeproj/project.pbxproj:
435
436 2019-04-12  Chris Dumez  <cdumez@apple.com>
437
438         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
439         https://bugs.webkit.org/show_bug.cgi?id=196781
440         <rdar://problem/49789381>
441
442         Reviewed by Darin Adler.
443
444         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
445         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
446         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
447         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
448
449         * UIProcess/Downloads/DownloadProxyMap.cpp:
450         (WebKit::DownloadProxyMap::invalidate):
451         (WebKit::DownloadProxyMap::processDidClose): Deleted.
452         * UIProcess/Downloads/DownloadProxyMap.h:
453         * UIProcess/Network/NetworkProcessProxy.cpp:
454         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
455         (WebKit::NetworkProcessProxy::didClose):
456
457 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
458
459         [GTK] REGRESSION(r243860): Many tests failing
460         https://bugs.webkit.org/show_bug.cgi?id=196791
461
462         Reviewed by Joanmarie Diggs.
463
464         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
465         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
466         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
467         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
468         notified of the changes in the accessibility tree.
469
470         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
471         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
472         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
473         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
474         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
475         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
476         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
477         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
478         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
479         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
480
481 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
482
483         Update 'Save Image' to more clear instructions
484         https://bugs.webkit.org/show_bug.cgi?id=196833
485         <rdar://problem/47446845>
486
487         Reviewed by Wenson Hsieh.
488
489         Just updating to a new string.
490
491         * UIProcess/API/Cocoa/_WKElementAction.mm:
492         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
493
494 2019-04-11  Chris Dumez  <cdumez@apple.com>
495
496         Unable to run system Safari with trunk WebKit
497         https://bugs.webkit.org/show_bug.cgi?id=196777
498         <rdar://problem/49784574>
499
500         Reviewed by Alex Christensen.
501
502         * UIProcess/API/Cocoa/WKWebView.mm:
503         (-[WKWebView _initializeWithConfiguration:]):
504         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
505         data store only happens for apps rebuilt using recent SDK.
506
507         * UIProcess/Cocoa/VersionChecks.h:
508         * UIProcess/Cocoa/VersionChecks.mm:
509         (WebKit::linkedOnOrAfter):
510         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
511           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
512           be controlled by the caller.
513         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
514           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
515           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
516           0 value for sdkVersion.
517
518 2019-04-11  Zalan Bujtas  <zalan@apple.com>
519
520         Add @page margin support
521         https://bugs.webkit.org/show_bug.cgi?id=196680
522         <rdar://problem/45217707>
523
524         Reviewed by Tim Horton.
525
526         * Shared/PrintInfo.cpp:
527         (WebKit::PrintInfo::encode const):
528         (WebKit::PrintInfo::decode):
529         * Shared/PrintInfo.h:
530         * Shared/WebPreferences.yaml:
531         * Shared/gtk/PrintInfoGtk.cpp:
532         (WebKit::PrintInfo::PrintInfo):
533         * Shared/mac/PrintInfoMac.mm:
534         (WebKit::PrintInfo::PrintInfo):
535         * UIProcess/API/C/WKPage.cpp:
536         (WKPageComputePagesForPrinting):
537         * UIProcess/API/C/WKPreferences.cpp:
538         (WKPreferencesSetPageAtRuleSupportEnabled):
539         (WKPreferencesGetPageAtRuleSupportEnabled):
540         * UIProcess/API/C/WKPreferencesRefPrivate.h:
541         * UIProcess/GenericCallback.h:
542         * UIProcess/WebPageProxy.cpp:
543         (WebKit::WebPageProxy::computedPagesCallback):
544         * UIProcess/WebPageProxy.h:
545         * UIProcess/WebPageProxy.messages.in:
546         * UIProcess/mac/WKPrintingView.mm:
547         (pageDidComputePageRects):
548         (-[WKPrintingView _askPageToComputePageRects]):
549         * WebProcess/WebPage/WebPage.cpp:
550         (WebKit::WebPage::beginPrinting):
551         (WebKit::WebPage::computePagesForPrinting):
552         (WebKit::WebPage::computePagesForPrintingImpl):
553         * WebProcess/WebPage/WebPage.h:
554         * WebProcess/WebPage/ios/WebPageIOS.mm:
555         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
556
557 2019-04-11  Dean Jackson  <dino@apple.com>
558
559         Extract UTI mapping and allow for additions
560         https://bugs.webkit.org/show_bug.cgi?id=196822
561         <rdar://problem/49822339>
562
563         Reviewed by Tim Horton.
564
565         Use the new helper to map MIME type to UTI.
566
567         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
568         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
569         * UIProcess/ios/WKSystemPreviewView.mm:
570         (getUTIForSystemPreviewMIMEType):
571
572
573 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
574
575         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
576         https://bugs.webkit.org/show_bug.cgi?id=196825
577
578         Reviewed by Simon Fraser.
579
580         Ensure the layer transactions IDs are sequential. So bail out of
581         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
582
583         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
584         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
585         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
586
587 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
588
589         Allow the MediaSource API to be enabled via website policy
590         https://bugs.webkit.org/show_bug.cgi?id=196429
591         <rdar://problem/48774333>
592
593         Reviewed by Tim Horton.
594
595         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
596
597         * Shared/WebPreferences.yaml:
598
599         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
600         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
601         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
602
603         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
604         compatibility mode on WKWebpagePreferences.
605
606         * Shared/WebPreferences.yaml:
607         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
608         * Shared/WebsitePoliciesData.cpp:
609         (WebKit::WebsitePoliciesData::encode const):
610         (WebKit::WebsitePoliciesData::decode):
611
612         Add plumbing for m_mediaSourcePolicy in the set of website policies.
613
614         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
615
616         Update the document loader with the given media source policy. There are two possibilities when applying the set
617         of policies to the document loader; either the document loader is already attached to a Frame, or the document
618         loader is yet to be attached to a Frame.
619
620         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
621         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
622         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
623
624         * Shared/WebsitePoliciesData.h:
625         * UIProcess/API/APIWebsitePolicies.cpp:
626         (API::WebsitePolicies::data):
627         * UIProcess/API/APIWebsitePolicies.h:
628         * UIProcess/API/C/WKPage.cpp:
629         (WKPageSetPageNavigationClient):
630         * UIProcess/Cocoa/NavigationState.mm:
631         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
632
633         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
634         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
635         default website policies on the web view configuration, even when using the C API to set the navigation client,
636         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
637         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
638         webpage preferences.
639
640         * UIProcess/WebPageProxy.cpp:
641         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
642         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
643         * UIProcess/WebPageProxy.h:
644         * WebKit.xcodeproj/project.pbxproj:
645
646 2019-04-11  Antti Koivisto  <antti@apple.com>
647
648         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
649         https://bugs.webkit.org/show_bug.cgi?id=196813
650         <rdar://problem/49393264>
651
652         Reviewed by Simon Fraser.
653
654         No test, can't repro.
655
656         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
657         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
658
659         Null check the nodes.
660
661 2019-04-10  Chris Dumez  <cdumez@apple.com>
662
663         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
664         https://bugs.webkit.org/show_bug.cgi?id=196784
665
666         Reviewed by Antti Koivisto.
667
668         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
669         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
670         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
671         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
672         not sometimes be gone by the time we need it.
673
674         * UIProcess/SuspendedPageProxy.cpp:
675         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
676
677 2019-04-10  Alex Christensen  <achristensen@webkit.org>
678
679         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
680         https://bugs.webkit.org/show_bug.cgi?id=196809
681         <rdar://49800762>
682
683         Reviewed by Brady Eidson.
684
685         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
686         (-[WKNavigationResponse _downloadAttribute]):
687
688 2019-04-10  Tim Horton  <timothy_horton@apple.com>
689
690         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
691         https://bugs.webkit.org/show_bug.cgi?id=196797
692         <rdar://problem/48484715>
693
694         Reviewed by Simon Fraser.
695
696         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
697         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
698         Validate the set of modifier keys pressed when handling a key event for scrolling:
699         Ignore key events with multiple modifier keys pressed.
700         Ignore key events with an invalid modifier key pressed for a given primary key.
701
702 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
703
704         requestAnimationFrame should execute before the next frame
705         https://bugs.webkit.org/show_bug.cgi?id=177484
706
707         Reviewed by Simon Fraser.
708
709         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
710         a single call to Page::updateRendering(). This new function implements 
711         "Update the rendering" step of the HTML Event Loop specification
712         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
713
714         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
715         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
716         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
717         (WebKit::DrawingAreaCoordinatedGraphics::display):
718         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
719         (WebKit::LayerTreeHost::layerFlushTimerFired):
720
721         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
722         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
723         -- Call Page::updateRendering() to make sure that "Update the rendering"
724            happens immediately before updating the page.
725
726         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
727            to be exactly before flushing the layers. This fixes the assertion
728            ASSERT(m_inLayerFlush) which was firing when running a layout test.
729            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
730            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
731            twice before calling didFlushLayers().
732
733         * WebProcess/WebPage/WebPage.cpp:
734         (WebKit::WebPage::layoutIfNeeded):
735         (WebKit::WebPage::updateRendering):
736         (WebKit::WebPage::willDisplayPage): Deleted.
737         * WebProcess/WebPage/WebPage.h:
738         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
739         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
740
741 2019-04-10  Devin Rousso  <drousso@apple.com>
742
743         Web Inspector: save sheet should be anchored underneath the tab bar when detached
744         https://bugs.webkit.org/show_bug.cgi?id=196722
745         <rdar://problem/49613280>
746
747         Reviewed by Timothy Hatcher.
748
749         * WebProcess/WebPage/WebInspectorUI.h:
750         * WebProcess/WebPage/WebInspectorUI.cpp:
751         (WebKit::WebInspectorUI::changeSheetRect): Added.
752         * UIProcess/WebInspectorProxy.messages.in:
753         * UIProcess/WebInspectorProxy.h:
754         (WebKit::WebInspectorProxy::sheetRect const): Added.
755         * UIProcess/WebInspectorProxy.cpp:
756         (WebKit::WebInspectorProxy::setSheetRect): Added.
757         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
758         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
759         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
760         * UIProcess/mac/WebInspectorProxyMac.mm:
761         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
762         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
763         * UIProcess/win/WebInspectorProxyWin.cpp:
764         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
765         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
766         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
767
768         * WebProcess/WebPage/RemoteWebInspectorUI.h:
769         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
770         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
771         * UIProcess/RemoteWebInspectorProxy.messages.in:
772         * UIProcess/RemoteWebInspectorProxy.h:
773         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
774         * UIProcess/RemoteWebInspectorProxy.cpp:
775         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
776         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
777         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
778         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
779         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
780         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
781         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
782         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
783
784 2019-04-10  Andy Estes  <aestes@apple.com>
785
786         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
787         https://bugs.webkit.org/show_bug.cgi?id=196785
788         <rdar://problem/48240051>
789
790         Reviewed by Tim Horton.
791
792         * UIProcess/ios/WKPDFView.mm:
793         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
794
795 2019-04-10  Chris Dumez  <cdumez@apple.com>
796
797         Unreviewed, rolling out r244146.
798
799         Caused a few DeviceOrientation API test failures on iOS
800
801         Reverted changeset:
802
803         "Unable to run system Safari with trunk WebKit"
804         https://bugs.webkit.org/show_bug.cgi?id=196777
805         https://trac.webkit.org/changeset/244146
806
807 2019-04-10  Devin Rousso  <drousso@apple.com>
808
809         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
810         https://bugs.webkit.org/show_bug.cgi?id=196725
811         <rdar://problem/49669810>
812
813         Reviewed by Timothy Hatcher.
814
815         * WebProcess/WebPage/WebInspector.cpp:
816         (WebKit::WebInspector::showMainResourceForFrame):
817
818 2019-04-10  Youenn Fablet  <youenn@apple.com>
819
820         Clear Cache Storage structures before removing all related files
821         https://bugs.webkit.org/show_bug.cgi?id=196650
822
823         Reviewed by Alex Christensen.
824
825         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
826         To make things more deterministic, clear files/folders directly
827         after CachesStorage structures have finished being cleared.
828
829         * NetworkProcess/cache/CacheStorageEngine.cpp:
830         (WebKit::CacheStorage::Engine::clearAllCaches):
831         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
832
833 2019-04-10  Alex Christensen  <achristensen@webkit.org>
834
835         Add SPI WKNavigationResponse._downloadAttribute
836         https://bugs.webkit.org/show_bug.cgi?id=196755
837         <rdar://49587365>
838
839         Reviewed by Brady Eidson.
840
841         * UIProcess/API/APINavigationResponse.h:
842         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
843         (-[WKNavigationResponse _downloadAttribute]):
844         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
845         * UIProcess/ProvisionalPageProxy.cpp:
846         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
847         * UIProcess/ProvisionalPageProxy.h:
848         * UIProcess/WebPageProxy.cpp:
849         (WebKit::WebPageProxy::decidePolicyForResponse):
850         (WebKit::WebPageProxy::decidePolicyForResponseShared):
851         * UIProcess/WebPageProxy.h:
852         * UIProcess/WebPageProxy.messages.in:
853         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
854         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
855         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
856
857 2019-04-10  Youenn Fablet  <youenn@apple.com>
858
859         SWClientConnection should not double hop to fire some events
860         https://bugs.webkit.org/show_bug.cgi?id=196735
861
862         Reviewed by Alex Christensen.
863
864         Removed unnecessary method.
865
866         * WebProcess/Storage/WebSWClientConnection.cpp:
867         * WebProcess/Storage/WebSWClientConnection.h:
868
869 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
870
871         [iOS] Fix iokit-get-properties sandbox violations
872         https://bugs.webkit.org/show_bug.cgi?id=196782
873         <rdar://problem/49497720>
874
875         Reviewed by Brent Fulgham.
876
877         Add iokit properties to the WebContent sandbox on iOS.
878
879         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
880
881 2019-04-10  Tim Horton  <timothy_horton@apple.com>
882
883         Add modern API for overriding the page's specified viewport configuration
884         https://bugs.webkit.org/show_bug.cgi?id=167734
885         <rdar://problem/30331795>
886
887         Reviewed by Simon Fraser.
888
889         * Shared/WebPageCreationParameters.cpp:
890         (WebKit::WebPageCreationParameters::encode const):
891         (WebKit::WebPageCreationParameters::decode):
892         * Shared/WebPageCreationParameters.h:
893         Plumb overrideViewportArguments in WebPageCreationParameters, so that
894         if the process crashes (or swaps) they are maintained.
895
896         * UIProcess/API/Cocoa/WKWebView.mm:
897         (viewportArgumentsFromDictionary):
898         (-[WKWebView _overrideViewportWithArguments:]):
899         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
900         object and use the existing (now improved) overrideViewportArguments mechanism
901         to take over the page's viewport arguments.
902
903         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
904         * UIProcess/WebPageProxy.cpp:
905         (WebKit::WebPageProxy::creationParameters):
906         * UIProcess/WebPageProxy.h:
907         * UIProcess/ios/WebPageProxyIOS.mm:
908         (WebKit::WebPageProxy::setOverrideViewportArguments):
909         * WebProcess/WebPage/WebPage.cpp:
910         Plumb overrideViewportArguments around more.
911
912 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
913
914         Add runJavaScriptInFrame for WebPageProxy/WebPage
915         https://bugs.webkit.org/show_bug.cgi?id=196750
916         <rdar://problem/49755738>
917
918         Reviewed by Youenn Fablet.
919
920         Tests of the new method will be covered by the internal counterpart.
921
922         * UIProcess/WebFrameProxy.cpp:
923         (WebKit::WebFrameProxy::loadData):
924         * UIProcess/WebFrameProxy.h:
925         Add a comment.
926         * UIProcess/WebPageProxy.cpp:
927         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
928         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
929         Merge the above two runJavaScriptInMainFrame*.
930         (WebKit::WebPageProxy::runJavaScriptInFrame):
931         * UIProcess/WebPageProxy.h:
932         * WebProcess/WebPage/WebPage.cpp:
933         (WebKit::WebPage::loadDataInFrame):
934         Add an assertion.
935         (WebKit::WebPage::runJavaScript):
936         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
937         (WebKit::WebPage::runJavaScriptInFrame):
938         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
939         * WebProcess/WebPage/WebPage.h:
940         * WebProcess/WebPage/WebPage.messages.in:
941
942 2019-04-10  Chris Dumez  <cdumez@apple.com>
943
944         Unable to run system Safari with trunk WebKit
945         https://bugs.webkit.org/show_bug.cgi?id=196777
946         <rdar://problem/49784574>
947
948         Reviewed by Alex Christensen.
949
950         * UIProcess/API/Cocoa/WKWebView.mm:
951         (-[WKWebView _initializeWithConfiguration:]):
952         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
953         data store only happens for apps rebuilt using recent SDK.
954
955         * UIProcess/Cocoa/VersionChecks.h:
956         * UIProcess/Cocoa/VersionChecks.mm:
957         (WebKit::linkedOnOrAfter):
958         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
959           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
960           be controlled by the caller.
961         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
962           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
963           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
964           0 value for sdkVersion.
965
966 2019-04-10  Chris Dumez  <cdumez@apple.com>
967
968         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
969         https://bugs.webkit.org/show_bug.cgi?id=196774
970         <rdar://problem/49460572>
971
972         Reviewed by Alex Christensen.
973
974         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
975         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
976         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
977         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
978         case we would fail to close the WebPage and audio could keep playing.
979
980         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
981         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
982         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
983         the DidFailToSuspendAfterProcessSwap is eventually received.
984
985         * UIProcess/SuspendedPageProxy.cpp:
986         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
987         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
988         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
989         * UIProcess/SuspendedPageProxy.h:
990         * UIProcess/WebPageProxy.cpp:
991         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
992         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
993         * UIProcess/WebPageProxy.h:
994         * UIProcess/WebProcessPool.cpp:
995         * UIProcess/WebProcessPool.h:
996
997 2019-04-10  Timothy Hatcher  <timothy@apple.com>
998
999         WKScrollView background color does not match WKWebView before content is loaded.
1000         https://bugs.webkit.org/show_bug.cgi?id=196745
1001         rdar://problem/49750810
1002
1003         Reviewed by Megan Gardner.
1004
1005         * UIProcess/API/Cocoa/WKWebView.mm:
1006         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
1007         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
1008         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
1009         _contentView.backgroundColor and it has changed.
1010
1011 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
1012
1013         Fix text autoscrolling when typing in modern webkit
1014         https://bugs.webkit.org/show_bug.cgi?id=196718
1015         <rdar://problem/49225507>
1016
1017         Reviewed by Tim Horton.
1018
1019         For staging only. We need to turn off UIKit's scrolling behavior to land
1020         the changes we are making. To keep from the build ever breaking,
1021         I am temporarily circumventing the changes in UIKit. This will be removed
1022         once the next UIKit submission happens.
1023
1024         * UIProcess/ios/WKContentViewInteraction.mm:
1025         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
1026         (-[WKContentView setUpTextSelectionAssistant]):
1027
1028 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1029
1030         [iOSMac] Opt into modern compatibility mode by default
1031         https://bugs.webkit.org/show_bug.cgi?id=196763
1032         <rdar://problem/49038732>
1033
1034         Reviewed by Tim Horton.
1035
1036         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
1037
1038         * Shared/WebPreferences.yaml:
1039         * Shared/WebPreferencesDefaultValues.h:
1040
1041 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1042
1043         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
1044         https://bugs.webkit.org/show_bug.cgi?id=196744
1045         <rdar://49415309>
1046
1047         Reviewed by Chris Dumez.
1048
1049         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
1050         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
1051         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
1052         on the old one which is supposed to make it so all the message receivers associated with it have been removed
1053         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
1054         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
1055         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
1056         these messages so it can tear down the message receiver with the others it removes at close time.
1057
1058         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1059         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1060         (-[WKWebProcessPlugInBrowserContextController dealloc]):
1061         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
1062         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1063         (WebKit::WebPage::addRemoteObjectRegistry):
1064         * WebProcess/WebPage/WebPage.cpp:
1065         (WebKit::WebPage::close):
1066         * WebProcess/WebPage/WebPage.h:
1067
1068 2019-04-10  Chris Dumez  <cdumez@apple.com>
1069
1070         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
1071
1072         * UIProcess/SuspendedPageProxy.h:
1073
1074 2019-04-10  Antoine Quint  <graouts@apple.com>
1075
1076         Enable Pointer Events on watchOS
1077         https://bugs.webkit.org/show_bug.cgi?id=196771
1078         <rdar://problem/49040909>
1079
1080         Reviewed by Dean Jackson.
1081
1082         * Configurations/FeatureDefines.xcconfig:
1083
1084 2019-04-10  Brady Eidson  <beidson@apple.com>
1085
1086         Background tabs are not fully reactivated after a link is opened from an external application.
1087         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
1088
1089         Reviewed by Chris Dumez.
1090
1091         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
1092         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
1093
1094         The WKApplicationStateTrackingView logic needs to be a little more resilient.
1095
1096         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1097         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
1098         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
1099           background state then fake the relevant notification.
1100         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
1101         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
1102
1103 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
1104
1105         Unreviewed, build fix for r244097
1106
1107         * NetworkProcess/NetworkProcess.cpp:
1108         (WebKit::NetworkProcess::actualPrepareToSuspend):
1109         (WebKit::NetworkProcess::resume):
1110         Added guards for ENABLE(SERVICE_WORKER)
1111
1112 2019-04-09  Keith Rollin  <krollin@apple.com>
1113
1114         Unreviewed build maintenance -- update .xcfilelists.
1115
1116         * DerivedSources-input.xcfilelist:
1117         * DerivedSources-output.xcfilelist:
1118
1119 2019-04-09  Zalan Bujtas  <zalan@apple.com>
1120
1121         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
1122         https://bugs.webkit.org/show_bug.cgi?id=196743
1123         <rdar://problem/43897551>
1124
1125         Reviewed by Tim Horton.
1126
1127         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1128         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1129         * WebProcess/WebPage/WebPage.cpp:
1130         (WebKit::WebPage::setViewLayoutSize):
1131
1132 2019-04-09  Youenn Fablet  <youenn@apple.com>
1133
1134         Close service worker database on network process suspension
1135         https://bugs.webkit.org/show_bug.cgi?id=196623
1136         <rdar://problem/48930869>
1137
1138         Reviewed by Alex Christensen.
1139
1140         Close service worker database when preparing to suspend.
1141         On resume, push changes if any is needed.
1142
1143         * NetworkProcess/NetworkProcess.cpp:
1144         (WebKit::NetworkProcess::actualPrepareToSuspend):
1145         (WebKit::NetworkProcess::cancelPrepareToSuspend):
1146         (WebKit::NetworkProcess::processDidResume):
1147         * UIProcess/API/Cocoa/WKProcessPool.mm:
1148         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
1149         (-[WKProcessPool _sendNetworkProcessDidResume]):
1150         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1151         * UIProcess/Network/NetworkProcessProxy.h:
1152         * UIProcess/WebProcessPool.cpp:
1153         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
1154         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
1155         * UIProcess/WebProcessPool.h:
1156
1157 2019-04-09  Daniel Bates  <dabates@apple.com>
1158
1159         [iPad] Should open popover when the spacebar is pressed
1160         https://bugs.webkit.org/show_bug.cgi?id=196360
1161         <rdar://problem/49389129>
1162
1163         Reviewed by Brent Fulgham.
1164
1165         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
1166         just like it does on the Mac.
1167
1168         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
1169         hence pressing spacebar does nothing (because there is no focused element).
1170
1171         * UIProcess/ios/WKContentViewInteraction.h:
1172         * UIProcess/ios/WKContentViewInteraction.mm:
1173         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
1174         the focused element, update the accessory and then tell the accessory to begin editing.
1175         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1176         Write in terms of -accessoryOpen.
1177         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
1178         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
1179         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
1180         which will cause the popover to appear again.
1181
1182 2019-04-09  Chris Dumez  <cdumez@apple.com>
1183
1184         Unreviewed, fix webkitpy failure after r244085.
1185
1186         Use a list instead of a set for header includes so that the order is
1187         maintained.
1188
1189         * Scripts/webkit/messages.py:
1190
1191 2019-04-09  Andy Estes  <aestes@apple.com>
1192
1193         [Apple Pay] Add release logging to PaymentCoordinator
1194         https://bugs.webkit.org/show_bug.cgi?id=196738
1195
1196         Reviewed by Alex Christensen.
1197
1198         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1199         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
1200         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1201
1202 2019-04-09  Jer Noble  <jer.noble@apple.com>
1203
1204         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
1205         https://bugs.webkit.org/show_bug.cgi?id=196659
1206
1207         Reviewed by Chris Dumez.
1208
1209         * Platform/IPC/Connection.h:
1210         (IPC::Connection::sendWithAsyncReply):
1211         * Platform/spi/ios/AssertionServicesSPI.h:
1212         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
1213         (WebKit::ProcessTaskStateObserver::setClient):
1214         (WebKit::ProcessTaskStateObserver::client):
1215         (WebKit::ProcessTaskStateObserver::taskState const):
1216         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
1217         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
1218         (WebKit::toProcessTaskStateObserverTaskState):
1219         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
1220         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
1221         (WebKit::ProcessTaskStateObserver::setTaskState):
1222         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1223         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
1224         * UIProcess/ProcessAssertion.h:
1225         * UIProcess/ProcessThrottler.cpp:
1226         (WebKit::ProcessThrottler::updateAssertion):
1227         * UIProcess/ProcessThrottler.h:
1228         (WebKit::ProcessThrottler::shouldBeRunnable const):
1229         * UIProcess/WebProcessProxy.h:
1230         * UIProcess/WebProcessProxy.messages.in:
1231         * UIProcess/ios/ProcessAssertionIOS.mm:
1232         (WebKit::reasonForState):
1233         (WebKit::toBKSProcessAssertionReason):
1234         (WebKit::ProcessAssertion::ProcessAssertion):
1235         * WebKit.xcodeproj/project.pbxproj:
1236         * WebProcess/WebProcess.cpp:
1237         (WebKit::WebProcess::actualPrepareToSuspend):
1238         (WebKit::WebProcess::cancelPrepareToSuspend):
1239         (WebKit::WebProcess::processDidResume):
1240         * WebProcess/WebProcess.h:
1241         * WebProcess/cocoa/WebProcessCocoa.mm:
1242         (WebKit::WebProcess::processTaskStateDidChange):
1243
1244 2019-04-09  Alex Christensen  <achristensen@webkit.org>
1245
1246         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1247         https://bugs.webkit.org/show_bug.cgi?id=196665
1248         <rdar://45115669>
1249
1250         Reviewed by Geoff Garen.
1251
1252         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1253
1254         * UIProcess/API/Cocoa/WKWebView.mm:
1255         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1256         * UIProcess/Cocoa/WebViewImpl.mm:
1257         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1258
1259 2019-04-09  John Wilander  <wilander@apple.com>
1260
1261         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
1262         https://bugs.webkit.org/show_bug.cgi?id=196558
1263         <rdar://problem/47650245>
1264
1265         Reviewed by Youenn Fablet.
1266
1267         So called pixel requests have traditionally been used to send ad click
1268         attribution data to click sources. The privacy implications of such
1269         pixel requests are severe which is in part why browsers have started to
1270         block cookies from being sent in such third-party requests.
1271
1272         To allow for a smooth transition to more privacy-friendly ad click
1273         attribution, we should allow servers to make a redirect to
1274         https://click-source.example/.well-known/ad-click-attribution/ to
1275         trigger a so called conversion.
1276
1277         This patch checks for the well-known location in the path component of
1278         the redirect URL. If the request indeed goes to the well-known location,
1279         we parse the conversion data and send it to the storage in the network
1280         session.
1281
1282         * NetworkProcess/NetworkAdClickAttribution.cpp:
1283         (WebKit::NetworkAdClickAttribution::convert):
1284             Reporting function.
1285         * NetworkProcess/NetworkAdClickAttribution.h:
1286         * NetworkProcess/NetworkResourceLoader.cpp:
1287         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1288             Now checks for the well-known location through a call to
1289             WebCore::AdClickAttribution::parseConversionRequest().
1290         * NetworkProcess/NetworkSession.cpp:
1291         (WebKit::NetworkSession::convertAdClickAttribution):
1292             Piping to WebKit::NetworkAdClickAttribution::convert().
1293         * NetworkProcess/NetworkSession.h:
1294
1295 2019-04-09  Chris Dumez  <cdumez@apple.com>
1296
1297         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
1298         https://bugs.webkit.org/show_bug.cgi?id=196695
1299         <rdar://problem/48073787>
1300
1301         Reviewed by Tim Horton.
1302
1303         In order for WebContent processes to get marked as "Foreground Running" when their view
1304         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
1305         a subview of the WKContentView. The _UILayerHostView's visibility target is the
1306         WebContent process currently associated with the view.
1307
1308         * Platform/spi/ios/UIKitSPI.h:
1309         * UIProcess/PageClient.h:
1310         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
1311         * UIProcess/WebPageProxy.h:
1312         * UIProcess/WebProcessProxy.h:
1313         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
1314         * UIProcess/WebProcessProxy.messages.in:
1315         * UIProcess/ios/PageClientImplIOS.h:
1316         * UIProcess/ios/PageClientImplIOS.mm:
1317         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
1318         * UIProcess/ios/WKContentView.h:
1319         * UIProcess/ios/WKContentView.mm:
1320         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1321         (-[WKContentView _setupVisibilityPropagationView]):
1322         (-[WKContentView _processDidExit]):
1323         (-[WKContentView _didRelaunchProcess]):
1324         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
1325         * UIProcess/ios/WebPageProxyIOS.mm:
1326         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
1327         * UIProcess/ios/WebProcessProxyIOS.mm:
1328         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
1329         * WebProcess/WebProcess.h:
1330         * WebProcess/cocoa/WebProcessCocoa.mm:
1331         (WebKit::WebProcess::platformInitializeWebProcess):
1332
1333 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
1334
1335         Remove unnecessary network process assertion for IDB close
1336         https://bugs.webkit.org/show_bug.cgi?id=196693
1337
1338         Reviewed by Geoffrey Garen.
1339
1340         * NetworkProcess/NetworkProcess.cpp:
1341         (WebKit::NetworkProcess::createIDBServer):
1342         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
1343         * NetworkProcess/NetworkProcess.h:
1344         * UIProcess/Network/NetworkProcessProxy.cpp:
1345         (WebKit::NetworkProcessProxy::didClose):
1346         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
1347         * UIProcess/Network/NetworkProcessProxy.h:
1348         * UIProcess/Network/NetworkProcessProxy.messages.in:
1349
1350 2019-04-09  Chris Dumez  <cdumez@apple.com>
1351
1352         Loads using loadHTMLString() cause flashing when process-swapping
1353         https://bugs.webkit.org/show_bug.cgi?id=196714
1354         <rdar://problem/49637354>
1355
1356         Reviewed by Antti Koivisto.
1357
1358         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
1359         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
1360         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
1361         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
1362         displaying the layer of the previous process until there is something meaningful to show in the
1363         new process.
1364
1365         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
1366         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
1367         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
1368         process may also get used for future navigations to the same site (as demonstrated by the
1369         API test) which is beneficial for performance.
1370
1371         * UIProcess/SuspendedPageProxy.cpp:
1372         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1373         * UIProcess/SuspendedPageProxy.h:
1374         * UIProcess/WebPageProxy.cpp:
1375         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1376         * UIProcess/WebProcessPool.cpp:
1377         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1378
1379 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
1380
1381         [CMake][WinCairo] Separate copied headers into different directories
1382         https://bugs.webkit.org/show_bug.cgi?id=196655
1383
1384         Reviewed by Michael Catanzaro.
1385
1386         * CMakeLists.txt:
1387         * PlatformWin.cmake:
1388
1389 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1390
1391         [iOS] Do not allow starting selection drags when selection views are not visible
1392         https://bugs.webkit.org/show_bug.cgi?id=196686
1393         <rdar://problem/49399192>
1394
1395         Reviewed by Tim Horton.
1396
1397         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
1398         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
1399         the previously selected text. This is because the text is still selected in the document since we don't clear
1400         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
1401         longer present.
1402
1403         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
1404         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
1405         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
1406         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
1407
1408         * UIProcess/WebPageProxy.h:
1409         * UIProcess/ios/WKContentViewInteraction.mm:
1410         (-[WKContentView hasSelectablePositionAtPoint:]):
1411         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1412
1413         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
1414         (i.e. the web view is first responder, and is not suppressing text interactions).
1415
1416         (-[WKContentView _allowedDragSourceActions]):
1417         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
1418         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1419
1420         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
1421
1422         * UIProcess/ios/WebPageProxyIOS.mm:
1423         (WebKit::WebPageProxy::requestDragStart):
1424         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1425
1426         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
1427
1428         * WebProcess/WebCoreSupport/WebDragClient.cpp:
1429         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
1430
1431         Instead of always returning Any, consult WebPage's allowed drag source actions.
1432
1433         * WebProcess/WebPage/WebPage.h:
1434         (WebKit::WebPage::allowedDragSourceActions const):
1435         * WebProcess/WebPage/WebPage.messages.in:
1436         * WebProcess/WebPage/ios/WebPageIOS.mm:
1437         (WebKit::WebPage::requestDragStart):
1438         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1439
1440         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
1441
1442 2019-04-08  Justin Fan  <justin_fan@apple.com>
1443
1444         [Web GPU] Fix Web GPU experimental feature on iOS
1445         https://bugs.webkit.org/show_bug.cgi?id=196632
1446
1447         Reviewed by Myles C. Maxfield.
1448
1449         Add feature conditionals for iOS 11.
1450         Properly make Web GPU available on iOS 11+.
1451
1452         * Configurations/FeatureDefines.xcconfig:
1453         * Configurations/WebKitTargetConditionals.xcconfig:
1454
1455 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1456
1457         Fix selector name after r243834
1458         https://bugs.webkit.org/show_bug.cgi?id=196549
1459
1460         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1461         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1462         I forgot the colon in the setter's name.
1463
1464 2019-04-08  Antti Koivisto  <antti@apple.com>
1465
1466         Compute touch actions for touch point from remote layer tree regions
1467         https://bugs.webkit.org/show_bug.cgi?id=196701
1468
1469         Reviewed by Simon Fraser.
1470
1471         Add a function for finding the right layer and getting the touch actions in UI process side.
1472
1473         The code is not used yet.
1474
1475         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1476         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1477         (WebKit::touchActionsForPoint):
1478
1479         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
1480         taking event regions into account.
1481         Return the touch actions from the deepest event sensitive layer hit.
1482
1483         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1484
1485         Modernize.
1486
1487 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
1488
1489         Make HSTS list handling more robust against unexpected content 
1490         https://bugs.webkit.org/show_bug.cgi?id=196552
1491         <rdar://problem/43403817>
1492
1493         Reviewed by Chris Dumez.
1494
1495         Crash logs indicate we sometimes encounter null key values during processing.
1496         This patch adds some debug assertions to catch this in test environments, and
1497         allows the code to skip the bad entries if encountered.
1498
1499         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
1500         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
1501
1502         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1503         (WebKit::filterPreloadHSTSEntry):
1504         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
1505
1506 2019-04-05  Brian Burg  <bburg@apple.com>
1507
1508         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
1509         https://bugs.webkit.org/show_bug.cgi?id=196168
1510
1511         Reviewed by Devin Rousso.
1512
1513         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
1514         So, most messages between WebAutomationSession and its proxy can use this facility and stop
1515         keeping track of callback IDs manually. This makes most code easier to read on both the
1516         sender and receiver side.
1517
1518         There are two cases that could not be converted:
1519         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
1520         be able to cancel all pending replies when a page navigates away, the web process crashes,
1521         or when handling an alert.
1522         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
1523         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
1524
1525         * UIProcess/Automation/WebAutomationSession.cpp:
1526         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1527         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1528         (WebKit::WebAutomationSession::computeElementLayout):
1529         (WebKit::WebAutomationSession::selectOptionElement):
1530         (WebKit::WebAutomationSession::getAllCookies):
1531         (WebKit::WebAutomationSession::deleteSingleCookie):
1532         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1533         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
1534         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
1535         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
1536         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
1537         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
1538         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
1539         * UIProcess/Automation/WebAutomationSession.h:
1540         * UIProcess/Automation/WebAutomationSession.messages.in:
1541         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1542         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
1543         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1544         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
1545         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
1546         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1547         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1548         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1549         (WebKit::WebAutomationSessionProxy::deleteCookie):
1550         * WebProcess/Automation/WebAutomationSessionProxy.h:
1551         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
1552
1553 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1554
1555         REGRESSION(236463) DownloadManager can call a null CompletionHandler
1556         https://bugs.webkit.org/show_bug.cgi?id=196414
1557         <rdar://problem/48389434>
1558
1559         Reviewed by Geoff Garen.
1560
1561         * NetworkProcess/NetworkResourceLoader.cpp:
1562         (WebKit::NetworkResourceLoader::convertToDownload):
1563         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
1564         r236463 introduced an unchecked code path that can allow this to happen.
1565
1566 2019-04-07  Commit Queue  <commit-queue@webkit.org>
1567
1568         Unreviewed, rolling out r243956.
1569         https://bugs.webkit.org/show_bug.cgi?id=196688
1570
1571         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
1572         by aakashjain on #webkit).
1573
1574         Reverted changeset:
1575
1576         "Clicking "Go Back" from a safe browsing warning from an
1577         iframe should navigate the WKWebView back to the previous
1578         page"
1579         https://bugs.webkit.org/show_bug.cgi?id=196665
1580         https://trac.webkit.org/changeset/243956
1581
1582 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
1583
1584         Remove stray byte added by r241131
1585         https://bugs.webkit.org/show_bug.cgi?id=196682
1586
1587         Reviewed by Alexey Proskuryakov.
1588
1589         Sublime Text thinks WKWebView.mm is binary instead of text.
1590
1591         According to online documentation and bisecting, this is because r241131
1592         introduced a stray byte (probably a null byte?) into the file.
1593
1594         I fixed this with Cmd-C Cmd-V.
1595
1596         * UIProcess/API/Cocoa/WKWebView.mm:
1597         (-[WKWebView _initializeWithConfiguration:]):
1598
1599 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1600
1601         Hide next and previous form control buttons when WKWebView is editable
1602         https://bugs.webkit.org/show_bug.cgi?id=196672
1603         <rdar://problem/35625321>
1604
1605         Reviewed by Tim Horton.
1606
1607         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
1608         editability.
1609
1610         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
1611
1612         * Platform/spi/ios/UIKitSPI.h:
1613         * UIProcess/API/Cocoa/WKWebView.mm:
1614         (-[WKWebView _setEditable:]):
1615         * UIProcess/ios/WKContentViewInteraction.h:
1616         * UIProcess/ios/WKContentViewInteraction.mm:
1617         (-[WKContentView _updateAccessory]):
1618         (-[WKContentView _didChangeWebViewEditability]):
1619
1620 2019-04-06  Antti Koivisto  <antti@apple.com>
1621
1622         Combine event and touch action regions into a single class
1623         https://bugs.webkit.org/show_bug.cgi?id=196644
1624         <rdar://problem/49643614>
1625
1626         Reviewed by Darin Adler.
1627
1628         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1629         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1630         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1631         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1632         (WebKit::RemoteLayerTreeNode::eventRegion const):
1633         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1634         (WebKit::RemoteLayerTreeNode::setEventRegion):
1635         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1636         (WebKit::PlatformCALayerRemote::setEventRegion):
1637         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1638
1639 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
1640
1641         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
1642         https://bugs.webkit.org/show_bug.cgi?id=196077
1643         <rdar://problem/49108202>
1644
1645         Reviewed by Chris Dumez.
1646
1647         When a new web view is created, it is possible we don't have the web content process till a load
1648         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
1649         value down to web process via WebPageCreationParameters when a new process is created, just like
1650         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
1651
1652         * Shared/WebPageCreationParameters.cpp:
1653         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
1654         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
1655         * Shared/WebPageCreationParameters.h:
1656         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
1657             don't need the iVar in WKWebView any more.
1658         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
1659         (-[WKWebView _setViewScale:]): Ditto.
1660         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
1661         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
1662         * UIProcess/WebPageProxy.cpp:
1663         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
1664             web process creation parameter.
1665         * UIProcess/WebPageProxy.h:
1666         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
1667         * UIProcess/ios/WebPageProxyIOS.mm:
1668         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
1669             to web process.
1670         * WebProcess/WebPage/WebPage.cpp:
1671         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
1672             set that to viewport configuration.
1673
1674 2019-04-05  Jer Noble  <jer.noble@apple.com>
1675
1676         [Cocoa] Deactivate the audio session before the WebProcess suspends.
1677         https://bugs.webkit.org/show_bug.cgi?id=196658
1678
1679         Reviewed by Eric Carlson.
1680
1681         Notify the PlatformMediaSessionManager when the process suspends or resumes.
1682
1683         * WebProcess/WebProcess.cpp:
1684         (WebKit::WebProcess::actualPrepareToSuspend):
1685         (WebKit::WebProcess::cancelPrepareToSuspend):
1686         (WebKit::WebProcess::processDidResume):
1687
1688 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1689
1690         [iOS] Web process gets suspended while holding locked database files
1691         https://bugs.webkit.org/show_bug.cgi?id=196519
1692         <rdar://problem/49531797>
1693
1694         Reviewed by Chris Dumez.
1695
1696         * WebProcess/WebProcess.cpp:
1697         (WebKit::WebProcess::actualPrepareToSuspend):
1698
1699 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1700
1701         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1702         https://bugs.webkit.org/show_bug.cgi?id=196665
1703         <rdar://45115669>
1704
1705         Reviewed by Geoff Garen.
1706
1707         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1708
1709         * UIProcess/API/Cocoa/WKWebView.mm:
1710         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1711         * UIProcess/Cocoa/WebViewImpl.mm:
1712         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1713
1714 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1715
1716         Undeprecate WKNavigationData
1717         https://bugs.webkit.org/show_bug.cgi?id=196559
1718         <rdar://44927425>
1719
1720         Reviewed by Geoff Garen.
1721
1722         * UIProcess/API/Cocoa/WKNavigationData.h:
1723         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
1724         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
1725         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
1726
1727 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1728
1729         [iOS] Web process gets suspended while holding locked database files
1730         https://bugs.webkit.org/show_bug.cgi?id=196519
1731         <rdar://problem/49531797>
1732
1733         Reviewed by Chris Dumez.
1734
1735         * Shared/WebSQLiteDatabaseTracker.cpp:
1736         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
1737         * Shared/WebSQLiteDatabaseTracker.h:
1738         * WebProcess/WebProcess.cpp:
1739         (WebKit::m_webSQLiteDatabaseTracker):
1740         (WebKit::WebProcess::actualPrepareToSuspend):
1741         (WebKit::WebProcess::processWillSuspendImminently):
1742         (WebKit::WebProcess::cancelPrepareToSuspend):
1743         (WebKit::WebProcess::processDidResume):
1744         * WebProcess/WebProcess.h:
1745
1746 2019-04-05  Commit Queue  <commit-queue@webkit.org>
1747
1748         Unreviewed, rolling out r243833.
1749         https://bugs.webkit.org/show_bug.cgi?id=196645
1750
1751         This change breaks build of WPE and GTK ports (Requested by
1752         annulen on #webkit).
1753
1754         Reverted changeset:
1755
1756         "[CMake][WTF] Mirror XCode header directories"
1757         https://bugs.webkit.org/show_bug.cgi?id=191662
1758         https://trac.webkit.org/changeset/243833
1759
1760 2019-04-05  David Kilzer  <ddkilzer@apple.com>
1761
1762         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
1763         <https://bugs.webkit.org/show_bug.cgi?id=193951>
1764         <rdar://problem/47621366>
1765
1766         Fixes the following build warnings:
1767             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1768             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1769             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1770
1771         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
1772         _WKInspectorWindow.h.  In r240685, a second Headers entry was
1773         added, but the first one was never removed.
1774
1775 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1776
1777         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
1778         https://bugs.webkit.org/show_bug.cgi?id=196593
1779         <rdar://problem/49599153>
1780
1781         Reviewed by Michael Catanzaro.
1782
1783         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1784         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
1785
1786 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1787
1788         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
1789         https://bugs.webkit.org/show_bug.cgi?id=196635
1790
1791         Reviewed by Antti Koivisto.
1792
1793         Remove WKBundleSetAsyncFrameScrollingEnabled().
1794
1795         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1796         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
1797         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1798
1799 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1800
1801         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
1802         https://bugs.webkit.org/show_bug.cgi?id=195584
1803
1804         Reviewed by Zalan Bujtas.
1805
1806         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
1807         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
1808         just as we do for frames.
1809
1810         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
1811
1812         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
1813         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
1814         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
1815         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
1816
1817         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
1818         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
1819         already been put in the right locations, but the UI process needs to know that a scroll happened).
1820         However, we need to prevent notifications from programmatic scrolls getting back to the
1821         web process, because this causes jumpiness. This is done via an early return in
1822         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
1823
1824         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1825         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1826         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1827         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
1828         a delegate, and that will take care of the requestedScrollPosition update.
1829         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1830         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1831         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
1832         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1833         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1834
1835 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
1836
1837         Unreviewed, rolling out r243888.
1838
1839         Introduced layout test crashes.
1840
1841         Reverted changeset:
1842
1843         "[macOS][iOS] Add filter to syscall sandbox rule"
1844         https://bugs.webkit.org/show_bug.cgi?id=196613
1845         https://trac.webkit.org/changeset/243888
1846
1847 2019-04-04  Youenn Fablet  <youenn@apple.com>
1848
1849         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
1850         https://bugs.webkit.org/show_bug.cgi?id=196543
1851
1852         Reviewed by Alex Christensen.
1853
1854         Renamed methods used to set cache storage quota to be storage generic
1855         since they will apply to all storage.
1856
1857         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
1858         to NetworkProcess (start-up time and new WebsiteDataStore time).
1859
1860         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
1861
1862         * NetworkProcess/NetworkProcess.cpp:
1863         (WebKit::NetworkProcess::initializeNetworkProcess):
1864         (WebKit::NetworkProcess::addWebsiteDataStore):
1865         (WebKit::NetworkProcess::initializeStorageQuota):
1866         (WebKit::NetworkProcess::setCacheStorageParameters):
1867         * NetworkProcess/NetworkProcess.h:
1868         * NetworkProcess/NetworkProcess.messages.in:
1869         * Shared/WebsiteDataStoreParameters.cpp:
1870         (WebKit::WebsiteDataStoreParameters::encode const):
1871         (WebKit::WebsiteDataStoreParameters::decode):
1872         * Shared/WebsiteDataStoreParameters.h:
1873         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1874         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1875         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
1876         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1877         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1878         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1879         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1880         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
1881         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
1882         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1883         * UIProcess/Network/NetworkProcessProxy.cpp:
1884         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
1885         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1886         (WebKit::WebsiteDataStore::parameters):
1887         * UIProcess/WebsiteData/WebsiteDataStore.h:
1888         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
1889         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
1890         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
1891         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
1892         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1893         (WebKit::WebsiteDataStoreConfiguration::copy):
1894         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1895         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
1896         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
1897         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
1898         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
1899
1900 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1901
1902         Changing default website policies shouldn't change default website policies in subsequent navigations
1903         https://bugs.webkit.org/show_bug.cgi?id=196562
1904         <rdar://problem/49573377>
1905
1906         Reviewed by Tim Horton.
1907
1908         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
1909         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
1910         a modified version of the default website policies into the decision handler without impacting future
1911         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
1912         of the default website policies to the navigation delegate when deciding navigation policies.
1913
1914         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
1915
1916         * UIProcess/API/APIWebsitePolicies.cpp:
1917         (API::WebsitePolicies::copy const):
1918
1919         Add a helper method to copy a set of website policies.
1920
1921         * UIProcess/API/APIWebsitePolicies.h:
1922         * UIProcess/Cocoa/NavigationState.mm:
1923         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1924
1925 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1926
1927         Unreviewed, fix -Wreturn-type warning
1928
1929         * Shared/WebsiteData/WebsiteData.cpp:
1930         (WebKit::WebsiteData::ownerProcess):
1931
1932 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1933
1934         [macOS] Fix sandbox violations
1935         https://bugs.webkit.org/show_bug.cgi?id=196616
1936         <rdar://problem/49498040>
1937
1938         Reviewed by Brent Fulgham.
1939
1940         Fix some observed sandbox violations in the WebContent process on macOS.
1941
1942         * WebProcess/com.apple.WebProcess.sb.in:
1943
1944 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
1945
1946         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
1947         https://bugs.webkit.org/show_bug.cgi?id=196555
1948         <rdar://problem/47303865>
1949
1950         Reviewed by Youenn Fablet.
1951
1952         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
1953
1954         * UIProcess/API/Cocoa/WKWebView.mm:
1955         (-[WKWebView _setPageMuted:]):
1956         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
1957         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
1958         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1959
1960         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1961         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
1962         a log comment typo.
1963
1964         * UIProcess/WebPageProxy.cpp:
1965         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
1966         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
1967         (WebKit::WebPageProxy::setMuted): Ditto.
1968         * UIProcess/WebPageProxy.h:
1969         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
1970
1971 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1972
1973         [macOS][iOS] Add filter to syscall sandbox rule
1974         https://bugs.webkit.org/show_bug.cgi?id=196613
1975         <rdar://problem/49531420>
1976
1977         Reviewed by Brent Fulgham.
1978
1979         This will restrict the existing sandbox rule for the syscall.
1980
1981         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1982         * WebProcess/com.apple.WebProcess.sb.in:
1983
1984 2019-04-04  Youenn Fablet  <youenn@apple.com>
1985
1986         Service Worker Process does not have the right domain name
1987         https://bugs.webkit.org/show_bug.cgi?id=196585
1988
1989         Reviewed by Chris Dumez.
1990
1991         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
1992         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1993         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
1994
1995 2019-04-04  Chris Dumez  <cdumez@apple.com>
1996
1997         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
1998         https://bugs.webkit.org/show_bug.cgi?id=196604
1999         <rdar://problem/49074131>
2000
2001         Reviewed by Geoffrey Garen.
2002
2003         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
2004         is while I figure out how to enable this on iOS without regressed PLT.
2005
2006         * UIProcess/WebProcessPool.h:
2007
2008 2019-04-04  Miguel Gomez  <magomez@igalia.com>
2009
2010         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
2011         https://bugs.webkit.org/show_bug.cgi?id=188839
2012
2013         Reviewed by Žan Doberšek.
2014
2015         Even if a platform layer has changed, don't wait for a main thread callback to finish the
2016         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
2017
2018         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2019         (WebKit::CompositingRunLoop::scheduleUpdate):
2020         (WebKit::CompositingRunLoop::stopUpdates):
2021         (WebKit::CompositingRunLoop::updateCompleted):
2022         (WebKit::CompositingRunLoop::updateTimerFired):
2023         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
2024         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2025         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2026         (WebKit::ThreadedCompositor::renderLayerTree):
2027         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2028         (WebKit::ThreadedCompositor::displayRefreshMonitor):
2029         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
2030         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2031         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2032         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
2033
2034 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2035
2036         [ATK] Cleanup WebPageAccessibilityObjectAtk
2037         https://bugs.webkit.org/show_bug.cgi?id=196537
2038
2039         Reviewed by Michael Catanzaro.
2040
2041         Several changes and cleanups:
2042
2043          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
2044          - Rename the header to remove the Atk prefix to match the cpp file and class name.
2045          - Use pragma once.
2046          - Use nullptr instead of 0.
2047          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
2048          - Return generic AtkObject* from constructor.
2049
2050         * SourcesGTK.txt:
2051         * WebProcess/WebPage/WebPage.h:
2052         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
2053         (accessibilityRootObjectWrapper):
2054         (webkitWebPageAccessibilityObjectInitialize):
2055         (webkitWebPageAccessibilityObjectGetIndexInParent):
2056         (webkitWebPageAccessibilityObjectGetNChildren):
2057         (webkitWebPageAccessibilityObjectRefChild):
2058         (webkit_web_page_accessibility_object_class_init):
2059         (webkitWebPageAccessibilityObjectNew):
2060         (webkitWebPageAccessibilityObjectRefresh):
2061         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
2062         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
2063         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2064         (WebKit::WebPage::platformInitialize):
2065         (WebKit::WebPage::updateAccessibilityTree):
2066
2067 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2068
2069         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
2070         https://bugs.webkit.org/show_bug.cgi?id=196535
2071
2072         Reviewed by Michael Catanzaro.
2073
2074         This way the properties are not cached. Right now, if number of children is queried before the socket is
2075         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
2076
2077         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
2078         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
2079         * UIProcess/gtk/WebPageProxyGtk.cpp:
2080         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
2081
2082 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2083
2084         [ATK] Embed the AtkSocket as soon as we receive the plug ID
2085         https://bugs.webkit.org/show_bug.cgi?id=196534
2086
2087         Reviewed by Michael Catanzaro.
2088
2089         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
2090         can simply embed the socket when the plug ID is received.
2091
2092         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2093         (webkitWebViewBaseGetAccessible):
2094         * UIProcess/WebPageProxy.h:
2095         * UIProcess/gtk/WebPageProxyGtk.cpp:
2096         (WebKit::WebPageProxy::bindAccessibilityTree):
2097
2098 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2099
2100         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
2101         https://bugs.webkit.org/show_bug.cgi?id=193914
2102
2103         Reviewed by Michael Catanzaro.
2104
2105         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
2106         root accessibility object wrapper.
2107
2108         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2109         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2110         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2111
2112 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2113
2114         Simplify some "programmaticScroll" code paths
2115         https://bugs.webkit.org/show_bug.cgi?id=196589
2116
2117         Reviewed by Zalan Bujtas.
2118
2119         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
2120         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
2121         * WebProcess/WebPage/ios/WebPageIOS.mm:
2122         (WebKit::WebPage::updateVisibleContentRects):
2123
2124 2019-04-03  Chris Dumez  <cdumez@apple.com>
2125
2126         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
2127         https://bugs.webkit.org/show_bug.cgi?id=196588
2128         <rdar://problem/49365787>
2129
2130         Reviewed by Ryosuke Niwa.
2131
2132         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
2133         This can lead to returning stale frames to the client if it asks for those.
2134
2135         * UIProcess/WebPageProxy.cpp:
2136         (WebKit::WebPageProxy::resetState):
2137
2138 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2139
2140         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
2141         https://bugs.webkit.org/show_bug.cgi?id=196587
2142
2143         Reviewed by Zalan Bujtas.
2144
2145         This argument was unused.
2146
2147         * UIProcess/API/gtk/PageClientImpl.cpp:
2148         (WebKit::PageClientImpl::requestScroll):
2149         * UIProcess/API/gtk/PageClientImpl.h:
2150         * UIProcess/API/wpe/PageClientImpl.cpp:
2151         (WebKit::PageClientImpl::requestScroll):
2152         * UIProcess/API/wpe/PageClientImpl.h:
2153         * UIProcess/PageClient.h:
2154         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2155         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2156         * UIProcess/WebPageProxy.cpp:
2157         (WebKit::WebPageProxy::requestScroll):
2158         * UIProcess/WebPageProxy.h:
2159         * UIProcess/ios/PageClientImplIOS.h:
2160         * UIProcess/ios/PageClientImplIOS.mm:
2161         (WebKit::PageClientImpl::requestScroll):
2162         * UIProcess/mac/PageClientImplMac.h:
2163         * UIProcess/mac/PageClientImplMac.mm:
2164         (WebKit::PageClientImpl::requestScroll):
2165         * UIProcess/win/PageClientImpl.cpp:
2166         (WebKit::PageClientImpl::requestScroll):
2167         * UIProcess/win/PageClientImpl.h:
2168
2169 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2170
2171         -apple-trailing-word is needed for browser detection
2172         https://bugs.webkit.org/show_bug.cgi?id=196575
2173
2174         Unreviewed.
2175
2176         * Configurations/FeatureDefines.xcconfig:
2177
2178 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2179
2180         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2181         https://bugs.webkit.org/show_bug.cgi?id=196526
2182         <rdar://problem/49532923>
2183
2184         Reviewed by Tim Horton.
2185
2186         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
2187         enabled for all apps on the system.
2188
2189         * Shared/WebPreferences.yaml:
2190
2191 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2192
2193         Fix internal build after r243829
2194         https://bugs.webkit.org/show_bug.cgi?id=196549
2195
2196         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2197         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2198         Some SDK's don't include this selector in the header.
2199         Use NSSelectorFromString.
2200
2201 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
2202
2203         [CMake][WTF] Mirror XCode header directories
2204         https://bugs.webkit.org/show_bug.cgi?id=191662
2205
2206         Reviewed by Konstantin Tokarev.
2207
2208         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
2209         builds.
2210
2211         * CMakeLists.txt:
2212
2213 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2214
2215         Add SPI to disable legacy TLS fallback
2216         https://bugs.webkit.org/show_bug.cgi?id=196549
2217         <rdar://44979744>
2218
2219         Reviewed by Geoffrey Garen.
2220
2221         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2222         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2223         (WebKit::NetworkSessionCreationParameters::encode const):
2224         (WebKit::NetworkSessionCreationParameters::decode):
2225         * NetworkProcess/NetworkSessionCreationParameters.h:
2226         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2227         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2228         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2229         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
2230         (-[WKWebsiteDataStore _allowsTLSFallback]):
2231         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2232         * UIProcess/WebProcessPool.cpp:
2233         (WebKit::WebProcessPool::ensureNetworkProcess):
2234         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2235         (WebKit::WebsiteDataStore::parameters):
2236         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2237         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
2238         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
2239         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
2240         * UIProcess/WebsiteData/WebsiteDataStore.h:
2241         (WebKit::WebsiteDataStore::allowsTLSFallback const):
2242         (WebKit::WebsiteDataStore::networkingHasBegun):
2243         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
2244
2245 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2246
2247         Remove support for -apple-trailing-word
2248         https://bugs.webkit.org/show_bug.cgi?id=196525
2249
2250         Reviewed by Zalan Bujtas.
2251
2252         This CSS property is nonstandard and not used.
2253
2254         * Configurations/FeatureDefines.xcconfig:
2255
2256 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2257
2258         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
2259         https://bugs.webkit.org/show_bug.cgi?id=196476
2260
2261         Reviewed by Chris Dumez.
2262
2263         Re-apply a change I reverted in r241754 now that it's safe to do so.
2264
2265         * UIProcess/WebPageProxy.cpp:
2266         (WebKit::WebPageProxy::didCommitLoadForFrame):
2267
2268 2019-04-03  Daniel Bates  <dabates@apple.com>
2269
2270         [iOS] Should be able to dismiss picker or popover using the keyboard
2271         https://bugs.webkit.org/show_bug.cgi?id=196272
2272         <rdar://problem/48943170>
2273
2274         Reviewed by Wenson Hsieh.
2275
2276         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
2277         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
2278         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
2279
2280         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
2281         * UIProcess/ios/WKContentViewInteraction.mm:
2282         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
2283         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
2284         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
2285         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
2286         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
2287         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
2288         do not resign first responder status as the page activation state should not be changed.
2289         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2290         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
2291         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
2292         respectively. If the input peripheral does not handle it then do what we do now.
2293         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2294         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
2295         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
2296         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
2297         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
2298         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
2299         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
2300         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
2301         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
2302         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
2303         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
2304         we are always editable because it is not possible to perform a selection operation when we have a popover open.
2305         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
2306         * UIProcess/ios/forms/WKFormColorControl.h:
2307         * UIProcess/ios/forms/WKFormColorControl.mm:
2308         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
2309         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
2310         (-[WKFormColorControl assistantView]): Deleted.
2311         (-[WKFormColorControl beginEditing]): Deleted.
2312         (-[WKFormColorControl endEditing]): Deleted.
2313         * UIProcess/ios/forms/WKFormInputControl.h:
2314         * UIProcess/ios/forms/WKFormInputControl.mm:
2315         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
2316         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
2317         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
2318         (-[WKFormInputControl beginEditing]): Deleted.
2319         (-[WKFormInputControl endEditing]): Deleted.
2320         (-[WKFormInputControl assistantView]): Deleted.
2321         * UIProcess/ios/forms/WKFormPeripheral.h:
2322         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
2323         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
2324         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
2325         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
2326         (-[WKFormPeripheralBase endEditing]): Ditto.
2327         (-[WKFormPeripheralBase assistantView]): Ditto.
2328         (-[WKFormPeripheralBase control]): Return the control.
2329         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
2330         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
2331         Command + .).
2332         * UIProcess/ios/forms/WKFormSelectControl.h:
2333         * UIProcess/ios/forms/WKFormSelectControl.mm:
2334         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
2335         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
2336         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
2337         (-[WKFormSelectControl assistantView]): Deleted.
2338         (-[WKFormSelectControl beginEditing]): Deleted.
2339         (-[WKFormSelectControl endEditing]): Deleted.
2340         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2341         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
2342         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
2343
2344 2019-04-03  Youenn Fablet  <youenn@apple.com>
2345
2346         Resetting quota should take into account third party origins
2347         https://bugs.webkit.org/show_bug.cgi?id=196462
2348
2349         Reviewed by Geoffrey Garen.
2350
2351         When clearing the storage quota, we were resetting it to the default value
2352         without taking care of whether third party or not.
2353         Updated the code to ensure that the default quota is computed based on the origin.
2354
2355         Updated existing test to cover this case.
2356
2357         * NetworkProcess/NetworkProcess.cpp:
2358         (WebKit::NetworkProcess::clearStorageQuota):
2359         (WebKit::NetworkProcess::setCacheStorageParameters):
2360         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2361         (WebKit::NetworkProcess::storageQuotaManager):
2362         * NetworkProcess/NetworkProcess.h:
2363         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
2364         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
2365         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
2366
2367 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2368
2369         Get rid of HTMLInputElement::setEditingValue
2370         https://bugs.webkit.org/show_bug.cgi?id=196402
2371
2372         Reviewed by Darin Adler.
2373
2374         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
2375         (webkit_dom_element_html_input_element_set_editing_value):
2376         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2377         (webkit_dom_html_input_element_set_editing_value):
2378
2379 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2380
2381         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2382         https://bugs.webkit.org/show_bug.cgi?id=196526
2383         <rdar://problem/49532923>
2384
2385         Reviewed by Antoine Quint.
2386
2387         * Shared/WebPreferences.yaml:
2388
2389 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2390
2391         Introduce and add plumbing for a website policy for meta viewport tag handling
2392         https://bugs.webkit.org/show_bug.cgi?id=196285
2393
2394         Reviewed by Tim Horton.
2395
2396         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
2397         viewport tag and use native web page parameters instead of the default parameters.
2398
2399         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2400         * Shared/WebsitePoliciesData.cpp:
2401         (WebKit::WebsitePoliciesData::encode const):
2402         (WebKit::WebsitePoliciesData::decode):
2403         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2404
2405         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
2406
2407         * Shared/WebsitePoliciesData.h:
2408         * UIProcess/API/APIWebsitePolicies.cpp:
2409         (API::WebsitePolicies::data):
2410         * UIProcess/API/APIWebsitePolicies.h:
2411
2412         Add additional plumbing for the policy flag.
2413
2414         * WebKit.xcodeproj/project.pbxproj:
2415         * WebProcess/WebPage/ios/WebPageIOS.mm:
2416         (WebKit::WebPage::resetViewportDefaultConfiguration):
2417
2418         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
2419         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
2420
2421 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2422
2423         Add plumbing for a compatibility mode preference in WebKit
2424         https://bugs.webkit.org/show_bug.cgi?id=196005
2425
2426         Reviewed by Tim Horton.
2427
2428         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
2429         (API::WebsitePolicies) for compatibility mode.
2430
2431         * Shared/WebCompatibilityMode.h: Added.
2432         * UIProcess/API/APIWebsitePolicies.h:
2433         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2434         * UIProcess/Cocoa/NavigationState.mm:
2435         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2436         * UIProcess/WebPageProxy.cpp:
2437         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
2438         * UIProcess/WebPageProxy.h:
2439         * UIProcess/ios/WebPageProxyIOS.mm:
2440         * WebKit.xcodeproj/project.pbxproj:
2441
2442 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2443
2444         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
2445         https://bugs.webkit.org/show_bug.cgi?id=196487
2446
2447         Reviewed by Žan Doberšek.
2448
2449         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
2450         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
2451
2452         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2453         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
2454         synchronous update if needed.
2455
2456 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2457
2458         Web Inspector: [GTK] Copy copies to nowhere
2459         https://bugs.webkit.org/show_bug.cgi?id=181228
2460
2461         Reviewed by Michael Catanzaro.
2462
2463         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
2464         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
2465         the web process.
2466
2467         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2468         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
2469         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
2470         * UIProcess/gtk/WebContextMenuProxyGtk.h:
2471
2472 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2473
2474         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
2475         https://bugs.webkit.org/show_bug.cgi?id=196284
2476         <rdar://problem/47228232>
2477
2478         Reviewed by Tim Horton.
2479
2480         Tests for both of these APIs will be added in a subsequent patch.
2481
2482         * Shared/API/Cocoa/WebKit.h:
2483         * UIProcess/API/APIPageConfiguration.cpp:
2484         (API::PageConfiguration::defaultWebsitePolicies const):
2485         (API::PageConfiguration::setDefaultWebsitePolicies):
2486         * UIProcess/API/APIPageConfiguration.h:
2487         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2488
2489         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
2490         navigation action.
2491
2492         * UIProcess/API/Cocoa/WKWebView.mm:
2493         (-[WKWebView _initializeWithConfiguration:]):
2494         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2495         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2496
2497         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
2498
2499         (-[WKWebViewConfiguration copyWithZone:]):
2500         (-[WKWebViewConfiguration defaultWebpagePreferences]):
2501         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
2502         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2503         * UIProcess/Cocoa/NavigationState.h:
2504         * UIProcess/Cocoa/NavigationState.mm:
2505         (WebKit::NavigationState::setNavigationDelegate):
2506         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2507
2508         Invoke the new WKWebpagePreferences-based navigation delegate method.
2509
2510         * WebKit.xcodeproj/project.pbxproj:
2511         * mac/postprocess-framework-headers.sh:
2512         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
2513
2514         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
2515         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
2516         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
2517
2518 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
2519
2520         Eliminate plugin sandbox exceptions
2521         https://bugs.webkit.org/show_bug.cgi?id=196510
2522
2523         Reviewed by Chris Dumez.
2524
2525         * PluginProcess/mac/PluginProcessMac.mm:
2526         (WebKit::PluginProcess::initializeSandbox):
2527         * UIProcess/Plugins/PluginInfoStore.cpp:
2528         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2529         * UIProcess/Plugins/PluginInfoStore.h:
2530         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2531         (WebKit::PluginInfoStore::shouldUsePlugin):
2532         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2533
2534 2019-04-02  Alex Christensen  <achristensen@webkit.org>
2535
2536         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
2537         https://bugs.webkit.org/show_bug.cgi?id=196503
2538
2539         Reviewed by Chris Dumez.
2540
2541         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
2542         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
2543         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
2544         have the process not send the message when it knows the navigation is continuing in another process.
2545         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
2546
2547         * UIProcess/WebPageProxy.cpp:
2548         (WebKit::WebPageProxy::didCommitLoadForFrame):
2549         * WebProcess/WebPage/WebFrame.cpp:
2550         (WebKit::WebFrame::didReceivePolicyDecision):
2551         (WebKit::WebFrame::documentLoaderDetached):
2552         * WebProcess/WebPage/WebFrame.h:
2553
2554 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
2555
2556         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
2557         https://bugs.webkit.org/show_bug.cgi?id=196500
2558         <rdar://problem/49497788>
2559
2560         Reviewed by Brent Fulgham.
2561
2562         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
2563         'artwork-scale-factor' is causing sandbox violations.
2564
2565         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2566
2567 2019-04-02  Chris Dumez  <cdumez@apple.com>
2568
2569         [WK2] Add support for Window's beforeprint / afterprint events
2570         https://bugs.webkit.org/show_bug.cgi?id=196478
2571
2572         Reviewed by Alex Christensen.
2573
2574         Add support for Window's beforeprint / afterprint events as per:
2575         - https://html.spec.whatwg.org/#dom-print
2576
2577         Blink and Gecko already support this.
2578
2579         * WebProcess/WebPage/WebPage.cpp:
2580         (WebKit::WebPage::beginPrinting):
2581         (WebKit::WebPage::endPrinting):
2582
2583 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2584
2585         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
2586         https://bugs.webkit.org/show_bug.cgi?id=196496
2587         <rdar://problem/49521634>
2588
2589         Reviewed by Chris Dumez.
2590
2591         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
2592         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
2593         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
2594         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
2595         Objective-C object (which is now WKWebpagePreferences, after my change).
2596
2597         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
2598         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
2599         handler.
2600
2601         Tests:  WebKit.WebsitePoliciesWithBridgingCast
2602                 WebKit.WebsitePoliciesWithUnexpectedType
2603
2604         * UIProcess/Cocoa/NavigationState.mm:
2605         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2606
2607 2019-04-01  Chris Dumez  <cdumez@apple.com>
2608
2609         Unreviewed, drop debug logging landed as part of r242903 by mistake.
2610
2611         * UIProcess/WebPageProxy.cpp:
2612         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2613
2614 2019-04-01  Remy Demarest  <rdemarest@apple.com>
2615
2616         Add SPI to give injected bundles access to displayed PDFDocuments
2617         https://bugs.webkit.org/show_bug.cgi?id=196471
2618         <rdar://problem/48080768>
2619
2620         Reviewed by Tim Horton.
2621
2622         * WebKit.xcodeproj/project.pbxproj:
2623
2624         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
2625         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
2626         (WKBundlePageGetPDFDocumentInFrame):
2627
2628 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2629
2630         [WebKit2] Introduce a public version of WKWebsitePolicies
2631         https://bugs.webkit.org/show_bug.cgi?id=195989
2632         <rdar://problem/47228232>
2633
2634         Reviewed by Tim Horton.
2635
2636         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
2637         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
2638         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
2639         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
2640
2641         No change in behavior.
2642
2643         * Shared/Cocoa/APIObject.mm:
2644         (API::Object::newObject):
2645
2646         Wrap API::WebsitePolicies with WKWebpagePreferences.
2647
2648         * SourcesCocoa.txt:
2649         * UIProcess/API/Cocoa/WKWebView.mm:
2650         (-[WKWebView _updateWebsitePolicies:]):
2651         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2652         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
2653
2654         Introduce WKWebpagePreferences.
2655
2656         (+[WKWebpagePreferences defaultPreferences]):
2657         (-[WKWebpagePreferences dealloc]):
2658         (-[WKWebpagePreferences init]):
2659         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
2660         (-[WKWebpagePreferences _contentBlockersEnabled]):
2661         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
2662         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
2663         (-[WKWebpagePreferences _setAutoplayPolicy:]):
2664         (-[WKWebpagePreferences _autoplayPolicy]):
2665         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2666         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2667         (-[WKWebpagePreferences _setPopUpPolicy:]):
2668         (-[WKWebpagePreferences _popUpPolicy]):
2669         (-[WKWebpagePreferences _customHeaderFields]):
2670         (-[WKWebpagePreferences _setCustomHeaderFields:]):
2671         (-[WKWebpagePreferences _websiteDataStore]):
2672         (-[WKWebpagePreferences _setWebsiteDataStore:]):
2673         (-[WKWebpagePreferences _setCustomUserAgent:]):
2674         (-[WKWebpagePreferences _customUserAgent]):
2675         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2676         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
2677         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
2678         (-[WKWebpagePreferences _customNavigatorPlatform]):
2679         (-[WKWebpagePreferences _apiObject]):
2680         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2681         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
2682
2683         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
2684         WKWebpagePreferences.
2685
2686         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2687         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2688
2689         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
2690         WKWebpagePreferences.
2691
2692         (-[_WKWebsitePolicies init]):
2693         (-[_WKWebsitePolicies webpagePreferences]):
2694         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
2695         (-[_WKWebsitePolicies contentBlockersEnabled]):
2696         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2697         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2698         (-[_WKWebsitePolicies setAutoplayPolicy:]):
2699         (-[_WKWebsitePolicies autoplayPolicy]):
2700         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
2701         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
2702         (-[_WKWebsitePolicies setPopUpPolicy:]):
2703         (-[_WKWebsitePolicies popUpPolicy]):
2704         (-[_WKWebsitePolicies customHeaderFields]):
2705         (-[_WKWebsitePolicies setCustomHeaderFields:]):
2706         (-[_WKWebsitePolicies websiteDataStore]):
2707         (-[_WKWebsitePolicies setWebsiteDataStore:]):
2708         (-[_WKWebsitePolicies setCustomUserAgent:]):
2709         (-[_WKWebsitePolicies customUserAgent]):
2710         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2711         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
2712         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2713         (-[_WKWebsitePolicies customNavigatorPlatform]):
2714         (-[_WKWebsitePolicies description]):
2715         (-[_WKWebsitePolicies _apiObject]):
2716         (-[_WKWebsitePolicies dealloc]): Deleted.
2717         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
2718         * UIProcess/Cocoa/NavigationState.mm:
2719         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2720         * WebKit.xcodeproj/project.pbxproj:
2721
2722 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2723
2724         Unable to copy and paste a PDF from Notes into Mail compose body
2725         https://bugs.webkit.org/show_bug.cgi?id=196442
2726         <rdar://problem/48573098>
2727
2728         Reviewed by Tim Horton.
2729
2730         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
2731         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
2732         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
2733
2734         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
2735
2736         * UIProcess/ios/WKContentViewInteraction.mm:
2737         (-[WKContentView canPerformActionForWebView:withSender:]):
2738
2739 2019-04-01  Tim Horton  <timothy_horton@apple.com>
2740
2741         Make UIWKDocumentContext rects per-character instead of per-word
2742         https://bugs.webkit.org/show_bug.cgi?id=196459
2743
2744         Reviewed by Wenson Hsieh.
2745
2746         * WebProcess/WebPage/ios/WebPageIOS.mm:
2747         (WebKit::WebPage::requestDocumentEditingContext):
2748         Switch to CharacterIterator instead of TextIterator directly, to get
2749         per-character rects as the API requests.
2750
2751 2019-04-01  Chris Dumez  <cdumez@apple.com>
2752
2753         UIProcess crash when a prewarmed process is terminated
2754         https://bugs.webkit.org/show_bug.cgi?id=196451
2755         <rdar://problem/49245471>
2756
2757         Reviewed by Geoffrey Garen.
2758
2759         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
2760         true after r243384. For example, prewarmed WebContent processe do not get a data store
2761         until they actually get used.
2762
2763         * UIProcess/API/Cocoa/WKProcessPool.mm:
2764         (-[WKProcessPool _prewarmedProcessIdentifier]):
2765         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2766         * UIProcess/WebProcessPool.cpp:
2767         (WebKit::WebProcessPool::networkProcessIdentifier):
2768         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
2769         * UIProcess/WebProcessPool.h:
2770         * UIProcess/WebProcessProxy.cpp:
2771         (WebKit::WebProcessProxy::didClose):
2772         (WebKit::WebProcessProxy::didFinishLaunching):
2773         (WebKit::WebProcessProxy::requestTermination):
2774         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
2775         * UIProcess/WebProcessProxy.h:
2776
2777 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2778
2779         [GTK][WPE] Add more websitedatastore directories to web process sandbox
2780         https://bugs.webkit.org/show_bug.cgi?id=196447
2781
2782         Reviewed by Michael Catanzaro.
2783
2784         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2785         (WebKit::bubblewrapSpawn):
2786         * UIProcess/glib/WebProcessProxyGLib.cpp:
2787         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2788
2789 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
2790
2791         [macOS] Crash when loading Twitter with autoplay video enabled.
2792         https://bugs.webkit.org/show_bug.cgi?id=196446
2793         <rdar://problem/49060359>
2794
2795         Reviewed by Brent Fulgham.
2796
2797         This is caused by a syscall violation.
2798
2799         * WebProcess/com.apple.WebProcess.sb.in:
2800
2801 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2802
2803         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
2804         https://bugs.webkit.org/show_bug.cgi?id=196297
2805
2806         Reviewed by Michael Catanzaro.
2807
2808         More information can be found here: https://www.exploit-db.com/exploits/46594
2809
2810         Note that this sandbox never made it into production so does not
2811         warrant any CVE specific to WebKit.
2812
2813         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2814         (WebKit::setupSeccomp):
2815
2816 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2817
2818         [iOS] Crash when changing inputmode for certain types of focusable elements
2819         https://bugs.webkit.org/show_bug.cgi?id=196431
2820         <rdar://problem/49454962>
2821
2822         Reviewed by Tim Horton.
2823
2824         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
2825         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
2826         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
2827         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
2828         focused element doesn't fall into one of the aforementioned categories.
2829
2830         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
2831         element. See below for more details.
2832
2833         Test: fast/forms/change-inputmode-crash.html
2834
2835         * WebProcess/WebPage/WebPage.cpp:
2836         (WebKit::isTextFormControlOrEditableContent):
2837
2838         Clean up some existing logic by introducing a helper method for determining whether an element should
2839         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
2840         of checking against the tag name.
2841
2842         (WebKit::WebPage::elementDidFocus):
2843         (WebKit::WebPage::focusedElementDidChangeInputMode):
2844
2845 2019-03-31  Sam Weinig  <weinig@apple.com>
2846
2847         Remove more i386 specific configurations
2848         https://bugs.webkit.org/show_bug.cgi?id=196430
2849
2850         Reviewed by Alexey Proskuryakov.
2851
2852         * Configurations/BaseTarget.xcconfig:
2853         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
2854  
2855         * Configurations/FeatureDefines.xcconfig:
2856         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
2857
2858 2019-03-31  Andy Estes  <aestes@apple.com>
2859
2860         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
2861         https://bugs.webkit.org/show_bug.cgi?id=196433
2862         <rdar://problem/49293305>
2863
2864         Reviewed by Tim Horton.
2865
2866         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
2867         decision behavior. The configuration setting defaults to YES for clients linked on or after
2868         this WebKit change and NO otherwise.
2869
2870         * NetworkProcess/NetworkResourceLoader.cpp:
2871         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2872         * Shared/WebPreferences.yaml:
2873         * Shared/ios/QuickLookDocumentData.cpp:
2874         (WebKit::QuickLookDocumentData::isEmpty const):
2875         * Shared/ios/QuickLookDocumentData.h:
2876         * UIProcess/API/Cocoa/WKWebView.mm:
2877         (-[WKWebView _initializeWithConfiguration:]):
2878         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2879         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
2880         (-[WKWebViewConfiguration init]):
2881         (-[WKWebViewConfiguration encodeWithCoder:]):
2882         (-[WKWebViewConfiguration initWithCoder:]):
2883         (-[WKWebViewConfiguration copyWithZone:]):
2884         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
2885         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
2886         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2887         * UIProcess/Cocoa/VersionChecks.h:
2888         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
2889         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
2890
2891 2019-03-30  Zalan Bujtas  <zalan@apple.com>
2892
2893         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
2894         https://bugs.webkit.org/show_bug.cgi?id=196408
2895         <rdar://problem/49436797>
2896
2897         Reviewed by Simon Fraser.
2898
2899         Hover intent fails when an unrelated frame commits a load the same time.
2900         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
2901         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
2902
2903         * WebProcess/WebPage/ios/WebPageIOS.mm:
2904         (WebKit::WebPage::cancelPotentialTap):
2905         (WebKit::WebPage::cancelPotentialTapInFrame):
2906
2907 2019-03-29  John Wilander  <wilander@apple.com>
2908
2909         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
2910         https://bugs.webkit.org/show_bug.cgi?id=196407
2911         <rdar://problem/47859936>
2912
2913         Reviewed by Brent Fulgham.
2914
2915         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
2916         moved Resource Load Statistics from the UI process to the network process. One
2917         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
2918         our compatibility fix for federated logins using popups. This patch redirects
2919         these IPC calls to the network process and cleans up some assumptions around
2920         them.
2921
2922         * CMakeLists.txt:
2923             Removed the old IPC receiver.
2924         * DerivedSources.make:
2925             Removed the old IPC receiver.
2926         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2927         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
2928             This is no longer needed since there is a dedicated update mechanism
2929             that actually sends the update.
2930         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2931         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2932         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
2933         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
2934             Two new IPC receivers to pipe the calls to the network process.
2935         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
2936             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
2937             this purpose.
2938         * NetworkProcess/NetworkConnectionToWebProcess.h:
2939         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2940         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
2941             Removed the old IPC receiver.
2942         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2943         * WebKit.xcodeproj/project.pbxproj:
2944         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2945         (WKBundleResourceLoadStatisticsNotifyObserver):
2946             Function name update.
2947         * WebProcess/WebProcess.cpp:
2948             Now calls IPC to the network process instead of the UI process.
2949
2950 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
2951
2952         Delete WebMetal implementation in favor of WebGPU
2953         https://bugs.webkit.org/show_bug.cgi?id=195418
2954
2955         Reviewed by Dean Jackson.
2956
2957         * Configurations/FeatureDefines.xcconfig:
2958         * Shared/WebPreferences.yaml:
2959         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2960         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2961
2962 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
2963
2964         [Curl] Add Server Trust Evaluation Support.
2965         https://bugs.webkit.org/show_bug.cgi?id=191646
2966
2967         Reviewed by Fujii Hironori.
2968
2969         Tests: http/tests/ssl/iframe-upgrade.https.html
2970                http/tests/ssl/mixedContent/insecure-websocket.html
2971                http/tests/ssl/upgrade-origin-usage.html
2972
2973         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2974         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
2975         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
2976         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2977         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2978
2979 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
2980
2981         Implement ResizeObserver.
2982         https://bugs.webkit.org/show_bug.cgi?id=157743
2983
2984         Reviewed by Simon Fraser.
2985
2986         Add WebPreferences and FeatureDefines for ResizeObserver.
2987
2988         * Configurations/FeatureDefines.xcconfig:
2989         * Shared/WebPreferences.yaml:
2990
2991 2019-03-28  Timothy Hatcher  <timothy@apple.com>
2992
2993         CFDictionary encoder crashes on non-string keys.
2994         https://bugs.webkit.org/show_bug.cgi?id=196388
2995         rdar://problem/49339242
2996
2997         Reviewed by Ryosuke Niwa.
2998
2999         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
3000         size for dictionaries and arrays when unknown keys or values are skipped.
3001         Allow null array encoding and decoding like dictionary already allowed.
3002
3003         * Shared/cf/ArgumentCodersCF.cpp:
3004         (IPC::encode):
3005         (IPC::decode):
3006
3007 2019-03-28  John Wilander  <wilander@apple.com>
3008
3009         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
3010         https://bugs.webkit.org/show_bug.cgi?id=196281
3011         <rdar://problem/48938748>
3012
3013         Reviewed by Alex Christensen.
3014
3015         The move of Resource Load Statistics to the network process requires that it
3016         calls the UI process when clearing website data (previously the other way
3017         around). This patch achieves that.
3018
3019         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
3020         filters its WebsiteDataTypes down to just the ones applicable for the UI
3021         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
3022         IPC.
3023
3024         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
3025         the UI process side makes use of the re-introduced
3026         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
3027         data records and call WebsiteDataStore::removeData(). The re-introduced
3028         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
3029         https://trac.webkit.org/changeset/242056/webkit, then under the name
3030         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
3031         was dead code was the lack of IPC call that this patch adds.
3032
3033         * NetworkProcess/NetworkProcess.cpp:
3034         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3035            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
3036            are WebsiteDataTypes applicable to the UI process.
3037         * NetworkProcess/NetworkProcess.h:
3038         * Shared/WebsiteData/WebsiteData.cpp:
3039         (WebKit::WebsiteData::ownerProcess):
3040         (WebKit::WebsiteData::filter):
3041             Convenience functions to manage process ownership of website data types.
3042         * Shared/WebsiteData/WebsiteData.h:
3043         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3044         (WKWebsiteDataStoreStatisticsHasLocalStorage):
3045             Test infrastructure, called by the TestRunner.
3046         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3047         * UIProcess/Network/NetworkProcessProxy.cpp:
3048         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
3049             New function to be called from the network process.
3050         * UIProcess/Network/NetworkProcessProxy.h:
3051         * UIProcess/Network/NetworkProcessProxy.messages.in:
3052         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3053         (WebKit::WebsiteDataRecord::matches const):
3054             Now matches with WebCore::RegistrableDomain instead of a string.
3055         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
3056             Replaced by WebsiteDataRecord::matches().
3057         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3058         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3059         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
3060             Re-introduced. It was removed as dead code in r242056.
3061         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
3062         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
3063             Test infrastructure, called by the TestRunner.
3064         * UIProcess/WebsiteData/WebsiteDataStore.h:
3065
3066 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
3067
3068         API::Data::createWithoutCopying should do a null check before calling CFRelease
3069         https://bugs.webkit.org/show_bug.cgi?id=196276
3070         <rdar://problem/48059859>
3071
3072         Reviewed by Alex Christensen.
3073
3074         * Shared/Cocoa/APIDataCocoa.mm:
3075         (API::Data::createWithoutCopying):
3076
3077 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
3078
3079         [iOS] Automatic focus of input field is flaky
3080         https://bugs.webkit.org/show_bug.cgi?id=196302
3081
3082         Reviewed by Brent Fulgham.
3083
3084         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
3085         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
3086         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
3087         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
3088
3089         * Shared/WebPageCreationParameters.cpp:
3090         (WebKit::WebPageCreationParameters::encode const):
3091         (WebKit::WebPageCreationParameters::decode):
3092         * Shared/WebPageCreationParameters.h:
3093         * UIProcess/API/Cocoa/WKWebView.mm:
3094         (hardwareKeyboardAvailabilityChangedCallback):
3095         * UIProcess/WebPageProxy.cpp:
3096         (WebKit::WebPageProxy::creationParameters):
3097         * UIProcess/WebPageProxy.h:
3098         * UIProcess/WebProcessProxy.cpp:
3099         * UIProcess/WebProcessProxy.h:
3100         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
3101         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
3102         * UIProcess/ios/WKContentViewInteraction.mm:
3103         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3104         * UIProcess/ios/WebPageProxyIOS.mm:
3105         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
3106         (WebKit::WebPageProxy::applicationWillEnterForeground):
3107         * WebProcess/WebPage/WebPage.cpp:
3108         * WebProcess/WebPage/WebPage.h:
3109
3110 2019-03-28  Tim Horton  <timothy_horton@apple.com>
3111
3112         Fix the build.
3113
3114         * UIProcess/ios/WKActionSheetAssistant.mm:
3115         (-[WKActionSheetAssistant showImageSheet]):
3116         * UIProcess/ios/WKContentViewInteraction.mm:
3117         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3118
3119 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3120
3121         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
3122         https://bugs.webkit.org/show_bug.cgi?id=186276
3123
3124         Reviewed by Carlos Garcia Campos.
3125
3126         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
3127         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
3128         convention) that if an error parameter exists, it should be set whenever a function call
3129         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
3130         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
3131         array of length 1 containing a NUL character. This isn't great, but there's not really any
3132         better solution without deprecating the API or returning an error code to indicate an empty
3133         resource, and it at least fixes the Epiphany crash.
3134
3135         This does not fix bug #186276, in which this function incorrectly returns no data when it
3136         ought to. But that is a different bug. Now, at least we won't crash when no data is
3137         available.
3138
3139         * UIProcess/API/glib/WebKitWebResource.cpp:
3140         (resourceDataCallback):
3141
3142 2019-03-28  Daniel Bates  <dabates@apple.com>
3143
3144         [iPad] Tapping on a popup form control may not show a popover
3145         https://bugs.webkit.org/show_bug.cgi?id=196322
3146         <rdar://problem/49229632>
3147
3148         Reviewed by Wenson Hsieh.
3149
3150         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
3151         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
3152         needs to call -inputView when it actually needs to display the input view (the keyboard). For
3153         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
3154         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
3155
3156         * UIProcess/ios/WKContentViewInteraction.mm:
3157         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
3158         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
3159         end the input sessions and nullify the input peripheral before we tell the web process to switch
3160         focus as opposed to letting this happen after the web process tells us it focused a new element.
3161         (createInputPeripheralWithView): Added.
3162         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3163         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
3164         first responder because creating the peripheral has known side-effects: for popup buttons it
3165         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
3166         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
3167         for more details.
3168
3169 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
3170
3171         Silence lot of warnings when compiling with clang
3172         https://bugs.webkit.org/show_bug.cgi?id=196310
3173
3174         Reviewed by Michael Catanzaro.
3175
3176         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
3177         override clause.
3178         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
3179         missing override clause.
3180
3181 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
3182
3183         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
3184         https://bugs.webkit.org/show_bug.cgi?id=196336
3185
3186         Reviewed by Tim Horton.
3187
3188         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
3189         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
3190
3191         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
3192         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
3193         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
3194
3195         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
3196                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
3197
3198         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3199         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
3200         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
3201         (WebKit::WebPopupMenu::hide):
3202
3203 2019-03-27  Dean Jackson  <dino@apple.com>
3204
3205         [ARKit] Black view when opening a 3D model usdz file in new tab
3206         https://bugs.webkit.org/show_bug.cgi?id=196333
3207         <rdar://problem/47693367>
3208
3209         Reviewed by Tim Horton.
3210
3211         When opening a new WKSystemPreviewView, we were exiting if there was no
3212         presentingViewController. This code was unnecessary, and causing blank
3213         content when opening a new tab.
3214
3215         * UIProcess/ios/WKSystemPreviewView.mm:
3216         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
3217         Remove the code looking for a presentingViewController.
3218
3219 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3220
3221         Need a way to include WebKitAdditions code in WebKit API headers
3222         https://bugs.webkit.org/show_bug.cgi?id=196173
3223
3224         Reviewed by Tim Horton.
3225
3226         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
3227         using `#import`s of the form:
3228
3229         ```
3230         #if USE(APPLE_INTERNAL_SDK)
3231         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
3232         #endif
3233         ```
3234
3235         The resulting header in the built products directory will contain the contents of the imported file inserted in
3236         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
3237         the additions header content will be imported by the usual means.
3238
3239         * mac/postprocess-framework-headers.sh:
3240         * mac/replace-webkit-additions-includes.py: Added.
3241
3242         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
3243         with the text content of the additions files. The replacement script first searches in the built products
3244         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
3245         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
3246
3247         (read_content_from_webkit_additions):
3248         (main):
3249
3250 2019-03-27  Andy Estes  <aestes@apple.com>
3251
3252         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
3253         https://bugs.webkit.org/show_bug.cgi?id=196317
3254
3255         Reviewed by Dan Bernstein.
3256
3257         Removed some remnants of the Storage Process.
3258
3259         * Configurations/BaseTarget.xcconfig:
3260         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
3261         * WebKit.xcodeproj/project.pbxproj:
3262
3263 2019-03-27  Keith Rollin  <krollin@apple.com>
3264
3265         Include the CFNetworking task UUID to the NSError when a resource-load fails
3266         https://bugs.webkit.org/show_bug.cgi?id=196156
3267
3268         Reviewed by Alex Christensen.
3269
3270         In order to help track the connection between a failed resource-load
3271         and a user-visible error message, include the CFNetworking task UUID
3272         in the associated error as an element of the userInfo property. This
3273         can then be pulled out and reported in the logging at the point the
3274         error is reported to the user.
3275
3276         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3277         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3278
3279 2019-03-27  Chris Dumez  <cdumez@apple.com>
3280
3281         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
3282         https://bugs.webkit.org/show_bug.cgi?id=195425
3283         <rdar://problem/48682403>
3284
3285         Reviewed by Alex Christensen.
3286
3287         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
3288         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
3289         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
3290         still running so we could potentially try to use a process that's already exited.
3291
3292         * UIProcess/WebProcessPool.cpp:
3293         (WebKit::WebProcessPool::processForNavigationInternal):
3294
3295 2019-03-27  Zalan Bujtas  <zalan@apple.com>
3296
3297         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
3298         https://bugs.webkit.org/show_bug.cgi?id=196278
3299         <rdar://problem/49299968>
3300
3301         Reviewed by Simon Fraser.
3302
3303         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
3304
3305         * WebProcess/WebPage/ios/WebPageIOS.mm:
3306         (WebKit::dispatchSyntheticMouseMove):
3307         (WebKit::WebPage::handleSyntheticClick):
3308
3309 2019-03-27  Tim Horton  <timothy_horton@apple.com>
3310
3311         Fix some more deprecation warnings in WKDrawingView
3312         https://bugs.webkit.org/show_bug.cgi?id=196282
3313         <rdar://problem/47637608>
3314
3315         Reviewed by Wenson Hsieh.
3316
3317         * Platform/spi/ios/PencilKitSPI.h:
3318         * SourcesCocoa.txt:
3319         * UIProcess/ios/PencilKitSoftLink.h:
3320         * UIProcess/ios/PencilKitSoftLink.mm:
3321         * UIProcess/ios/WKContentViewInteraction.mm:
3322         * UIProcess/ios/WKDrawingCoordinator.h:
3323         * UIProcess/ios/WKDrawingCoordinator.mm:
3324         (-[WKDrawingCoordinator initWithContentView:]):
3325         (-[WKDrawingCoordinator currentInk]):
3326         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
3327         (-[WKDrawingCoordinator containingViewForInkPicker:]):
3328         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
3329         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
3330         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
3331         (-[WKDrawingCoordinator uninstallInkPicker]):
3332         (-[WKDrawingCoordinator inkPicker]): Deleted.
3333         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
3334         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
3335         * UIProcess/ios/WKDrawingView.mm:
3336         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
3337         * UIProcess/ios/WKInkPickerView.h: Removed.
3338         * UIProcess/ios/WKInkPickerView.mm: Removed.
3339         * WebKit.xcodeproj/project.pbxproj:
3340         Adopt the new names.
3341
3342 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3343
3344         Geolocation request not complete when watch request was started in a different web process
3345         https://bugs.webkit.org/show_bug.cgi?id=195996
3346
3347         Reviewed by Alex Christensen.
3348
3349         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
3350         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
3351         don't have a known position, the request will be completed when
3352         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
3353         processes.
3354
3355         * UIProcess/WebGeolocationManagerProxy.cpp:
3356         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
3357         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
3358         * UIProcess/WebGeolocationManagerProxy.h:
3359         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
3360         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
3361         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
3362
3363 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
3364
3365         [macOS] Correct kerberos-related sandbox violations
3366         https://bugs.webkit.org/show_bug.cgi?id=196279
3367         <rdar://problem/48622502>
3368
3369         Reviewed by Per Arne Vollan.
3370
3371         We need to allow communications with a Kerberos-related service on macOS
3372         until <rdar://problem/35542803> is fixed.
3373
3374         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3375
3376 2019-03-26  Chris Dumez  <cdumez@apple.com>
3377
3378         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
3379         https://bugs.webkit.org/show_bug.cgi?id=196277
3380         <rdar://problem/49127581>
3381
3382         Reviewed by Alex Christensen.
3383
3384         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
3385         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
3386         thread. Other auxiliary processes such as the NetworkProcess would end up calling
3387         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
3388         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
3389         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
3390         unreliable as demonstrated by the test app attached to the radar.
3391
3392         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
3393         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
3394         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
3395
3396         * Shared/AuxiliaryProcess.cpp:
3397         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
3398         (WebKit::AuxiliaryProcess::platformStopRunLoop):
3399         * Shared/ios/AuxiliaryProcessIOS.mm:
3400         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3401         * Shared/mac/AuxiliaryProcessMac.mm:
3402         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3403
3404 2019-03-26  Keith Rollin  <krollin@apple.com>
3405
3406         Inhibit CFNetwork logging in private sessions
3407         https://bugs.webkit.org/show_bug.cgi?id=196268
3408         <rdar://problem/48210793>
3409
3410         Reviewed by Alex Christensen.
3411
3412         Before performing any logging, the NetworkProcess checks to see if
3413         it's performing an operation associated with a private (ephemeral)
3414         browsing session. If so, it skips the logging. However, networking
3415         layers below the NetworkProcess don't know about private browsing, so
3416         they would still perform their own logging. CFNetwork now has a flag
3417         that lets us control that, so set it to False if private browsing.
3418
3419         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3420         (WebKit::configurationForSessionID):
3421
3422 2019-03-26  Chris Dumez  <cdumez@apple.com>
3423
3424         Add basic layout test coverage for File Picker on iOS
3425         https://bugs.webkit.org/show_bug.cgi?id=196265
3426
3427         Reviewed by Wenson Hsieh.
3428
3429         Add layout test infrastructure to test the file picker on iOS.
3430
3431         * UIProcess/API/Cocoa/WKWebView.mm:
3432         (-[WKWebView _dismissFilePicker]):
3433         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3434         * UIProcess/ios/WKContentViewInteraction.h:
3435         * UIProcess/ios/WKContentViewInteraction.mm:
3436         (-[WKContentView dismissFilePicker]):
3437         (-[WKContentView _contentsOfUserInterfaceItem:]):
3438         * UIProcess/ios/forms/WKFileUploadPanel.h:
3439         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3440         (-[WKFileUploadPanel currentAvailableActionTitles]):
3441
3442 2019-03-26  Daniel Bates  <dabates@apple.com>
3443
3444         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
3445         https://bugs.webkit.org/show_bug.cgi?id=196264
3446
3447         Reviewed by Wenson Hsieh.
3448
3449         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
3450         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
3451         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
3452         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
3453
3454         * UIProcess/ios/WKContentViewInteraction.mm:
3455         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
3456         List all the input types in the switch block and remove the default case to force the compiler to check that we
3457         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
3458         for future input types that we may add.
3459         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
3460         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
3461         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
3462         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
3463         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
3464         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
3465
3466 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3467
3468         Implement async paste method on UIWKInteractionViewProtocol
3469         https://bugs.webkit.org/show_bug.cgi?id=196267
3470         <rdar://problem/49236346>
3471
3472         Reviewed by Tim Horton.
3473
3474         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
3475         handler when pasting is finished.
3476
3477         Test: UIPasteboardTests.PasteWithCompletionHandler
3478
3479         * UIProcess/ios/WKContentViewInteraction.mm:
3480         (-[WKContentView pasteWithCompletionHandler:]):
3481
3482 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
3483
3484         [macOS] Fix sandbox violations
3485         https://bugs.webkit.org/show_bug.cgi?id=196262
3486         <rdar://problem/47738015>
3487
3488         Reviewed by Brent Fulgham.
3489
3490         Fix various observed sandbox violations.
3491
3492         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3493         * WebProcess/com.apple.WebProcess.sb.in:
3494
3495 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
3496
3497         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
3498         https://bugs.webkit.org/show_bug.cgi?id=195879
3499
3500         Reviewed by Carlos Garcia Campos.
3501
3502         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
3503         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
3504         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
3505
3506         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
3507         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
3508
3509         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3510         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
3511         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
3512         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
3513
3514 2019-03-26  Antoine Quint  <graouts@apple.com>
3515
3516         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
3517         https://bugs.webkit.org/show_bug.cgi?id=196254
3518         <rdar://problem/49124334>
3519
3520         Reviewed by Dean Jackson.
3521
3522         * Shared/WebPreferences.yaml:
3523
3524 2019-03-26  Philippe Normand  <pnormand@igalia.com>
3525
3526         [WPE][Qt] Uninitialized racy ViewBackend
3527         https://bugs.webkit.org/show_bug.cgi?id=196247
3528
3529         Reviewed by Carlos Garcia Campos.
3530
3531         * UIProcess/API/wpe/qt/WPEQtView.h: Initialize the backend pointer to nullptr.
3532
3533 2019-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
3534
3535         Unreviewed. Fix typo in GLib geolocation API after r243285.
3536
3537         gelocation -> geolocation.
3538
3539         * UIProcess/API/glib/WebKitGeolocationManager.cpp:
3540         (webkit_geolocation_manager_class_init):
3541         (webkit_geolocation_manager_update_position):
3542         (webkit_geolocation_manager_failed):
3543         (webkit_gelocation_manager_update_position): Deleted.
3544         (webkit_gelocation_manager_failed): Deleted.
3545         * UIProcess/API/gtk/WebKitGeolocationManager.h:
3546         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3547         * UIProcess/API/wpe/WebKitGeolocationManager.h:
3548         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3549
3550 2019-03-26  Patrick Griffis  <pgriffis@igalia.com>
3551
3552         [GTK][WPE] Disable process warming
3553         https://bugs.webkit.org/show_bug.cgi?id=196208
3554
3555         Reviewed by Chris Dumez.
3556
3557         Fixes crash caused by r243384.
3558
3559         Process warming is incompatible with our launcher as it expects a valid
3560         WebsiteDataStore at initialization time for sandbox permissions.
3561
3562         * UIProcess/glib/WebProcessPoolGLib.cpp:
3563         (WebKit::WebProcessPool::platformInitialize):
3564
3565 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3566
3567         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
3568         https://bugs.webkit.org/show_bug.cgi?id=196213
3569
3570         Reviewed by Geoff Garen.
3571
3572         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3573         with a SecIdentityRef wrapped in an NSCredential.
3574
3575         * Shared/cf/ArgumentCodersCF.cpp:
3576         (IPC::decode):
3577
3578 2019-03-25  Chris Dumez  <cdumez@apple.com>
3579
3580         Regression(r242369) Trying to change profile picture on linked in shows file picker, not the image picker
3581         https://bugs.webkit.org/show_bug.cgi?id=196205
3582         <rdar://problem/49083324>
3583
3584         Reviewed by Geoffrey Garen.
3585
3586         Update our FileUploadPanel code on iOS to properly deal with the MIME types containing
3587         wild cards (e.g. "image/*") that are defined in the HTML specification:
3588         - https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
3589
3590         Previously, we would fail to convert those to UTIs.
3591
3592         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3593
3594 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3595
3596         Remove some now-unnecessary dynamic class lookup
3597         https://bugs.webkit.org/show_bug.cgi?id=196237
3598
3599         Reviewed by Simon Fraser.
3600
3601         * Shared/DocumentEditingContext.mm:
3602         (WebKit::DocumentEditingContext::toPlatformContext):
3603
3604 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3605
3606         Get rid of ENABLE(ANIMATED_KEYBOARD_SCROLLING)
3607         https://bugs.webkit.org/show_bug.cgi?id=196224
3608
3609         Reviewed by Simon Fraser.
3610
3611         * Platform/spi/ios/AccessibilitySupportSPI.h:
3612         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3613         (-[WKKeyboardScrollingAnimator invalidate]):
3614         (perpendicularAbsoluteUnitVector):
3615         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3616         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3617         (-[WKKeyboardScrollingAnimator willStartInteractiveScroll]):
3618         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
3619         (-[WKKeyboardScrollViewAnimator scrollWithScrollToExtentAnimationTo:]):
3620         (-[WKKeyboardScrollingAnimator startRepeatTimerIfNeeded]): Deleted.
3621         (-[WKKeyboardScrollingAnimator stopRepeatTimer]): Deleted.
3622         (-[WKKeyboardScrollingAnimator performDiscreteScroll]): Deleted.
3623
3624 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3625
3626         Enable IPC sending and receiving non-default-constructible types
3627         https://bugs.webkit.org/show_bug.cgi?id=196132
3628         <rdar://problem/49229221>
3629
3630         Unreviewed build fix for WinCairo port.
3631
3632         error C2440: '=': cannot convert from 'int' to 'HANDLE'
3633
3634         * Platform/win/SharedMemoryWin.cpp:
3635         (WebKit::SharedMemory::Handle::Handle): std::exchange HANDLE with nullptr, not 0.
3636         (WebKit::SharedMemory::Handle::operator=): Ditto.
3637
3638 2019-03-25  Fujii Hironori  <Hironori.Fujii@sony.com>
3639
3640         [Coordinated Graphics][WinCairo] ASSERTION FAILED: state.id == m_nicosia.state.id
3641         https://bugs.webkit.org/show_bug.cgi?id=196190
3642
3643         Reviewed by Žan Doberšek.
3644
3645         This assertion assumes the pre-committed and the committed scenes
3646         are identical. But, the pre-committed scene is updated in the main
3647         thread. Removed the false assertion.
3648
3649         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3650         (WebKit::CoordinatedGraphicsScene::purgeGLResources): Remove the
3651         assertion. Removed layers of committed scene, not pre-committed
3652         scene.
3653
3654 2019-03-25  Brady Eidson  <beidson@apple.com>
3655
3656         Add socket-delegate to another entitlements config
3657         rdar://problem/48090350 and https://bugs.webkit.org/show_bug.cgi?id=196227
3658
3659         Reviewed by Geoffrey Garen.
3660
3661         * Configurations/Network-iOSMac.entitlements:
3662
3663 2019-03-25  Commit Queue  <commit-queue@webkit.org>
3664
3665         Unreviewed, rolling out r243465.
3666         https://bugs.webkit.org/show_bug.cgi?id=196226
3667
3668         the test doesn't build (Requested by thorton on #webkit).
3669
3670         Reverted changeset:
3671
3672         "Do not terminate the NetworkProcess if a third party
3673         application sends a NSCredential with a SecIdentityRef"
3674         https://bugs.webkit.org/show_bug.cgi?id=196213
3675         https://trac.webkit.org/changeset/243465
3676
3677 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3678
3679         REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
3680         https://bugs.webkit.org/show_bug.cgi?id=196126
3681         rdar://problem/49095791
3682
3683         Reviewed by Tim Horton.
3684         
3685         I fumbled the commit after the enum rename. Make this actually work.
3686
3687         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3688         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3689
3690 2019-03-25  Simon Fraser  <simon.fraser@apple.com>
3691
3692         Zoom on macOS is centered around a point lower than the cursor
3693         https://bugs.webkit.org/show_bug.cgi?id=196225
3694         rdar://problem/49213574
3695
3696         Reviewed by Tim Horton.
3697         
3698         The origin handed to ViewGestureController::handleMagnificationGestureEvent is in WKWebView
3699         coordinates, but we end up setting the transform on the RenderView's layer, so we need
3700         to subtract the topContentInset.
3701
3702         * UIProcess/mac/ViewGestureControllerMac.mm:
3703         (WebKit::ViewGestureController::handleMagnificationGestureEvent):
3704
3705 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3706
3707         Do not terminate the NetworkProcess if a third party application sends a NSCredential with a SecIdentityRef
3708         https://bugs.webkit.org/show_bug.cgi?id=196213
3709
3710         Reviewed by Geoff Garen.
3711
3712         A release assertion added in r230225 was reachable.  I reached it in a unit test that responds to a challenge
3713         with a SecIdentityRef wrapped in an NSCredential.
3714
3715         * Shared/cf/ArgumentCodersCF.cpp:
3716         (IPC::decode):
3717
3718 2019-03-25  Chris Dumez  <cdumez@apple.com>
3719
3720         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag
3721         https://bugs.webkit.org/show_bug.cgi?id=196210
3722         <rdar://problem/48681326>
3723
3724         Reviewed by Geoffrey Garen.
3725
3726         Get rid of WebPage::m_shouldResetDrawingAreaAfterSuspend flag and use the drawing area identifier
3727         instead to reset the DrawingArea in the WebProcess whenever the UIProcess did.
3728
3729         This is less error-prone and guarantees that the WebProcess and the UIProcess can reliably
3730         communicate via DrawingArea IPC.
3731
3732         * WebProcess/WebPage/WebPage.cpp:
3733         (WebKit::WebPage::reinitializeWebPage):
3734         (WebKit::WebPage::setIsSuspended):
3735         * WebProcess/WebPage/WebPage.h:
3736
3737 2019-03-25  Alex Christensen  <achristensen@webkit.org>
3738
3739         Enable IPC sending and receiving non-default-constructible types
3740         https://bugs.webkit.org/show_bug.cgi?id=196132
3741
3742         Reviewed by Geoff Garen.
3743
3744         * Platform/IPC/ArgumentCoder.h:
3745         * Platform/IPC/ArgumentCoders.h:
3746         (IPC::TupleEncoder::encode):
3747         (IPC::tupleFromTupleAndObject):
3748         (IPC::TupleDecoderImpl::decode):
3749         (IPC::TupleDecoderImpl<Type>::decode):
3750         (IPC::TupleDecoder::decode):
3751         (IPC::TupleDecoder<0>::decode):
3752         (IPC::TupleCoder::encode): Deleted.
3753         (IPC::TupleCoder::decode): Deleted.
3754         * Platform/IPC/Connection.h:
3755         (IPC::Connection::sendWithReply):
3756         (IPC::TupleMover::move):
3757         (IPC::moveTuple):
3758         (IPC::Connection::sendSync):
3759         * Platform/IPC/Decoder.h:
3760         (IPC::Decoder::decode):
3761         (IPC::Decoder::operator>>):
3762         * Platform/IPC/HandleMessage.h:
3763         (IPC::handleMessage):
3764         (IPC::handleMessageSynchronous):
3765         (IPC::handleMessageSynchronousWantsConnection):
3766         (IPC::handleMessageAsync):
3767         * Platform/SharedMemory.h:
3768         * Scripts/webkit/LegacyMessages-expected.h:
3769         * Scripts/webkit/Messages-expected.h:
3770         * Scripts/webkit/MessagesSuperclass-expected.h:
3771         * Scripts/webkit/messages.py:
3772         * Shared/Databases/IndexedDB/WebIDBResult.h:
3773         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3774         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3775         * Shared/ShareableBitmap.h:
3776         * Shared/ShareableResource.h:
3777         * Shared/UpdateInfo.h:
3778         * Shared/WebEvent.h:
3779         * Shared/WebProcessCreationParameters.cpp:
3780         * Shared/WebProcessCreationParameters.h:
3781         * Shared/mac/SecItemResponseData.cpp:
3782         (WebKit::SecItemResponseData::SecItemResponseData):
3783         (WebKit::SecItemResponseData::decode):
3784         * Shared/mac/SecItemResponseData.h:
3785         * WebProcess/MediaStream/MediaDeviceSandboxExtensions.h:
3786
3787 2019-03-25  Tim Horton  <timothy_horton@apple.com>
3788
3789         Animated keyboard scrolling is extremely chaotic
3790         https://bugs.webkit.org/show_bug.cgi?id=196164
3791         <rdar://problem/48702444>
3792
3793         Reviewed by Simon Fraser.
3794
3795         * UIProcess/ios/WKContentViewInteraction.mm:
3796         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
3797         Consume keyboard events instead of interpreting them traditionally
3798         if WKKeyboardScrollingAnimator is animating.
3799
3800         * UIProcess/ios/WKKeyboardScrollingAnimator.h:
3801         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3802         (-[WKKeyboardScrollingAnimator beginWithEvent:]):
3803         (-[WKKeyboardScrollingAnimator handleKeyEvent:]):
3804         (-[WKKeyboardScrollingAnimator stopAnimatedScroll]):
3805         (-[WKKeyboardScrollingAnimator scrollTriggeringKeyIsPressed]):
3806         (-[WKKeyboardScrollingAnimator displayLinkFired:]):
3807         (-[WKKeyboardScrollViewAnimator scrollTriggeringKeyIsPressed]):
3808         Expose the current state of interactive scrolling, and rename the related member.
3809
3810 2019-03-25  Keith Rollin  <krollin@apple.com>
3811
3812         Add WebKit logging for first paint and other interesting layout milestones
3813         https://bugs.webkit.org/show_bug.cgi?id=196159
3814         <rdar://problem/49128952>
3815
3816         Reviewed by Simon Fraser.
3817
3818         Add some logging to indicate what layout milestones have been reached.
3819         This should help us determine if there's a client, rendering, layout,
3820         or some other issue when page content does not appear in the client
3821         window.
3822
3823         The logging is being added to
3824         WebFrameLoaderClient::dispatchDidReachLayoutMilestone. This seems like
3825         a nice central place to capture layout milestones. However, it will
3826         only log notifications that are being sent to clients. It does not
3827         indicate all milestones that have occurred. That is, it does not
3828         report milestones that are filtered out due to client disinterest.
3829         There doesn't seem to be a good central place to capture all
3830         milestones, regardless of client interest.
3831
3832         * Platform/Logging.h:
3833         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3834         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
3835
3836 2019-03-25  Patrick Griffis  <pgriffis@igalia.com>
3837
3838         [GTK][WPE] Remove network access from web process sandbox
3839         https://bugs.webkit.org/show_bug.cgi?id=189967
3840
3841         Reviewed by Michael Catanzaro.
3842
3843         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3844         (WebKit::createFlatpakInfo):
3845         (WebKit::bubblewrapSpawn):
3846         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
3847         (WebKit::flatpakSpawn):
3848
3849 2019-03-25  Andy Estes  <aestes@apple.com>
3850
3851         [Apple Pay] Call +canMakePayments on a work queue
3852         https://bugs.webkit.org/show_bug.cgi?id=196179
3853         <rdar://problem/45388749>
3854
3855         Reviewed by Brady Eidson.
3856
3857         Calling +canMakePayments on either PKPaymentAuthorizationController or
3858         PKPaymentAuthorizationViewController results in synchronous IPC and is therefore very
3859         expensive to call on the main thread. On iOS, these calls are made in the network process,
3860         and on Mac in the UI process.
3861
3862         Call these methods on a work queue to avoid main thread spins.
3863
3864         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3865         (WebKit::WebPaymentCoordinatorProxy::canMakePayments):
3866         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3867         * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
3868         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3869         * Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3870         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePayments):
3871
3872 2019-03-25  Andy Estes  <aestes@apple.com>
3873
3874         [Apple Pay] Remove the AvailablePaymentNetworks synchronous message
3875         https://bugs.webkit.org/show_bug.cgi?id=196180
3876
3877         Reviewed by Youenn Fablet.
3878
3879         Unlike many PassKit interactions, it's ok to call +[PKPaymentRequest availableNetworks]
3880         without an entitlement. Therefore, we can call it from the web process directly rather than
3881         synchronously messaging the entitled UI or networking process.
3882
3883         * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
3884         * Shared/ApplePay/WebPaymentCoordinatorProxy.h:
3885         * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in:
3886         * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3887         * SourcesCocoa.txt:
3888         * WebKit.xcodeproj/project.pbxproj:
3889         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3890         (WebKit::WebPaymentCoordinator::availablePaymentNetworks):
3891         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3892         * WebProcess/ApplePay/cocoa/WebPaymentCoordinatorCocoa.mm: Added.
3893         (WebKit::WebPaymentCoordinator::platformAvailablePaymentNetworks const):
3894         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3895         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
3896         (-[WKAccessibilityWebPageObjectBase setWebPage:]):
3897
3898 2019-03-25  Chris Dumez  <cdumez@apple.com>
3899
3900         Unreviewed, tiny fix after r243388 to address API test failures on iOS
3901
3902         m_processType was properly initialized on macOS but not iOS.
3903
3904         * WebProcess/cocoa/WebProcessCocoa.mm:
3905         (WebKit::WebProcess::platformInitializeProcess):
3906
3907 2019-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3908
3909         [GTK][WPE] Do not allow changes in active URI before provisional load starts for non-API requests
3910         https://bugs.webkit.org/show_bug.cgi?id=194208
3911
3912         Reviewed by Michael Catanzaro.
3913
3914         * UIProcess/API/glib/WebKitWebView.cpp:
3915         (webkitWebViewWillStartLoad): Block updates of active URL.
3916         (webkitWebViewLoadChanged): Unblock updates of active URL on WEBKIT_LOAD_STARTED.
3917
3918 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3919
3920         Remove NavigatorContentUtils in WebCore/Modules
3921         https://bugs.webkit.org/show_bug.cgi?id=196070
3922
3923         Reviewed by Alex Christensen.
3924
3925         NavigatorContentUtils was to support the custom scheme spec [1].
3926         However, in WebKit side, no port has supported the feature in
3927         WebKit layer after EFL port was removed. So there has been the
3928         only IDL implementation of the NavigatorContentUtils in WebCore.
3929         So we don't need to keep the implementation in WebCore anymore.
3930
3931         [1] https://html.spec.whatwg.org/multipage/system-state.html#custom-handlers
3932
3933         * Configurations/FeatureDefines.xcconfig:
3934         * WebProcess/WebCoreSupport/WebNavigatorContentUtilsClient.h: Removed.
3935
3936 2019-03-24  Zan Dobersek  <zdobersek@igalia.com>
3937
3938         Unreviewed WPE build fix.
3939
3940         * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
3941         Add an explicit CompletionHandler.h include to avoid a trip-up in
3942         unified builds.
3943
3944 2019-03-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3945
3946         [WinCairo] WebProcessDataStoreParameters.h(32): error C2653: 'SandboxExtension': is not a class or namespace name
3947         https://bugs.webkit.org/show_bug.cgi?id=196192
3948
3949         Unreviewed for WinCairo port.
3950
3951         * Shared/WebProcessDataStoreParameters.h: Added #include "SandboxExtension.h".
3952
3953 2019-03-24  Andy Estes  <aestes@apple.com>
3954
3955         [watchOS] Remove unused Proximity Networking code
3956         https://bugs.webkit.org/show_bug.cgi?id=196188
3957
3958         Reviewed by Tim Horton.
3959
3960         * Configurations/WebKit.xcconfig:
3961         * NetworkProcess/NetworkProcess.cpp:
3962         (WebKit::NetworkProcess::NetworkProcess):
3963         * NetworkProcess/NetworkProcess.h:
3964         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3965         (WebKit::NetworkProcessCreationParameters::encode const):
3966         (WebKit::NetworkProcessCreationParameters::decode):
3967         * NetworkProcess/NetworkProcessCreationParameters.h:
3968         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3969         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3970         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3971         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3972         (WebKit::NetworkProcess::platformPrepareToSuspend):
3973         (WebKit::NetworkProcess::platformProcessDidResume):
3974         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
3975         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
3976         * NetworkProcess/watchos/NetworkProximityAssertion.h: Removed.
3977         * NetworkProcess/watchos/NetworkProximityAssertion.mm: Removed.
3978         * NetworkProcess/watchos/NetworkProximityManager.h: Removed.
3979         * NetworkProcess/watchos/NetworkProximityManager.mm: Removed.
3980         * SourcesCocoa.txt:
3981         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3982         (API::ProcessPoolConfiguration::copy):
3983         * UIProcess/API/APIProcessPoolConfiguration.h:
3984         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3985         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
3986         (-[_WKProcessPoolConfiguration wirelessContextIdentifier]):
3987         (-[_WKProcessPoolConfiguration setWirelessContextIdentifier:]):
3988         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3989         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3990         * WebKit.xcodeproj/project.pbxproj:
3991
3992 2019-03-23  Chris Dumez  <cdumez@apple.com>
3993
3994         Unreviewed, fix typo in comment added in r243379.
3995
3996         * UIProcess/API/Cocoa/WKProcessGroup.mm:
3997         (-[WKProcessGroup setDelegate:]):
3998
3999 2019-03-23  Simon Fraser  <simon.fraser@apple.com>