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