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