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