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