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