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