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