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