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