Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-26  Eric Carlson  <eric.carlson@apple.com>
2
3         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
4         https://bugs.webkit.org/show_bug.cgi?id=197171
5         <rdar://problem/47454979>
6
7         Reviewed by Youenn Fablet.
8
9         * Shared/ios/WebIconUtilities.mm:
10         (WebKit::iconForVideoFile):
11         * Shared/mac/WebCoreArgumentCodersMac.mm:
12         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
13         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
14         * UIProcess/Cocoa/UIDelegate.mm:
15         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
16         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
17         (WebKit::PlatformCALayerRemoteCustom::clone const):
18
19 2019-04-26  Commit Queue  <commit-queue@webkit.org>
20
21         Unreviewed, rolling out r244683.
22         https://bugs.webkit.org/show_bug.cgi?id=197320
23
24         Causing crash on iOS Simulator and EWS failures (Requested by
25         sroberts on #webkit).
26
27         Reverted changeset:
28
29         "[iOS] Add internal setting to force -webkit-text-size-adjust
30         to "auto""
31         https://bugs.webkit.org/show_bug.cgi?id=197275
32         https://trac.webkit.org/changeset/244683
33
34 2019-04-26  Youenn Fablet  <youenn@apple.com>
35
36         Use normal loading path for ping loads
37         https://bugs.webkit.org/show_bug.cgi?id=196807
38
39         Reviewed by Alex Christensen.
40
41         In case a NetworkResourceLoader has the keepAlive option we do the following:
42         - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone.
43         - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map
44         and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it
45         has not yet received a response. Mark the loader as kept-alive.
46         - In case loader is kept-alive, cancel the load as soon as a response is gathered.
47
48         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
49         (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
50         * NetworkProcess/NetworkConnectionToWebProcess.h:
51         * NetworkProcess/NetworkProcess.cpp:
52         (WebKit::NetworkProcess::addKeptAliveLoad):
53         (WebKit::NetworkProcess::removeKeptAliveLoad):
54         * NetworkProcess/NetworkProcess.h:
55         * NetworkProcess/NetworkResourceLoadMap.cpp:
56         (WebKit::NetworkResourceLoadMap::remove):
57         (WebKit::NetworkResourceLoadMap::take):
58         * NetworkProcess/NetworkResourceLoadMap.h:
59         * NetworkProcess/NetworkResourceLoader.cpp:
60         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
61         (WebKit::NetworkResourceLoader::cleanup):
62         (WebKit::NetworkResourceLoader::abort):
63         (WebKit::NetworkResourceLoader::didReceiveResponse):
64         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
65         * NetworkProcess/NetworkResourceLoader.h:
66         * WebProcess/Network/WebLoaderStrategy.cpp:
67         (WebKit::maximumBufferingTime):
68         (WebKit::WebLoaderStrategy::usePingLoad const):
69         * WebProcess/Network/WebLoaderStrategy.h:
70
71 2019-04-26  Alex Christensen  <achristensen@webkit.org>
72
73         Fix internal High Sierra build after r244653
74         https://bugs.webkit.org/show_bug.cgi?id=197131
75
76         * DerivedSources.make:
77         -std=gnu++17 didn't exist yet.  -std=gnu++1z did.
78
79 2019-04-26  Alex Christensen  <achristensen@webkit.org>
80
81         Fix an internal High Sierra build after r244653
82        ​https://bugs.webkit.org/show_bug.cgi?id=197131
83
84         * DerivedSources.make:
85         Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile.
86
87 2019-04-26  Sihui Liu  <sihui_liu@apple.com>
88
89         Stop IDB transactions to release locked database files when network process is ready to suspend
90         https://bugs.webkit.org/show_bug.cgi?id=196372
91         <rdar://problem/48930116>
92
93         Reviewed by Brady Eidson.
94
95         * NetworkProcess/NetworkProcess.cpp:
96         (WebKit::NetworkProcess::processWillSuspendImminently):
97         (WebKit::NetworkProcess::prepareToSuspend):
98         (WebKit::NetworkProcess::resume):
99
100 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
101
102         [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
103         https://bugs.webkit.org/show_bug.cgi?id=197275
104         <rdar://problem/50211019>
105
106         Reviewed by Simon Fraser.
107
108         * Shared/WebPreferences.yaml:
109         * UIProcess/WebPreferences.h:
110
111 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
112
113         [iOS] Implement idempotent mode for text autosizing
114         https://bugs.webkit.org/show_bug.cgi?id=197250
115         <rdar://problem/50211034>
116
117         Reviewed by Jon Lee.
118
119         Push the initial scale down into the page.
120
121         * WebProcess/WebPage/ios/WebPageIOS.mm:
122         (WebKit::WebPage::dynamicViewportSizeUpdate):
123         (WebKit::WebPage::viewportConfigurationChanged):
124
125 2019-04-25  Alex Christensen  <achristensen@webkit.org>
126
127         Make NetworkCache blobs safe for mmap instead of not using blobs
128         https://bugs.webkit.org/show_bug.cgi?id=197264
129         <rdar://problem/49564348>
130
131         Reviewed by Antti Koivisto.
132
133         This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs.
134         Those are the two cases where we were calling mmap and seeing crashes in apps with
135         default file protection of NSFileProtectionComplete.
136
137         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
138         (WebKit::NetworkCache::BlobStorage::add):
139         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
140         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted.
141         * NetworkProcess/cache/NetworkCacheFileSystem.h:
142         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm:
143         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
144         * NetworkProcess/cache/NetworkCacheStorage.cpp:
145         (WebKit::NetworkCache::Storage::Storage):
146         (WebKit::NetworkCache::Storage::synchronize):
147         (WebKit::NetworkCache::Storage::mayContainBlob const):
148         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
149         (WebKit::NetworkCache::estimateRecordsSize): Deleted.
150         * NetworkProcess/cache/NetworkCacheStorage.h:
151
152 2019-04-25  Simon Fraser  <simon.fraser@apple.com>
153
154         REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures
155         https://bugs.webkit.org/show_bug.cgi?id=188357
156         <rdar://problem/42986633>
157
158         Reviewed by Dean Jackson.
159         
160         DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some
161         tests would fall into low memory mode and have different behavior.
162         
163         Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer
164         to Internals, so it's shared by DRT and WTR.
165         
166         We no longer need the WK2 C SPI glue.
167
168         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
169         (WKBundlePageSetEventThrottlingBehaviorOverride):
170         (WKBundlePageSetCompositingPolicyOverride): Deleted.
171         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
172
173 2019-04-25  Chris Dumez  <cdumez@apple.com>
174
175         Trying to load a main resource outside the sandbox should not crash the WebContent process
176         https://bugs.webkit.org/show_bug.cgi?id=197299
177         <rdar://problem/49808042>
178
179         Reviewed by Geoffrey Garen.
180
181         Trying to load a main resource outside the sandbox should not crash the WebContent process. We should
182         simply ignore the load and log an error message.
183
184         * UIProcess/WebPageProxy.cpp:
185         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
186
187 2019-04-25  Timothy Hatcher  <timothy@apple.com>
188
189         Only send a synthetic mouse out event if synthetic mouse move events were sent.
190         https://bugs.webkit.org/show_bug.cgi?id=197295
191         rdar://problem/49040233
192
193         Reviewed by Zalan Bujtas.
194
195         * WebProcess/WebPage/ios/WebPageIOS.mm:
196         (WebKit::WebPage::completeSyntheticClick):
197
198 2019-04-25  Timothy Hatcher  <timothy@apple.com>
199
200         Disable date and time inputs on iOSMac.
201         https://bugs.webkit.org/show_bug.cgi?id=197287
202         rdar://problem/46794376
203
204         Reviewed by Wenson Hsieh.
205
206         * Configurations/FeatureDefines.xcconfig:
207
208 2019-04-25  Brady Eidson  <beidson@apple.com>
209
210         REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped
211         <rdar://problem/49755494> and https://bugs.webkit.org/show_bug.cgi?id=197284
212
213         Reviewed by Chris Dumez.
214
215         * WebProcess/cocoa/WebProcessCocoa.mm:
216         (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should
217           be eligible. Only if all pages are suspended should it be jetsam-able.
218
219 2019-04-25  Alex Christensen  <achristensen@webkit.org>
220
221         Start using C++17
222         https://bugs.webkit.org/show_bug.cgi?id=197131
223
224         Reviewed by Darin Adler.
225
226         * Configurations/Base.xcconfig:
227         * DerivedSources.make:
228
229 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
230
231         [GTK] Back/Forward gesture interferes with scrolling
232         https://bugs.webkit.org/show_bug.cgi?id=197168
233
234         Reviewed by Michael Catanzaro.
235
236         When the gesture is released with 0 velocity close to an edge of the webview,
237         the finishing animation is way too long, and in some cases it can look like the
238         gesture is already over, when it's still animating. By scrolling vertically while
239         that happens, it's possible to reset animation over and over again.
240
241         To reduce the duration in this case, instead of using maximum possible duration
242         (400ms), introduce a base velocity and use it for calculating the duration if
243         the actual velocity, relative to the end point, is equal to or less than 0.
244
245         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
246         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
247
248 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
249
250         [GTK] Back/forward gesture snapshot always times out
251         https://bugs.webkit.org/show_bug.cgi?id=197233
252
253         Reviewed by Michael Catanzaro.
254
255         Delaying web process launch caused a regression where we create ViewGestureController when the
256         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
257         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
258         snapshot always stays until timeout after performing the gesture.
259
260         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
261         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
262         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
263         and immediately apply it when creating the controller.
264
265         * UIProcess/API/glib/WebKitWebView.cpp:
266         (enableBackForwardNavigationGesturesChanged):
267         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
268         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
269         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
270         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
271         for the case ViewGestureController doesn't exist yet.
272         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
273         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
274         immediately call setSwipeGestureEnabled() with the stored value.
275         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
276
277 2019-04-25  Youenn Fablet  <youenn@apple.com>
278
279         [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
280         https://bugs.webkit.org/show_bug.cgi?id=197040
281         <rdar://problem/49997641>
282
283         Reviewed by Antti Koivisto.
284
285         Delay write operations in case synchronize is ongoing.
286         This is restricted to AvoidRandomness mode which is always used by CacheAPI
287         and is also used by network cache for layout tests.
288
289         Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
290
291         * NetworkProcess/cache/NetworkCacheStorage.cpp:
292         (WebKit::NetworkCache::Storage::synchronize):
293         (WebKit::NetworkCache::Storage::store):
294
295 2019-04-25  Commit Queue  <commit-queue@webkit.org>
296
297         Unreviewed, rolling out r244627.
298         https://bugs.webkit.org/show_bug.cgi?id=197282
299
300         Causing internal build failures (Requested by ShawnRoberts on
301         #webkit).
302
303         Reverted changeset:
304
305         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
306         https://bugs.webkit.org/show_bug.cgi?id=197171
307         https://trac.webkit.org/changeset/244627
308
309 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
310
311         [GTK] Hardcoded text color in input fields
312         https://bugs.webkit.org/show_bug.cgi?id=126907
313
314         Reviewed by Michael Catanzaro.
315
316         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
317
318         * UIProcess/API/gtk/PageClientImpl.cpp:
319         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
320         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
321         * UIProcess/API/gtk/PageClientImpl.h:
322         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
323         (themeChanged): Notify the WebPageProxy that the theme has changed.
324         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
325         * WebProcess/WebPage/WebPage.cpp:
326         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
327         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
328
329 2019-04-24  Zalan Bujtas  <zalan@apple.com>
330
331         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
332         https://bugs.webkit.org/show_bug.cgi?id=196948
333         <rdar://problem/49927131>
334
335         Reviewed by Tim Horton.
336
337         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
338         after r244291 there's no reason to have it in DrawingArea.
339
340         * UIProcess/DrawingAreaProxy.h:
341         (WebKit::DrawingAreaProxy::didUpdateGeometry):
342         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
343         * UIProcess/DrawingAreaProxy.messages.in:
344         * UIProcess/WebPageProxy.cpp:
345         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
346         (WebKit::WebPageProxy::setViewLayoutSize):
347         * UIProcess/WebPageProxy.h:
348         * UIProcess/WebPageProxy.messages.in:
349         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
350         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
351         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
352         * UIProcess/mac/WebPageProxyMac.mm:
353         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
354         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
355         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
356         * WebProcess/WebCoreSupport/WebChromeClient.h:
357         * WebProcess/WebPage/WebPage.cpp:
358         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
359         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
360         * WebProcess/WebPage/WebPage.h:
361         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
362         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
363         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
364         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
365
366 2019-04-24  Commit Queue  <commit-queue@webkit.org>
367
368         Unreviewed, rolling out r244228.
369         https://bugs.webkit.org/show_bug.cgi?id=197262
370
371         Causes compat issues (Requested by smfr on #webkit).
372
373         Reverted changeset:
374
375         "Unreviewed test gardening for Windows."
376         https://trac.webkit.org/changeset/244228
377
378 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
379
380         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
381         https://bugs.webkit.org/show_bug.cgi?id=197171
382         <rdar://problem/47454979>
383
384         Reviewed by Youenn Fablet.
385
386         * Shared/ios/WebIconUtilities.mm:
387         (WebKit::iconForVideoFile):
388         * Shared/mac/WebCoreArgumentCodersMac.mm:
389         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
390         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
391         * UIProcess/Cocoa/UIDelegate.mm:
392         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
393         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
394         (WebKit::PlatformCALayerRemoteCustom::clone const):
395
396 2019-04-24  Per Arne Vollan  <pvollan@apple.com>
397
398         [macOS] Fix syscall sandbox violation
399         https://bugs.webkit.org/show_bug.cgi?id=197247
400         <rdar://problem/50026580>
401
402         Reviewed by Brent Fulgham.
403
404         A missing syscall in the sandbox of the WebContent process is causing a crash.
405
406         * WebProcess/com.apple.WebProcess.sb.in:
407
408 2019-04-24  John Wilander  <wilander@apple.com>
409
410         Age out unconverted Ad Click Attributions after one week.
411         https://bugs.webkit.org/show_bug.cgi?id=197238
412         <rdar://problem/50177349>
413
414         Reviewed by Chris Dumez.
415
416         AdClickAttributionManager::storeUnconverted() and
417         AdClickAttributionManager::convert() now start by calling the new
418         AdClickAttributionManager::clearExpired() function to remove any
419         expired, unconverted attributions before continuing.
420
421         The rest of the patch is infrastructure to allow tests to expire
422         all unconverted attributions early.
423
424         * NetworkProcess/AdClickAttributionManager.cpp:
425         (WebKit::AdClickAttributionManager::storeUnconverted):
426         (WebKit::AdClickAttributionManager::convert):
427         (WebKit::AdClickAttributionManager::clearExpired):
428         (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
429         * NetworkProcess/AdClickAttributionManager.h:
430         * NetworkProcess/NetworkProcess.cpp:
431         (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
432         * NetworkProcess/NetworkProcess.h:
433         * NetworkProcess/NetworkProcess.messages.in:
434         * NetworkProcess/NetworkSession.cpp:
435         (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
436         * NetworkProcess/NetworkSession.h:
437         * UIProcess/API/C/WKPage.cpp:
438         (WKPageSetAdClickAttributionConversionURLForTesting):
439         (WKPageMarkAdClickAttributionsAsExpiredForTesting):
440         * UIProcess/API/C/WKPagePrivate.h:
441         * UIProcess/WebPageProxy.cpp:
442         (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
443         * UIProcess/WebPageProxy.h:
444
445 2019-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
446
447         Plumb the navigation's request when determining recommended compatibility mode
448         https://bugs.webkit.org/show_bug.cgi?id=197225
449         <rdar://problem/48389965>
450
451         Reviewed by Alex Christensen.
452
453         Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies.
454
455         * UIProcess/WebPageProxy.cpp:
456         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
457         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
458         * UIProcess/WebPageProxy.h:
459
460 2019-04-24  Tim Horton  <timothy_horton@apple.com>
461
462         Clean up WKActionSheetAssistant's use of LaunchServices
463         https://bugs.webkit.org/show_bug.cgi?id=194645
464         <rdar://problem/47707952>
465
466         Reviewed by Andy Estes.
467
468         * UIProcess/ios/WKActionSheetAssistant.mm:
469         (applicationHasAppLinkEntitlements):
470         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
471         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
472         (appLinkForURL): Deleted.
473         Make this function much more early-returny and flat.
474         Adopt LS sync SPI instead of using a semaphore ourselves.
475         Adopt modern open SPI.
476
477 2019-04-24  Simon Fraser  <simon.fraser@apple.com>
478
479         Make it possible to control the renderTreeAsText output by setting options on testRunner
480         https://bugs.webkit.org/show_bug.cgi?id=197133
481
482         Reviewed by Sam Weinig.
483
484         Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags
485         that make sense in testing (those that don't dump unstable data like addresses), and plumb
486         these flags through the various framework layers.
487
488         Convert RenderAsTextBehavior to an OptionSet<RenderAsTextFlag>.
489
490         Fix code generation in WebKitTestRunner to generate bindings for IDL const values,
491         and hand-code DumpRenderTree bindings.
492
493         Some cleanup of the TestRunners, using member initializers.
494
495         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
496         (WKBundlePageCopyRenderTreeExternalRepresentation):
497         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
498         * WebProcess/WebPage/WebPage.cpp:
499         (WebKit::toRenderAsTextFlags):
500         (WebKit::WebPage::renderTreeExternalRepresentation const):
501         (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const):
502         * WebProcess/WebPage/WebPage.h:
503
504 2019-04-24  Alex Christensen  <achristensen@webkit.org>
505
506         WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen
507         https://bugs.webkit.org/show_bug.cgi?id=197078
508         <rdar://problem/49564348>
509
510         Reviewed by Geoff Garen.
511
512         r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete.
513         It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen.
514
515         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
516         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
517         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
518         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted.
519         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted.
520         * NetworkProcess/cache/NetworkCacheFileSystem.h:
521         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added.
522         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
523         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
524         * Shared/WebCompiledContentRuleList.cpp:
525         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
526         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
527         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
528         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
529         (WebKit::WebCompiledContentRuleList::actions const):
530         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted.
531         * Shared/WebCompiledContentRuleList.h:
532         * Shared/WebCompiledContentRuleListData.cpp:
533         (WebKit::WebCompiledContentRuleListData::encode const):
534         (WebKit::WebCompiledContentRuleListData::decode):
535         (WebKit::WebCompiledContentRuleListData::size const): Deleted.
536         (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted.
537         * Shared/WebCompiledContentRuleListData.h:
538         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
539         * SourcesCocoa.txt:
540         * UIProcess/API/APIContentRuleList.cpp:
541         (API::ContentRuleList::usesCopiedMemory const): Deleted.
542         * UIProcess/API/APIContentRuleList.h:
543         * UIProcess/API/APIContentRuleListStore.cpp:
544         (API::openAndMapOrCopyContentRuleList):
545         (API::compiledToFile):
546         (API::createExtension):
547         (API::ContentRuleListStore::getContentRuleListSource):
548         (API::ContentRuleListStore::readContentsOfFile): Deleted.
549         (API::MappedOrCopiedData::dataPointer const): Deleted.
550         * UIProcess/API/APIContentRuleListStore.h:
551         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
552         (API::ContentRuleListStore::readContentsOfFile): Deleted.
553         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
554         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted.
555         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
556         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
557         (-[_WKUserContentFilter usesCopiedMemory]): Deleted.
558         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
559         * WebKit.xcodeproj/project.pbxproj:
560
561 2019-04-24  David Kilzer  <ddkilzer@apple.com>
562
563         Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification
564
565         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import
566         AccessibilitySupportSPI.h.
567
568 2019-04-24  Chris Dumez  <cdumez@apple.com>
569
570         URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy
571         https://bugs.webkit.org/show_bug.cgi?id=197214
572         <rdar://problem/49237544>
573
574         Reviewed by Alex Christensen.
575
576         URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the
577         WebFrameProxy. This patch fixes this.
578
579         * UIProcess/API/Cocoa/WKWebView.mm:
580         (-[WKWebView _mainFrameURL]):
581         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
582         * UIProcess/FrameLoadState.cpp:
583         (WebKit::FrameLoadState::didExplicitOpen):
584         * UIProcess/FrameLoadState.h:
585         * UIProcess/WebFrameProxy.cpp:
586         (WebKit::WebFrameProxy::didExplicitOpen):
587         * UIProcess/WebFrameProxy.h:
588         * UIProcess/WebPageProxy.cpp:
589         (WebKit::WebPageProxy::didExplicitOpenForFrame):
590
591 2019-04-24  Chris Dumez  <cdumez@apple.com>
592
593         X-Frame-Options header should be ignored when frame-ancestors CSP directive is present
594         https://bugs.webkit.org/show_bug.cgi?id=197226
595         <rdar://problem/50155649>
596
597         Reviewed by Alex Christensen.
598
599         * NetworkProcess/NetworkResourceLoader.cpp:
600         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
601
602 2019-04-24  Dean Jackson  <dino@apple.com>
603
604         Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
605         https://bugs.webkit.org/show_bug.cgi?id=197231
606         <rdar://problem/50164234>
607
608         Reviewed by Antoine Quint.
609
610         Rename _highlightLongPressCanClick to _longPressCanClick since it will be
611         used in other places.
612
613         Only attach the _highlightLongPressGestureRecognizer when we're not
614         using long presses for preview. This might revert in the future, if we
615         can set up an appropriate gesture resolution between the two.
616
617         * UIProcess/ios/WKContentViewInteraction.h:
618         * UIProcess/ios/WKContentViewInteraction.mm:
619         (-[WKContentView setupInteraction]):
620         (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
621         (-[WKContentView _highlightLongPressRecognized:]):
622         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
623         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
624         (-[WKContentView _previewItemControllerDidCancelPreview:]):
625
626 2019-04-24  chris fleizach  <cfleizach@apple.com>
627
628         AX: Remove deprecated Accessibility Object Model events
629         https://bugs.webkit.org/show_bug.cgi?id=197073
630         <rdar://problem/50027819>
631
632         Reviewed by Ryosuke Niwa.
633
634         * Platform/spi/ios/AccessibilitySupportSPI.h:
635         * UIProcess/API/Cocoa/WKWebView.mm:
636         (-[WKWebView _initializeWithConfiguration:]):
637         (-[WKWebView dealloc]):
638         (accessibilityEventsEnabledChangedCallback): Deleted.
639         (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted.
640         * UIProcess/API/Cocoa/WKWebViewInternal.h:
641         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
642         * UIProcess/WebPageProxy.cpp:
643         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted.
644         * UIProcess/WebPageProxy.h:
645         * WebProcess/WebPage/WebPage.cpp:
646         (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted.
647         * WebProcess/WebPage/WebPage.h:
648         * WebProcess/WebPage/WebPage.messages.in:
649
650 2019-04-23  John Wilander  <wilander@apple.com>
651
652         Move Ad Click Attribution from internal feature to experimental feature
653         https://bugs.webkit.org/show_bug.cgi?id=197218
654         <rdar://problem/47651691>
655
656         Reviewed by Brent Fulgham.
657
658         * Shared/WebPreferences.yaml:
659
660 2019-04-23  Keith Rollin  <krollin@apple.com>
661
662         Add Xcode version check for Header post-processing scripts
663         https://bugs.webkit.org/show_bug.cgi?id=197116
664         <rdar://problem/50058968>
665
666         Reviewed by Brent Fulgham.
667
668         There are several places in our Xcode projects that post-process
669         header files after they've been exported. Because of XCBuild, we're
670         moving to a model where the post-processing is performed at the same
671         time the header files are exported, rather than as a distinct
672         post-processing step. This patch disables the distinct step when the
673         inline processing is available.
674
675         In practice, this means prefixing appropriate post-processing Custom
676         Build phases with:
677
678         if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then
679             # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.
680             exit 0
681         fi
682
683         * WebKit.xcodeproj/project.pbxproj:
684
685 2019-04-23  John Wilander  <wilander@apple.com>
686
687         Remove Ad Click Attribution data when removing website data
688         https://bugs.webkit.org/show_bug.cgi?id=197215
689         <rdar://problem/47668988>
690
691         Reviewed by Chris Dumez.
692
693         This patch adds a new WebsiteDataType called AdClickAttributions and flags
694         it as owned by the network process.
695
696         The new website data type is added to the Cocoa API layer for
697         website data records management.
698
699         When either of the two WebsiteDataStore::removeData() functions calls
700         NetworkProcess::deleteWebsiteData() or
701         NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
702         process now calls into AdClickAttributionManager::clear() and
703         AdClickAttributionManager::clearForRegistrableDomain() respectively,
704         if the website datatypes include WebsiteDataType::AdClickAttributions.
705
706         The patch removes a couple of completion handlers in NetworkSession function
707         calls are because those are not asynchronous.
708
709         * NetworkProcess/AdClickAttributionManager.cpp:
710         (WebKit::AdClickAttributionManager::clear):
711         (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
712         (WebKit::AdClickAttributionManager::toString const):
713         * NetworkProcess/AdClickAttributionManager.h:
714         * NetworkProcess/NetworkProcess.cpp:
715         (WebKit::NetworkProcess::deleteWebsiteData):
716         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
717         (WebKit::NetworkProcess::clearAdClickAttribution):
718         * NetworkProcess/NetworkSession.cpp:
719         (WebKit::NetworkSession::clearAdClickAttribution):
720         (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
721         * NetworkProcess/NetworkSession.h:
722         * Shared/WebsiteData/WebsiteData.cpp:
723         (WebKit::WebsiteData::ownerProcess):
724         * Shared/WebsiteData/WebsiteDataType.h:
725         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
726         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
727         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
728         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
729         (dataTypesToString):
730         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
731         (WebKit::toWebsiteDataType):
732         (WebKit::toWKWebsiteDataTypes):
733         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
734         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
735         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
736
737 2019-04-23  Tim Horton  <timothy_horton@apple.com>
738
739         Return annotated text checking strings via UIWKDocumentContext
740         https://bugs.webkit.org/show_bug.cgi?id=197177
741         <rdar://problem/49064839>
742
743         Reviewed by Ryosuke Niwa.
744
745         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
746         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
747         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
748         * WebProcess/WebPage/ios/WebPageIOS.mm:
749         (WebKit::WebPage::requestDocumentEditingContext):
750         Respect the UIWKDocumentRequestAnnotation flag, returning an attributed
751         string containing the platform text checking annotations.
752
753 2019-04-23  Commit Queue  <commit-queue@webkit.org>
754
755         Unreviewed, rolling out r244556.
756         https://bugs.webkit.org/show_bug.cgi?id=197212
757
758         Causing build failures on multiple builders (Requested by
759         ShawnRoberts on #webkit).
760
761         Reverted changeset:
762
763         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
764         https://bugs.webkit.org/show_bug.cgi?id=197171
765         https://trac.webkit.org/changeset/244556
766
767 2019-04-23  Remy Demarest  <rdemarest@apple.com>
768
769         Build fix after r244545.
770
771         Reviewed by Tim Horton.
772
773         * Platform/spi/mac/AppKitSPI.h:
774         The SPI was an IPI in High Sierra.
775
776 2019-04-23  Per Arne Vollan  <pvollan@apple.com>
777
778         [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
779         https://bugs.webkit.org/show_bug.cgi?id=196740
780
781         Reviewed by Megan Gardner.
782
783         When an url for a page with an autofocused input field  is entered with the software keyboard,
784         the input field is auto selected, and the software keyboard reappears. This does not happen
785         when picking the url from favorites. After using the software keyboard to enter the url, the
786         activity state is being changed to focused. The method '_elementDidFocus' checks whether the
787         activity state changed, and allows the software keyboard to be shown in this case. To avoid
788         showing the software keyboard in this case, send the changing activity state bitfield to the
789         UI process, and check if the focus flag is the only flag set.
790   
791         * UIProcess/ios/WKContentViewInteraction.mm:
792         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
793
794 2019-04-23  Guy Lewin  <guy@lewin.co.il>
795
796         Multiple File Input Icon Set Regardless of File List
797         https://bugs.webkit.org/show_bug.cgi?id=195537
798
799         Reviewed by Alexey Proskuryakov.
800
801         Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with
802         icon and display string on iOS file open panels
803
804         * UIProcess/API/C/WKOpenPanelResultListener.cpp:
805         (WKOpenPanelResultListenerChooseMediaFiles):
806         * UIProcess/API/C/WKOpenPanelResultListener.h:
807
808 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
809
810         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
811         https://bugs.webkit.org/show_bug.cgi?id=197171
812         <rdar://problem/47454979>
813
814         Reviewed by Youenn Fablet.
815
816         * Shared/ios/WebIconUtilities.mm:
817         (WebKit::iconForVideoFile):
818         * Shared/mac/WebCoreArgumentCodersMac.mm:
819         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
820         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
821         * UIProcess/Cocoa/UIDelegate.mm:
822         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
823         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
824         (WebKit::PlatformCALayerRemoteCustom::clone const):
825
826 2019-04-22  Dean Jackson  <dino@apple.com>
827
828         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
829         https://bugs.webkit.org/show_bug.cgi?id=197184
830         <rdar://problem/50113848>
831
832         Reviewed by Wenson Hsieh.
833
834         WebKitAdditions defines some macros to include additional members
835         and protocols for WKContentViewInteraction.
836
837         It also defines some new functions. Provide empty version
838         of those functions when WebKitAdditions is not available.
839
840         * UIProcess/ios/WKContentViewInteraction.h:
841         * UIProcess/ios/WKContentViewInteraction.mm:
842         (-[WKContentView _registerPreview]):
843         (-[WKContentView _unregisterPreview]):
844
845 2019-04-23  Tim Horton  <timothy_horton@apple.com>
846
847         Action sheet shares a stringified URL instead of a URL object
848         https://bugs.webkit.org/show_bug.cgi?id=197185
849         <rdar://problem/49962249>
850
851         Reviewed by Darin Adler.
852
853         * UIProcess/Cocoa/WKShareSheet.h:
854         * UIProcess/Cocoa/WKShareSheet.mm:
855         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
856         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
857         * UIProcess/Cocoa/WebViewImpl.mm:
858         (WebKit::WebViewImpl::showShareSheet):
859         * UIProcess/ios/PageClientImplIOS.mm:
860         (WebKit::PageClientImpl::showShareSheet):
861         Make it possible to optionally provide WKShareSheet with
862         a rect to present relative to.
863
864         * UIProcess/ios/WKContentViewInteraction.h:
865         * UIProcess/ios/WKContentViewInteraction.mm:
866         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
867         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
868         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
869         Instead of stringifying the URL and using the text selection assistant's
870         share method, hand WKShareSheet a proper URL.
871
872 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
873
874         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
875         https://bugs.webkit.org/show_bug.cgi?id=197188
876
877         Reviewed by Wenson Hsieh.
878
879         Commit the scroll tree update before revealing the keyboard via editor state update.
880
881         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
882         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
883
884 2019-04-23  Remy Demarest  <rdemarest@apple.com>
885
886         Fix layout issues occuring when entering full screen mode.
887         https://bugs.webkit.org/show_bug.cgi?id=197086
888         <rdar://problem/47733671>.
889
890         Reviewed by Darin Adler.
891
892         This issue is the result of changing the style mask of the window after entering
893         full screen mode. Safari adds an invisible toolbar to display the URL of the page
894         which ends up breaking the layout. Having that window use a style that includes a
895         titlebar fixes the bug.
896
897         * Platform/spi/mac/AppKitSPI.h:
898         Declare an SPI to be used in WKFullScreenWindowController.
899
900         * UIProcess/Cocoa/WebViewImpl.mm:
901         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
902         and make the content view underlap the titlebar to match the current behavior.
903         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
904
905         * UIProcess/mac/WKFullScreenWindowController.mm:
906         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
907         before beginning the animation to full screen.
908         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
909         bar when in full screen instead of a blank bar.
910         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
911         bar to restore the initial setting.
912
913 2019-04-23  John Wilander  <wilander@apple.com>
914
915         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
916         https://bugs.webkit.org/show_bug.cgi?id=197183
917         <rdar://problem/47763188>
918
919         Reviewed by Alex Christensen.
920
921         Ad Click Attribution conversions are picked up in the redirect handler
922         in WebKit::NetworkResourceLoader. Content blocking typically happens in
923         the continued redirect request handling in the web content process and
924         a blocked request comes back empty.
925
926         We need to call the WebKit::NetworkLoadChecker in the network process
927         for these specific redirects, just like we do for Ping.
928
929         The change makes use of the existing function
930         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
931
932         In essence, this change makes it possible to block all conversions made
933         to a "/.well-known/ad-click-attribution/" URL.
934
935         * NetworkProcess/NetworkResourceLoader.cpp:
936         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
937             New convenience function.
938         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
939             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
940             an Ad Click Attribution conversion was found in the redirect URL.
941         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
942             If the request was not blocked, it will store any found conversion here.
943         * NetworkProcess/NetworkResourceLoader.h:
944
945 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
946
947         [CMake][Win] Use target oriented design for WebKit
948         https://bugs.webkit.org/show_bug.cgi?id=197173
949
950         Reviewed by Alex Christensen.
951
952         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
953         Migrate to use WebKit_DERIVED_SOURCES_DIR.
954
955         * CMakeLists.txt:
956         * PlatformGTK.cmake:
957         * PlatformWPE.cmake:
958         * PlatformWin.cmake:
959
960 2019-04-23  Chris Dumez  <cdumez@apple.com>
961
962         [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
963         https://bugs.webkit.org/show_bug.cgi?id=197097
964         <rdar://problem/50048318>
965
966         Reviewed by Alex Christensen.
967
968         The issue is that when doing a history navigation with form data, we try to resubmit the form.
969         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
970         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
971         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
972         This new load triggers a new decidePolicyForNavigationAction.
973
974         This would cause trouble with process-swapping because we normally destroy the
975         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
976         provisional process. As a result, the provisional process would not be able to retry.
977
978         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
979         if the load will continue or not. When this flag is set, the UIProcess does not destroy
980         the provisional page.
981
982         * Scripts/webkit/messages.py:
983         Minor IPC message handler build fix.
984
985         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
986         (-[WKURLSchemeTaskImpl _onlyIfCached]):
987         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
988         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
989
990         * UIProcess/ProvisionalPageProxy.cpp:
991         (WebKit::ProvisionalPageProxy::cancel):
992         Pass WillContinueLoading flag.
993
994         (WebKit::ProvisionalPageProxy::validateInput):
995         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
996         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
997         of 0, until the UIProcess can generate a valid identifier.
998
999         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1000
1001         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1002         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
1003         navigation, update m_navigationID so that follow-up IPC is considered valid.
1004
1005         * UIProcess/ProvisionalPageProxy.h:
1006         * UIProcess/WebPageProxy.cpp:
1007         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1008         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1009         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
1010         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1011         * UIProcess/WebPageProxy.h:
1012         * UIProcess/WebPageProxy.messages.in:
1013         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1014         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1015         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1016
1017 2019-04-22  Zalan Bujtas  <zalan@apple.com>
1018
1019         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
1020         https://bugs.webkit.org/show_bug.cgi?id=197175
1021         <rdar://problem/49613013>
1022
1023         Reviewed by Simon Fraser.
1024
1025         Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
1026         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
1027
1028         * WebProcess/WebPage/ios/WebPageIOS.mm:
1029         (WebKit::WebPage::completeSyntheticClick):
1030
1031 2019-04-22  Alex Christensen  <achristensen@webkit.org>
1032
1033         Deprecate WKContextCreateWithInjectedBundlePath
1034         https://bugs.webkit.org/show_bug.cgi?id=197169
1035
1036         Reviewed by Youenn Fablet.
1037
1038         * UIProcess/API/C/WKContext.h:
1039
1040 2019-04-22  Alex Christensen  <achristensen@webkit.org>
1041
1042         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
1043         https://bugs.webkit.org/show_bug.cgi?id=197093
1044         <rdar://problem/49708268>
1045
1046         Reviewed by Chris Dumez.
1047
1048         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
1049         Also add some test infrastructure for clearing persistent credentials added by the test.
1050
1051         * NetworkProcess/NetworkProcess.cpp:
1052         (WebKit::NetworkProcess::removeCredential):
1053         * NetworkProcess/NetworkProcess.h:
1054         * NetworkProcess/NetworkProcess.messages.in:
1055         * NetworkProcess/NetworkResourceLoader.cpp:
1056         (WebKit::NetworkResourceLoader::startNetworkLoad):
1057         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1058         (WebKit::NetworkProcess::removeCredential):
1059         * UIProcess/API/Cocoa/WKProcessPool.mm:
1060         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
1061         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1062         * UIProcess/WebProcessPool.cpp:
1063         (WebKit::WebProcessPool::removeCredential):
1064         * UIProcess/WebProcessPool.h:
1065
1066 2019-04-22  Chris Dumez  <cdumez@apple.com>
1067
1068         Delayed WebProcessLaunch may break the _relatedWebView SPI
1069         https://bugs.webkit.org/show_bug.cgi?id=197160
1070
1071         Reviewed by Alex Christensen.
1072
1073         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
1074         would relate a WebView to another which has not launched its initial process yet.
1075
1076         To address the issue, when we need a running process for a WebView which has a related view, we need
1077         to make sure the related view has a running process and use that process. Previously, we would share
1078         the "dummy" process instead.
1079
1080         * UIProcess/WebPageProxy.cpp:
1081         (WebKit::WebPageProxy::launchProcess):
1082         (WebKit::WebPageProxy::ensureRunningProcess):
1083         * UIProcess/WebPageProxy.h:
1084         * UIProcess/WebProcessPool.cpp:
1085         (WebKit::WebProcessPool::createWebPage):
1086
1087 2019-04-22  David Quesada  <david_quesada@apple.com>
1088
1089         Remove linked-on-or-after check for download attribute handling
1090         https://bugs.webkit.org/show_bug.cgi?id=197176
1091         rdar://problem/48459714
1092
1093         Reviewed by Alex Christensen.
1094
1095         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
1096         so it doesn't make sense to preserve the old behavior of forcing download-attribute
1097         links to start downloads.
1098
1099         * UIProcess/Cocoa/VersionChecks.h:
1100         * UIProcess/WebPageProxy.cpp:
1101         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1102
1103 2019-04-22  Chris Dumez  <cdumez@apple.com>
1104
1105         Unreviewed, rolling out r244502.
1106
1107         Caused crashes on the bots
1108
1109         Reverted changeset:
1110
1111         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
1112         https://bugs.webkit.org/show_bug.cgi?id=197160
1113         https://trac.webkit.org/changeset/244502
1114
1115 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
1116
1117         Unreviewed, rolling out r244437.
1118
1119         Still breaks internal tests.
1120
1121         Reverted changeset:
1122
1123         "InjectedBundle parameters often need initialization function
1124         called before unarchiving"
1125         https://bugs.webkit.org/show_bug.cgi?id=189709
1126         https://trac.webkit.org/changeset/244437
1127
1128 2019-04-22  Chris Dumez  <cdumez@apple.com>
1129
1130         Delayed WebProcessLaunch may break the _relatedWebView SPI
1131         https://bugs.webkit.org/show_bug.cgi?id=197160
1132
1133         Reviewed by Alex Christensen.
1134
1135         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
1136         would relate a WebView to another which has not launched its initial process yet.
1137
1138         To address the issue, when we need a running process for a WebView which has a related view, we need
1139         to make sure the related view has a running process and use that process. Previously, we would share
1140         the "dummy" process instead.
1141
1142         * UIProcess/WebPageProxy.cpp:
1143         (WebKit::WebPageProxy::launchProcess):
1144         (WebKit::WebPageProxy::ensureRunningProcess):
1145         * UIProcess/WebPageProxy.h:
1146         * UIProcess/WebProcessPool.cpp:
1147         (WebKit::WebProcessPool::createWebPage):
1148
1149 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
1150
1151         [GTK] fix gtk_style_context_set_background deprecation
1152         https://bugs.webkit.org/show_bug.cgi?id=196912
1153
1154         Reviewed by Carlos Garcia Campos.
1155
1156         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
1157         Backgrounds are not rendered in the UI process, so it can be
1158         simply removed.
1159
1160         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1161         (webkitWebViewBaseRealize):
1162
1163 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1164
1165         Defer EditorState updates until the next layer tree flush in a few additional circumstances
1166         https://bugs.webkit.org/show_bug.cgi?id=197145
1167         <rdar://problem/50078170>
1168
1169         Reviewed by Darin Adler.
1170
1171         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
1172         state update after the next compositing flush.
1173
1174         * WebProcess/WebPage/WebPage.cpp:
1175         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
1176         (WebKit::WebPage::setNeedsFontAttributes):
1177         (WebKit::WebPage::didChangeOverflowScrollPosition):
1178         (WebKit::WebPage::didChangeSelection):
1179         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
1180         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
1181         * WebProcess/WebPage/WebPage.h:
1182         * WebProcess/WebPage/ios/WebPageIOS.mm:
1183         (WebKit::WebPage::platformEditorState const):
1184         (WebKit::WebPage::updateVisibleContentRects):
1185
1186 2019-04-21  Chris Dumez  <cdumez@apple.com>
1187
1188         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
1189         https://bugs.webkit.org/show_bug.cgi?id=197144
1190
1191         Reviewed by Darin Adler.
1192
1193         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
1194         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
1195         suspended process because such process will no longer send the DidDestroyNavigation IPC.
1196
1197         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
1198         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
1199         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
1200         DidDestroyNavigation.
1201
1202         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
1203         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
1204         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
1205         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
1206         since the test is crashing consistently and the page would no longer be able to receive IPC from the
1207         previous process *after* we've committed the provisional process/page.
1208
1209         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
1210         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
1211         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
1212         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
1213         in order to construct the provisional page. I personally did not expect we could receive IPC between the
1214         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
1215         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
1216         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
1217         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
1218         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
1219         EventSender to do a click on a link which triggers the navigation.
1220
1221         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
1222         to make sure that we always start the provisional load in the new process before we tell the previous process
1223         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
1224         before we have a provisional page.
1225
1226         * UIProcess/WebPageProxy.cpp:
1227         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1228         (WebKit::WebPageProxy::didDestroyNavigation):
1229         * WebProcess/WebPage/WebFrame.cpp:
1230         (WebKit::WebFrame::didReceivePolicyDecision):
1231         (WebKit::WebFrame::documentLoaderDetached):
1232         * WebProcess/WebPage/WebFrame.h:
1233
1234 2019-04-20  Chris Dumez  <cdumez@apple.com>
1235
1236         Unreviewed, fix iOS build with recent SDKs.
1237
1238         * UIProcess/API/Cocoa/WKWebView.mm:
1239         (deviceOrientation):
1240         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1241         (-[WKFullScreenViewController initWithWebView:]):
1242         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
1243         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
1244
1245 2019-04-19  John Wilander  <wilander@apple.com>
1246
1247         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
1248         https://bugs.webkit.org/show_bug.cgi?id=197108
1249         <rdar://problem/49918702>
1250
1251         Reviewed by Alex Christensen.
1252
1253         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
1254         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
1255         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
1256
1257         The new session can be invoked with the new enum value of
1258         WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless.
1259
1260         WebKit::AdClickAttributionManager::fireConversionRequest() makes use of
1261         the new session for its conversion requests.
1262
1263         This patch also makes sure that Ad Click Attributions cannot be stored in
1264         ephemeral sessions and already stored attributions cannot be converted in
1265         ephemeral sessions.
1266
1267         * NetworkProcess/AdClickAttributionManager.cpp:
1268         (WebKit::AdClickAttributionManager::fireConversionRequest):
1269         (WebKit::AdClickAttributionManager::toString const):
1270         * NetworkProcess/NetworkLoadChecker.h:
1271         * NetworkProcess/NetworkProcess.h:
1272         * NetworkProcess/NetworkProcess.messages.in:
1273         * NetworkProcess/NetworkResourceLoader.cpp:
1274         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1275         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1276         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1277             Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily.
1278         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1279         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1280         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1281         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1282         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession):
1283         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
1284         * Shared/WebCoreArgumentCoders.h:
1285
1286 2019-04-19  Daniel Bates  <dabates@apple.com>
1287
1288         Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect:
1289         https://bugs.webkit.org/show_bug.cgi?id=197122
1290
1291         Reviewed by Wenson Hsieh.
1292
1293         * UIProcess/ios/WKContentViewInteraction.mm:
1294         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:.
1295         While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal
1296         assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for
1297         emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks
1298         in first() and last()), but this code is likely not hot enough for it to matter.
1299         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming.
1300         (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto.
1301         (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted.
1302
1303 2019-04-19  Daniel Bates  <dabates@apple.com>
1304
1305         -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
1306         https://bugs.webkit.org/show_bug.cgi?id=197119
1307
1308         Reviewed by Wenson Hsieh.
1309
1310         Use the existing EditingRange type to represent the location and length of the marked text
1311         range for an autocorrection instead of managing integers. This type avoid the need to handle
1312         the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently
1313         WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0).
1314
1315         While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename
1316         +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext
1317         to better reflect the expected source of the conversion: a Web-type.
1318
1319         * Shared/ios/WebAutocorrectionContext.h:
1320         (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy
1321         to amend without losing SVN history.
1322         (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here.
1323         * UIProcess/ios/WKContentViewInteraction.mm:
1324         (-[WKContentView _handleAutocorrectionContext:]): Update for renaming.
1325         (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming.
1326         (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext.
1327         (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted.
1328         * WebProcess/WebPage/ios/WebPageIOS.mm:
1329         (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate
1330         the struct and return it, initializing its fields individually instead of using the constructor to
1331         make this code less error prone. It's easy to introduce an error with the constructor notation when
1332         amending the the struct because so many of the arguments are of the same data type. Individually
1333         initializing the struct fields makes it less likely for an ordering mistake to be introduced.
1334
1335 2019-04-19  Dean Jackson  <dino@apple.com>
1336
1337         Add more _WKElementActionTypes and provide API to create with custom types
1338         https://bugs.webkit.org/show_bug.cgi?id=197117
1339         <rdar://problem/50059548>
1340
1341         Reviewed by Tim Horton.
1342
1343         We were missing a few obvious types that are well-known
1344         browser actions, and/or should be visible in share sheets.
1345         Also, clean up the API for constructing new types.
1346
1347         * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
1348         in new tabs, windows and downloading.
1349         * UIProcess/API/Cocoa/_WKElementAction.mm:
1350         (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
1351         with type, title and action.
1352         (+[_WKElementAction elementActionWithType:]): Call new method.
1353
1354 2019-04-18  Daniel Bates  <dabates@apple.com>
1355
1356         Use existing KeyEventCodesIOS constants instead of duplicating them
1357         https://bugs.webkit.org/show_bug.cgi?id=197081
1358
1359         Rubber-stamped by Wenson Hsieh.
1360
1361         * UIProcess/ios/WKContentViewInteraction.mm:
1362         (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
1363         as it is identical to the default switch case.
1364
1365 2019-04-19  Keith Rollin  <krollin@apple.com>
1366
1367         Add postprocess-header-rule scripts
1368         https://bugs.webkit.org/show_bug.cgi?id=197072
1369         <rdar://problem/50027299>
1370
1371         Reviewed by Brent Fulgham.
1372
1373         Several projects have post-processing build phases where exported
1374         headers are tweaked after they've been copied. This post-processing is
1375         performed via scripts called postprocess-headers.sh. For reasons
1376         related to XCBuild, we are now transitioning to a build process where
1377         the post-processing is performed at the same time as the
1378         exporting/copying. To support this process, add similar scripts named
1379         postprocess-header-rule, which are geared towards processing a single
1380         file at a time rather than all exported files at once. Also add a
1381         build rule that makes use of these scripts. These scripts and build
1382         rules are not used at the moment; they will come into use in an
1383         imminent patch.
1384
1385         Note that I've named these postprocess-header-rule rather than
1386         postprocess-header-rule.sh. Scripts in Tools/Scripts do not have
1387         suffixes indicating how the tool is implemented. Scripts in
1388         per-project Scripts folders appear to be mixed regarding the use of
1389         suffixes. I'm opting here to follow the Tools/Scripts convention, with
1390         the expectation that over time we completely standardize on that.
1391
1392         * Scripts/postprocess-header-rule: Added.
1393         * WebKit.xcodeproj/project.pbxproj:
1394
1395 2019-04-19  Brady Eidson  <beidson@apple.com>
1396
1397         Deprecate WebKit2 plug-in support.
1398         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1399
1400         Reviewed by Andy Estes.
1401
1402         * UIProcess/API/Cocoa/WKPreferences.h:
1403         * UIProcess/API/Cocoa/WKPreferences.mm:
1404         (-[WKPreferences encodeWithCoder:]):
1405         (-[WKPreferences initWithCoder:]):
1406         (-[WKPreferences javaEnabled]):
1407         (-[WKPreferences setJavaEnabled:]):
1408         (-[WKPreferences plugInsEnabled]):
1409         (-[WKPreferences setPlugInsEnabled:]):
1410
1411 2019-04-19  Chris Dumez  <cdumez@apple.com>
1412
1413         Minor PSON release logging improvements
1414         https://bugs.webkit.org/show_bug.cgi?id=197104
1415
1416         Reviewed by Darin Adler.
1417
1418         * UIProcess/SuspendedPageProxy.cpp:
1419         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1420         * UIProcess/WebPageProxy.cpp:
1421         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1422
1423 2019-04-19  Tim Horton  <timothy_horton@apple.com>
1424
1425         YouTube and Twitter embeds don't load in News
1426         https://bugs.webkit.org/show_bug.cgi?id=197111
1427         <rdar://problem/50010081>
1428
1429         Reviewed by Timothy Hatcher.
1430
1431         * WebProcess/com.apple.WebProcess.sb.in:
1432         Adjust this sandbox exception to include both platforms.
1433
1434 2019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1435
1436         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
1437         https://bugs.webkit.org/show_bug.cgi?id=197102
1438         <rdar://problem/49864669>
1439
1440         Reviewed by Ryosuke Niwa.
1441
1442         If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
1443         whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
1444
1445         * WebProcess/WebPage/ios/WebPageIOS.mm:
1446         (WebKit::WebPage::getFocusedElementInformation):
1447
1448 2019-04-19  Commit Queue  <commit-queue@webkit.org>
1449
1450         Unreviewed, rolling out r244447.
1451         https://bugs.webkit.org/show_bug.cgi?id=197103
1452
1453         Caused build failures with Internal and Opensource builders
1454         (Requested by ShawnRoberts on #webkit).
1455
1456         Reverted changeset:
1457
1458         "Deprecate WebKit2 plug-in support."
1459         https://bugs.webkit.org/show_bug.cgi?id=197080
1460         https://trac.webkit.org/changeset/244447
1461
1462 2019-04-18  Brady Eidson  <beidson@apple.com>
1463
1464         Deprecate WebKit2 plug-in support.
1465         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1466
1467         Reviewed by Andy Estes.
1468
1469         * UIProcess/API/Cocoa/WKPreferences.h:
1470         * UIProcess/API/Cocoa/WKPreferences.mm:
1471         (-[WKPreferences encodeWithCoder:]):
1472         (-[WKPreferences initWithCoder:]):
1473         (-[WKPreferences javaEnabled]):
1474         (-[WKPreferences setJavaEnabled:]):
1475         (-[WKPreferences plugInsEnabled]):
1476         (-[WKPreferences setPlugInsEnabled:]):
1477
1478 2019-04-18  Commit Queue  <commit-queue@webkit.org>
1479
1480         Unreviewed, rolling out r244434.
1481         https://bugs.webkit.org/show_bug.cgi?id=197089
1482
1483         caused 1 API test failure (Requested by zalan on #webkit).
1484
1485         Reverted changeset:
1486
1487         "Regression (r244291): Broken API Test
1488         AutoLayoutRenderingProgressRelativeOrdering"
1489         https://bugs.webkit.org/show_bug.cgi?id=196948
1490         https://trac.webkit.org/changeset/244434
1491
1492 2019-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1493
1494         Add new compatibility mode API on WKNavigation
1495         https://bugs.webkit.org/show_bug.cgi?id=197069
1496         <rdar://problem/50025800>
1497
1498         Reviewed by Tim Horton.
1499
1500         Adds a new property on WKNavigation.
1501
1502         * Shared/WebCompatibilityMode.h:
1503
1504         Drive-by fix: make this enum class 8 bits wide.
1505
1506         * UIProcess/API/APINavigation.h:
1507         (API::Navigation::setEffectiveCompatibilityMode):
1508         (API::Navigation::effectiveCompatibilityMode const):
1509
1510         Add a new member variable to API::Navigation.
1511
1512         * UIProcess/API/Cocoa/WKNavigation.h:
1513         * UIProcess/API/Cocoa/WKNavigation.mm:
1514         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1515         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
1516
1517         Add various hooks into WebKitAdditions.
1518
1519         * UIProcess/WebPageProxy.cpp:
1520         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1521
1522         Set API::Navigation's effective compatibility mode.
1523
1524         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
1525
1526         Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website
1527         policies.
1528
1529         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted.
1530         * UIProcess/WebPageProxy.h:
1531
1532 2019-04-18  Don Olmstead  <don.olmstead@sony.com>
1533
1534         [CMake] Make WebCore headers copies
1535         https://bugs.webkit.org/show_bug.cgi?id=182512
1536         <rdar://problem/37510435>
1537
1538         Reviewed by Alex Christensen.
1539
1540         WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed
1541         problems with WebKit's usage of WebCore headers. All include directories directly
1542         referencing the WebCore source tree we're removed from the CMake files. Any includes
1543         of WebCore headers using "*.h" were modified to <WebCore/*.h>
1544
1545         Removed generation of forwarding headers for WebCore using the perl script.
1546
1547         * CMakeLists.txt:
1548         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1549         * PlatformWPE.cmake:
1550         * PlatformWin.cmake:
1551         * Scripts/generate-forwarding-headers.pl:
1552         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
1553         * UIProcess/API/wpe/WebKitColorPrivate.h:
1554         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
1555         * UIProcess/win/PageClientImpl.cpp:
1556
1557 2019-04-18  Chris Dumez  <cdumez@apple.com>
1558
1559         [iOS] Improve detection of when web views go to background / foreground
1560         https://bugs.webkit.org/show_bug.cgi?id=197035
1561         <rdar://problem/45281182>
1562
1563         Reviewed by Tim Horton.
1564
1565         Improve detection of when web views go to background / foreground on iOS.
1566
1567         * UIProcess/ApplicationStateTracker.mm:
1568         (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted.
1569         (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted.
1570         (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted.
1571         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted.
1572         (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted.
1573
1574 2019-04-18  Jer Noble  <jer.noble@apple.com>
1575
1576         Refactoring: Pull all fullscreen code out of Document and into its own helper class
1577         https://bugs.webkit.org/show_bug.cgi?id=197017
1578
1579         Reviewed by Eric Carlson.
1580
1581         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1582         (WebKit::WebFullScreenManager::willEnterFullScreen):
1583         (WebKit::WebFullScreenManager::didEnterFullScreen):
1584         (WebKit::WebFullScreenManager::willExitFullScreen):
1585         (WebKit::WebFullScreenManager::didExitFullScreen):
1586         (WebKit::WebFullScreenManager::setAnimatingFullScreen):
1587         (WebKit::WebFullScreenManager::requestExitFullScreen):
1588         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1589         (webkit_dom_document_webkit_cancel_fullscreen):
1590         (webkit_dom_document_webkit_exit_fullscreen):
1591         (webkit_dom_document_get_webkit_is_fullscreen):
1592         (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed):
1593         (webkit_dom_document_get_webkit_current_fullscreen_element):
1594         (webkit_dom_document_get_webkit_fullscreen_element):
1595         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1596         (WebKit::WebChromeClient::createWindow):
1597
1598 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
1599
1600         Update UIKit when a cut causes a selection change
1601         https://bugs.webkit.org/show_bug.cgi?id=197047
1602         <rdar://problem/36311563>
1603
1604         Reviewed by Wenson Hsieh.
1605
1606         We need to let UIKit know when a cut causes a selection change (always),
1607         so that is can appropriately update the button on the keyboard bar.
1608
1609         * UIProcess/ios/WKContentViewInteraction.mm:
1610         (-[WKContentView cutForWebView:]):
1611
1612 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
1613
1614         InjectedBundle parameters often need initialization function called before unarchiving
1615         https://bugs.webkit.org/show_bug.cgi?id=189709
1616         <rdar://problem/44573653>
1617
1618         Reviewed by Ryosuke Niwa.
1619
1620         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
1621         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
1622         after the bundle initialiation function runs, which gives the embedding program the opportunity to
1623         register additional classes that are safe for serialization.
1624
1625         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
1626         to be serialized by the InjectedBundle.
1627         
1628         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
1629         Revise 'initialize' to call this new method.
1630
1631         * WebProcess/InjectedBundle/InjectedBundle.h:
1632         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
1633         (WebKit::InjectedBundle::initialize): Use the new method.
1634         (WebKit::InjectedBundle::decodeBundleParameters): Added.
1635         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
1636         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
1637         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
1638         NSDictionary object may itself hold other kinds of objects.
1639         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1640         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
1641
1642 2019-04-18  Zalan Bujtas  <zalan@apple.com>
1643
1644         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
1645         https://bugs.webkit.org/show_bug.cgi?id=196948
1646         <rdar://problem/49927131>
1647
1648         Reviewed by Tim Horton.
1649
1650         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
1651         after r244291 there's no reason to have it in DrawingArea.
1652
1653         * UIProcess/DrawingAreaProxy.h:
1654         (WebKit::DrawingAreaProxy::didUpdateGeometry):
1655         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
1656         * UIProcess/DrawingAreaProxy.messages.in:
1657         * UIProcess/WebPageProxy.cpp:
1658         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
1659         (WebKit::WebPageProxy::setViewLayoutSize):
1660         * UIProcess/WebPageProxy.h:
1661         * UIProcess/WebPageProxy.messages.in:
1662         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1663         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1664         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
1665         * UIProcess/mac/WebPageProxyMac.mm:
1666         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
1667         * WebProcess/WebPage/WebPage.cpp:
1668         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
1669         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
1670         * WebProcess/WebPage/WebPage.h:
1671         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1672         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1673         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1674         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
1675
1676 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
1677
1678         Unreviewed, rolling out r244299.
1679
1680         Breaks internal tests.
1681
1682         Reverted changeset:
1683
1684         "InjectedBundle parameters often need initialization function
1685         called before unarchiving"
1686         https://bugs.webkit.org/show_bug.cgi?id=189709
1687         https://trac.webkit.org/changeset/244299
1688
1689 2019-04-18  Shawn Roberts  <sroberts@apple.com>
1690
1691         Unreviewed manual rollout of r244248 and r244409
1692         Causing assertion failures on Mac WK2 Debug builds
1693         https://bugs.webkit.org/show_bug.cgi?id=195623
1694
1695         * NetworkProcess/NetworkProcess.cpp:
1696         (WebKit::NetworkProcess::lowMemoryHandler):
1697         * NetworkProcess/NetworkProcess.h:
1698         (WebKit::NetworkProcess::prefetchCache): Deleted.
1699         * NetworkProcess/NetworkResourceLoader.cpp:
1700         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1701         (WebKit::NetworkResourceLoader::didReceiveResponse):
1702         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1703         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
1704         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
1705         * NetworkProcess/NetworkResourceLoader.h:
1706         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
1707         * NetworkProcess/cache/PrefetchCache.h: Removed.
1708         * Shared/WebPreferences.yaml:
1709         * Sources.txt:
1710         * WebKit.xcodeproj/project.pbxproj:
1711
1712 2019-04-18  Devin Rousso  <drousso@apple.com>
1713
1714         Web Inspector: Canvas: enable WebGL2 for inspector page
1715         https://bugs.webkit.org/show_bug.cgi?id=196932
1716         <rdar://problem/49916213>
1717
1718         Reviewed by Timothy Hatcher.
1719
1720         * WebProcess/WebPage/WebInspectorUI.cpp:
1721         (WebKit::WebInspectorUI::WebInspectorUI):
1722
1723 2019-04-17  Devin Rousso  <drousso@apple.com>
1724
1725         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
1726         https://bugs.webkit.org/show_bug.cgi?id=197044
1727
1728         Reviewed by Joseph Pecoraro.
1729
1730         * UIProcess/WebInspectorUtilities.h:
1731         * UIProcess/WebInspectorUtilities.cpp:
1732         (WebKit::trackInspectorPage):
1733         (WebKit::untrackInspectorPage):
1734         Determine the level of the inspector page by looking to see if the page being inspected is
1735         in the inspector page map. If so, we must be inspecting an inspector page and should use
1736         that inspector page's inspection level as the value to increment.
1737
1738         * UIProcess/WebInspectorProxy.cpp:
1739         (WebKit::WebInspectorProxy::createFrontendPage):
1740         * UIProcess/RemoteWebInspectorProxy.cpp:
1741         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
1742
1743 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1744
1745         Adopt different scroll view flashing SPI
1746         https://bugs.webkit.org/show_bug.cgi?id=197043
1747         <rdar://problem/49996476>
1748
1749         Reviewed by Wenson Hsieh.
1750
1751         * Platform/spi/ios/UIKitSPI.h:
1752         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1753         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
1754
1755 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1756
1757         REGRESSION (r241988): Switching tabs is slow
1758         https://bugs.webkit.org/show_bug.cgi?id=197037
1759         <rdar://problem/49951473>
1760
1761         Reviewed by Simon Fraser.
1762
1763         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1764         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
1765         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
1766         but WebPageProxy messages are identified by their WebPageProxy ID.
1767         Revert that one change. The rest of the patch looks OK.
1768
1769 2019-04-17  Rob Buis  <rbuis@igalia.com>
1770
1771         Link prefetch not useful for top-level navigation
1772         https://bugs.webkit.org/show_bug.cgi?id=195623
1773
1774         Reviewed by Alex Christensen.
1775
1776         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
1777         not sending the DidReceiveResponse message.
1778
1779         * NetworkProcess/NetworkResourceLoader.cpp:
1780         (WebKit::NetworkResourceLoader::didReceiveResponse):
1781
1782 2019-04-17  Truitt Savell  <tsavell@apple.com>
1783
1784         Unreviewed, rolling out r244400.
1785
1786         Caused testing to exit early with assertionon Debug WK2
1787
1788         Reverted changeset:
1789
1790         "UI↔Web deadlock when printing with a JavaScript alert
1791         visible"
1792         https://bugs.webkit.org/show_bug.cgi?id=196839
1793         https://trac.webkit.org/changeset/244400
1794
1795 2019-04-17  Brady Eidson  <beidson@apple.com>
1796
1797         Link clicks in PDFs shouldn't send referrer headers.
1798         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
1799
1800         Reviewed by Tim Horton.
1801
1802         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1803         (WebKit::PDFPlugin::clickedLink):
1804         * WebProcess/WebPage/WebPage.cpp:
1805         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1806
1807 2019-04-17  Andy Estes  <aestes@apple.com>
1808
1809         [iOS] Support multiple file selection in UIDocumentPickerViewController
1810         https://bugs.webkit.org/show_bug.cgi?id=197014
1811         <rdar://problem/49963514>
1812
1813         Reviewed by Tim Horton.
1814
1815         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1816         (-[WKFileUploadPanel _showDocumentPickerMenu]):
1817         Allowed multiple file selection in our UIDocumentPickerViewController when
1818         _allowMultipleFiles is YES.
1819
1820         (displayStringForDocumentsAtURLs):
1821         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
1822         Changed to support multiple file selection. When more than one file is selected, use
1823         WebCore::multipleFileUploadText() as the display string.
1824
1825 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1826
1827         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
1828         https://bugs.webkit.org/show_bug.cgi?id=197033
1829
1830         Reviewed by Tim Horton.
1831
1832         This is just cleanup that makes the code nicer without changing behavior.
1833
1834         * Shared/WebCompiledContentRuleListData.cpp:
1835         (WebKit::WebCompiledContentRuleListData::encode const):
1836         (WebKit::WebCompiledContentRuleListData::decode):
1837         * Shared/WebCompiledContentRuleListData.h:
1838         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
1839         * UIProcess/API/APIContentRuleList.h:
1840         * UIProcess/API/APIContentRuleListStore.cpp:
1841         (API::createExtension):
1842
1843 2019-04-17  John Wilander  <wilander@apple.com>
1844
1845         Add prioritization of ad click conversions and cleaning of sent ad click conversions
1846         https://bugs.webkit.org/show_bug.cgi?id=196934
1847         <rdar://problem/49917773>
1848
1849         Reviewed by Chris Dumez.
1850
1851         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
1852
1853         This patch adds handling of prioritization of conversions according to these rules:
1854         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
1855         - If we have no previously converted attribution for this pair, just store.
1856         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
1857         - If we had no matching unconverted attribution but do have a previously converted attribution for this
1858         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
1859
1860         This handling is in part done by dividing the previous m_adClickAttributionMap into 
1861         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
1862         as key instead of a nested HashMap.
1863
1864         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
1865         removes attributions which have been sent out.
1866
1867         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
1868         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
1869         members to also clear them when done.
1870
1871         * NetworkProcess/AdClickAttributionManager.cpp:
1872         (WebKit::AdClickAttributionManager::storeUnconverted):
1873         (WebKit::AdClickAttributionManager::convert):
1874         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
1875         (WebKit::AdClickAttributionManager::clear):
1876         (WebKit::AdClickAttributionManager::toString const):
1877         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
1878         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
1879         (WebKit::AdClickAttributionManager::store): Deleted.
1880         * NetworkProcess/AdClickAttributionManager.h:
1881         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
1882         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
1883         * NetworkProcess/NetworkSession.cpp:
1884         (WebKit::NetworkSession::storeAdClickAttribution):
1885
1886 2019-04-17  Tim Horton  <timothy_horton@apple.com>
1887
1888         UI↔Web deadlock when printing with a JavaScript alert visible
1889         https://bugs.webkit.org/show_bug.cgi?id=196839
1890         <rdar://problem/49157642>
1891
1892         Reviewed by Andy Estes.
1893
1894         * Platform/IPC/Connection.cpp:
1895         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
1896         (IPC::Connection::sendSyncReply):
1897         (IPC::Connection::dispatchSyncMessage):
1898         * Platform/IPC/Connection.h:
1899         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
1900         Keep track of whether we owe the other side of the connection any
1901         delayed sync replies.
1902
1903         * UIProcess/API/Cocoa/WKWebView.mm:
1904         (-[WKWebView _webViewPrintFormatter]):
1905         Most actions one can take with a _WKWebViewPrintFormatter involve
1906         synchronously messaging the Web Content process with an infinite timeout.
1907         Doing so while the Web Content process is awaiting a reply to a deferred-reply
1908         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
1909         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
1910         that we can't print right now.
1911
1912         * UIProcess/ios/WKContentView.mm:
1913         (-[WKContentView _wk_pageCountForPrintFormatter:]):
1914         (-[WKContentView _wk_printedDocument]):
1915         The above isn't sufficient, though, because a sync message could arrive and
1916         be handled between creation and use of the _WKWebViewPrintFormatter.
1917         So, we also bail with a zero page count and null CGPDFDocument immediately
1918         before we would send a sync message to the Web Content process. Clients
1919         handle this less gracefully (e.g. showing a zero page PDF), but it is
1920         very rare compared to the above case.
1921
1922 2019-04-17  Zalan Bujtas  <zalan@apple.com>
1923
1924         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
1925         https://bugs.webkit.org/show_bug.cgi?id=196988
1926         <rdar://problem/49955328>
1927
1928         Reviewed by Simon Fraser.
1929
1930         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
1931
1932         * WebProcess/WebPage/ios/WebPageIOS.mm:
1933         (WebKit::isAriaRoleForImmediateClick):
1934         (WebKit::nodeAlwaysRequiresClick):
1935         (WebKit::WebPage::handleSyntheticClick):
1936
1937 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1938
1939         WKRetainPtr's adoption constructor should be private
1940         https://bugs.webkit.org/show_bug.cgi?id=197019
1941
1942         Reviewed by Tim Horton.
1943
1944         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
1945
1946         * UIProcess/API/C/WKContext.cpp:
1947         (WKContextSetDownloadClient):
1948         * UIProcess/API/cpp/WKRetainPtr.h:
1949         (WebKit::WKRetainPtr::WKRetainPtr):
1950         (WebKit::adoptWK):
1951
1952 2019-04-17  Alex Christensen  <achristensen@webkit.org>
1953
1954         Fix crash during teardown of PingLoad
1955         https://bugs.webkit.org/show_bug.cgi?id=197024
1956         <rdar://problem/49973077>
1957
1958         Reviewed by Jer Noble.
1959
1960         * NetworkProcess/PingLoad.cpp:
1961         (WebKit::PingLoad::initialize):
1962         Early return if weakThis is null.
1963
1964 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1965
1966         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
1967         https://bugs.webkit.org/show_bug.cgi?id=197012
1968         <rdar://problem/49908848>
1969
1970         Reviewed by Simon Fraser.
1971
1972         We hit the release assertion due to the following sequence of events:
1973         - Dispatch a queued event (in this case, a scroll event)
1974         - Invoke the scroll event listener, which modifies layout in some way
1975         - This scrolls an overflow scrollable container under the scope of layout
1976         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
1977
1978         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
1979         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
1980         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
1981         we end up hitting the release assertion underneath the early return.
1982
1983         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
1984         instead of computing and sending the information immediately. While this only defers editor state updates during
1985         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
1986
1987         Test: editing/selection/overflow-scroll-while-selecting-text.html
1988
1989         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
1990         (WebKit::WebEditorClient::overflowScrollPositionChanged):
1991         * WebProcess/WebPage/WebPage.cpp:
1992         (WebKit::WebPage::didChangeOverflowScrollPosition):
1993         (WebKit::WebPage::didChangeSelection):
1994         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
1995         * WebProcess/WebPage/WebPage.h:
1996
1997 2019-04-17  Chris Dumez  <cdumez@apple.com>
1998
1999         Remember device orientation permission for the duration of the browsing session
2000         https://bugs.webkit.org/show_bug.cgi?id=196992
2001         <rdar://problem/49946067>
2002
2003         Reviewed by Alex Christensen.
2004
2005         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
2006         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
2007         remember the previous decision for the duration of the session and not prompt again.
2008
2009         * Shared/WebsitePoliciesData.cpp:
2010         (WebKit::WebsitePoliciesData::encode const):
2011         (WebKit::WebsitePoliciesData::decode):
2012         * Shared/WebsitePoliciesData.h:
2013         * UIProcess/API/APIWebsitePolicies.cpp:
2014         (API::WebsitePolicies::copy const):
2015         (API::WebsitePolicies::data):
2016         * UIProcess/API/APIWebsitePolicies.h:
2017         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2018         (toDeviceOrientationOrMotionPermissionState):
2019         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2020         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
2021         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2022         * UIProcess/WebPageProxy.cpp:
2023         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
2024         * UIProcess/WebPageProxy.h:
2025         * UIProcess/WebPageProxy.messages.in:
2026         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
2027         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
2028         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
2029         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
2030         * UIProcess/WebsiteData/WebsiteDataStore.h:
2031         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
2032         * WebKit.xcodeproj/project.pbxproj:
2033         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2034         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
2035         * WebProcess/WebCoreSupport/WebChromeClient.h:
2036         * WebProcess/WebPage/WebPage.cpp:
2037         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
2038         * WebProcess/WebPage/WebPage.h:
2039
2040 2019-04-16  Andy Estes  <aestes@apple.com>
2041
2042         [iOSMac] Use UIDocumentPickerViewController for picking files
2043         https://bugs.webkit.org/show_bug.cgi?id=196999
2044         <rdar://problem/49961414>
2045
2046         Reviewed by Tim Horton.
2047
2048         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2049         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2050         Changed to present a UIDocumentPickerViewController on iOSMac.
2051
2052         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
2053         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
2054         Replaced a deprecated delegate method implementation.
2055
2056 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2057
2058         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
2059         https://bugs.webkit.org/show_bug.cgi?id=196919
2060         <rdar://problem/41630459>
2061
2062         Reviewed by Tim Horton.
2063
2064         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
2065         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
2066
2067         * Platform/spi/ios/UIKitSPI.h:
2068
2069         Declare the private -dontDismiss property of UIMenuItem.
2070
2071         * UIProcess/API/Cocoa/WKWebView.mm:
2072         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
2073
2074         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
2075         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
2076         controller. This scenario is exercised by the new layout test.
2077
2078         * UIProcess/ios/WKContentViewInteraction.h:
2079         * UIProcess/ios/WKContentViewInteraction.mm:
2080         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
2081
2082         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
2083         to fade the callout bar until after the next remote layer tree commit.
2084
2085         (-[WKContentView _updateChangedSelection:]):
2086
2087         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
2088         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
2089         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
2090         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
2091         would be stale after triggering these actions. This effect is most noticeable when bolding text.
2092
2093         (-[WKContentView shouldAllowHidingSelectionCommands]):
2094
2095 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
2096
2097         Unreviewed non-unified build fix after r244307.
2098
2099         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2100
2101 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
2102
2103         Allow sharing from imageSheet on an image document
2104         https://bugs.webkit.org/show_bug.cgi?id=196891
2105         <rdar://problem/25377386>
2106
2107         Reviewed by Tim Horton.
2108
2109         Allow sharing from an image sheet generated from an image document
2110         by storing the image URL and using it as a fallback for the URL.
2111         Store it as an image on WKElementAction to not accidentally trigger
2112         any actions that should actually be associated with pure URLs.
2113
2114         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
2115         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
2116         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
2117         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
2118         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
2119         (-[_WKActivatedElementInfo imageURL]):
2120         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
2121         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
2122         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
2123         * UIProcess/API/Cocoa/_WKElementAction.mm:
2124         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2125         * UIProcess/ios/WKActionSheetAssistant.mm:
2126         (-[WKActionSheetAssistant showImageSheet]):
2127         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
2128         (-[WKActionSheetAssistant showLinkSheet]):
2129         * UIProcess/ios/WKContentViewInteraction.mm:
2130         (-[WKContentView _showAttachmentSheet]):
2131         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2132         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2133
2134 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2135
2136         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
2137         https://bugs.webkit.org/show_bug.cgi?id=196977
2138         <rdar://problem/49871194>
2139
2140         Reviewed by Tim Horton.
2141
2142         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
2143         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
2144         implements the new navigation delegate API.
2145
2146         * UIProcess/API/APINavigationClient.h:
2147         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
2148         * UIProcess/Cocoa/NavigationState.h:
2149         * UIProcess/Cocoa/NavigationState.mm:
2150         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
2151
2152 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
2153
2154         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
2155         https://bugs.webkit.org/show_bug.cgi?id=196991
2156         <rdar://problem/45507423>
2157
2158         Reviewed by Brent Fulgham.
2159
2160         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
2161         a proper process access type needs to be set for the credential Website data type.
2162
2163         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2164         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2165
2166 2019-04-16  Alex Christensen  <achristensen@webkit.org>
2167
2168         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
2169         https://bugs.webkit.org/show_bug.cgi?id=196995
2170
2171         Reviewed by Brady Eidson.
2172
2173         Always call CompletionHandlers.  Otherwise things hang or assert.
2174         I added an API test that asserts without this change so we don't regress this again.
2175
2176         * NetworkProcess/cache/CacheStorageEngine.cpp:
2177         (WebKit::CacheStorage::Engine::clearAllCaches):
2178         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2179
2180 2019-04-16  Chris Dumez  <cdumez@apple.com>
2181
2182         URL set by document.open() is not communicated to the UIProcess
2183         https://bugs.webkit.org/show_bug.cgi?id=196941
2184         <rdar://problem/49237544>
2185
2186         Reviewed by Geoff Garen.
2187
2188         Whenever the UIProcess is notified of an explicit document.open() call, update the
2189         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
2190         knows it committed a load (i.e. It is no longer showing the initially empty document).
2191
2192         * UIProcess/PageLoadState.cpp:
2193         (WebKit::PageLoadState::didExplicitOpen):
2194         * UIProcess/PageLoadState.h:
2195         * UIProcess/WebPageProxy.cpp:
2196         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2197         * UIProcess/WebPageProxy.h:
2198         * UIProcess/WebPageProxy.messages.in:
2199         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2200         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2201         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2202
2203 2019-04-16  Chris Dumez  <cdumez@apple.com>
2204
2205         Show prompt for device orientation access if the client does not implement the corresponding API delegate
2206         https://bugs.webkit.org/show_bug.cgi?id=196971
2207         <rdar://problem/49945840>
2208
2209         Reviewed by Alex Christensen.
2210
2211         Show prompt for device orientation access if the client does not implement the corresponding
2212         API delegate, instead of rejecting access by default.
2213
2214         * UIProcess/Cocoa/UIDelegate.mm:
2215         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2216         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
2217         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
2218         (WebKit::presentOrientationAccessAlert):
2219         * WebKit.xcodeproj/project.pbxproj:
2220
2221 2019-04-16  Zalan Bujtas  <zalan@apple.com>
2222
2223         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
2224         https://bugs.webkit.org/show_bug.cgi?id=196975
2225         <rdar://problem/49489849>
2226
2227         Reviewed by Simon Fraser.
2228
2229         This patch ensures that we always proceed with synthetic click on form elements.
2230
2231         Covered by existing tests.
2232
2233         * WebProcess/WebPage/ios/WebPageIOS.mm:
2234         (WebKit::WebPage::handleSyntheticClick):
2235
2236 2019-04-16  Timothy Hatcher  <timothy@apple.com>
2237
2238         FrameView base background color always starts white.
2239         https://bugs.webkit.org/show_bug.cgi?id=196976
2240
2241         Reviewed by Beth Dakin.
2242
2243         * WebProcess/WebPage/WebPage.cpp:
2244         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
2245         WebFrame::createWithCoreMainFrame so the call to create the FrameView
2246         for the empty page in transitionToCommittedForNewPage() gets
2247         the correct color from WebPage.
2248
2249 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
2250
2251         Unreviewed, fix the build with recent SDKs.
2252
2253         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2254         (WebKit::WKWebViewState::store):
2255
2256 2019-04-16  Commit Queue  <commit-queue@webkit.org>
2257
2258         Unreviewed, rolling out r244321.
2259         https://bugs.webkit.org/show_bug.cgi?id=196968
2260
2261         Causing all WK2 Debug builds to exit early after Assertion
2262         failures. (Requested by ShawnRoberts on #webkit).
2263
2264         Reverted changeset:
2265
2266         "URL set by document.open() is not communicated to the
2267         UIProcess"
2268         https://bugs.webkit.org/show_bug.cgi?id=196941
2269         https://trac.webkit.org/changeset/244321
2270
2271 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
2272
2273         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
2274         https://bugs.webkit.org/show_bug.cgi?id=196954
2275         <rdar://problem/48716433>
2276
2277         Reviewed by Ryosuke Niwa.
2278
2279         * UIProcess/mac/WebInspectorProxyMac.mm:
2280         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2281
2282 2019-04-15  Chris Dumez  <cdumez@apple.com>
2283
2284         URL set by document.open() is not communicated to the UIProcess
2285         https://bugs.webkit.org/show_bug.cgi?id=196941
2286         <rdar://problem/49237544>
2287
2288         Reviewed by Geoffrey Garen.
2289
2290         Whenever the UIProcess is notified of an explicit document.open() call, update the
2291         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
2292         knows it committed a load (i.e. It is no longer showing the initially empty document).
2293
2294         * UIProcess/PageLoadState.cpp:
2295         (WebKit::PageLoadState::didExplicitOpen):
2296         * UIProcess/PageLoadState.h:
2297         * UIProcess/WebPageProxy.cpp:
2298         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2299         * UIProcess/WebPageProxy.h:
2300         * UIProcess/WebPageProxy.messages.in:
2301         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2302         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2303         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2304
2305 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2306
2307         Stop using hyphenationFactor
2308         https://bugs.webkit.org/show_bug.cgi?id=196949
2309         <rdar://problem/49779594>
2310
2311         Reviewed by Geoffrey Garen.
2312
2313         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2314         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
2315         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
2316         There is a reason to remove it in the radar.
2317
2318 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2319
2320         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
2321
2322         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2323         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
2324
2325 2019-04-15  Jer Noble  <jer.noble@apple.com>
2326
2327         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
2328         https://bugs.webkit.org/show_bug.cgi?id=196773
2329
2330         Reviewed by Alex Christensen.
2331
2332         In addition to adding the new logging delegate method (and piping everything into it), 
2333         add a new APIObject class to represent a signed integer.
2334
2335         * Shared/API/APINumber.h:
2336         * Shared/API/APIObject.h:
2337         * Shared/Cocoa/APIObject.mm:
2338         (API::Object::newObject):
2339         * Shared/Cocoa/WKNSNumber.mm:
2340         (-[WKNSNumber dealloc]):
2341         (-[WKNSNumber objCType]):
2342         (-[WKNSNumber getValue:]):
2343         (-[WKNSNumber longLongValue]):
2344         (-[WKNSNumber _apiObject]):
2345         * Shared/UserData.cpp:
2346         (WebKit::UserData::encode):
2347         (WebKit::UserData::decode):
2348         * UIProcess/API/APIDiagnosticLoggingClient.h:
2349         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
2350         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2351         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2352         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
2353         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2354         * UIProcess/ProvisionalPageProxy.cpp:
2355         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2356         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
2357         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2358         * UIProcess/WebPageDiagnosticLoggingClient.h:
2359         * UIProcess/WebPageProxy.cpp:
2360         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
2361         * UIProcess/WebPageProxy.h:
2362         * UIProcess/WebPageProxy.messages.in:
2363         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
2364         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2365         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2366
2367 2019-04-15  Dean Jackson  <dino@apple.com>
2368
2369         Provide option to not create a longpress gesture recognizer
2370         https://bugs.webkit.org/show_bug.cgi?id=196937
2371         <rdar://problem/49918278>
2372
2373         Build fix for iOS platforms that don't have link preview.
2374
2375         * UIProcess/ios/WKContentViewInteraction.mm:
2376         (-[WKContentView setupInteraction]):
2377
2378 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
2379
2380         InjectedBundle parameters often need initialization function called before unarchiving
2381         https://bugs.webkit.org/show_bug.cgi?id=189709
2382         <rdar://problem/44573653>
2383
2384         Reviewed by Ryosuke Niwa.
2385
2386         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2387         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2388         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2389         register additional classes that are safe for serialization.
2390
2391         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
2392         to be serialized by the InjectedBundle.
2393         
2394         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2395         Revise 'initialize' to call this new method.
2396
2397         * WebProcess/InjectedBundle/InjectedBundle.h:
2398         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2399         (WebKit::InjectedBundle::initialize): Use the new method.
2400         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2401         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2402         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2403         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2404         NSDictionary object may itself hold other kinds of objects.
2405         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2406         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
2407
2408 2019-04-15  Dean Jackson  <dino@apple.com>
2409
2410         Provide option to not create a longpress gesture recognizer
2411         https://bugs.webkit.org/show_bug.cgi?id=196937
2412         <rdar://problem/49918278>
2413
2414         Reviewed by Antoine Quint.
2415
2416         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
2417
2418         Add a property to toggle if we should add a long press gesture
2419         recognizer.
2420
2421         * UIProcess/ios/WKContentViewInteraction.h:
2422         * UIProcess/ios/WKContentViewInteraction.mm:
2423         (-[WKContentView setupInteraction]):
2424         (shouldUsePreviewForLongPress):
2425         (-[WKContentView shouldUsePreviewForLongPress]):
2426
2427 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
2428
2429         [CMake] WebCore derived sources should only be referenced inside WebCore
2430         https://bugs.webkit.org/show_bug.cgi?id=196904
2431
2432         Reviewed by Konstantin Tokarev.
2433
2434         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
2435
2436         * PlatformMac.cmake:
2437
2438 2019-04-15  Zalan Bujtas  <zalan@apple.com>
2439
2440         DrawingArea should only capture painting related milestones
2441         https://bugs.webkit.org/show_bug.cgi?id=196926
2442         <rdar://problem/48003845>
2443
2444         Reviewed by Tim Horton.
2445
2446         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
2447         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
2448         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
2449
2450         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2451         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
2452         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
2453         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
2454         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
2455         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2456         (WebKit::RemoteLayerTreeTransaction::encode const):
2457         (WebKit::RemoteLayerTreeTransaction::decode):
2458         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2459         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2460         * WebProcess/WebPage/DrawingArea.h:
2461         (WebKit::DrawingArea::addMilestonesToDispatch):
2462         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2463         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2464         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
2465         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2466         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2467         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2468         * WebProcess/WebPage/WebPage.cpp:
2469         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2470         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2471         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
2472         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2473         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
2474         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2475         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
2476         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2477
2478 2019-04-15  John Wilander  <wilander@apple.com>
2479
2480         Send delayed Ad Click Attribution conversion requests to the click source
2481         https://bugs.webkit.org/show_bug.cgi?id=196838
2482         <rdar://problem/47650157>
2483
2484         Reviewed by Chris Dumez and Youenn Fablet.
2485
2486         This patch schedules a conversion request with appropriate data going to the
2487         click source as a result of an ad click conversion.
2488
2489         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
2490         infrastructure to make the request. This will probably be reworked into a
2491         dedicated load class further on.
2492
2493         New test infrastructure allows for an override of both the conversion URL
2494         and the 24-48 hour timer.
2495
2496         * NetworkProcess/AdClickAttributionManager.cpp: Added.
2497         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
2498         (WebKit::AdClickAttributionManager::store):
2499         (WebKit::AdClickAttributionManager::startTimer):
2500             Convenience function to support test override.
2501         (WebKit::AdClickAttributionManager::convert):
2502             This function now sets the timer.
2503         (WebKit::AdClickAttributionManager::fireConversionRequest):
2504             Fire an individual request.
2505         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
2506             This is the timer function that iterates over all pending attributions.
2507         (WebKit::AdClickAttributionManager::clear):
2508             Now clears the two new test settings members.
2509         (WebKit::AdClickAttributionManager::toString const):
2510         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
2511         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2512         (WebKit::AdClickAttributionManager::setPingLoadFunction):
2513         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
2514         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
2515         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
2516         * NetworkProcess/NetworkProcess.cpp:
2517         (WebKit::NetworkProcess::storeAdClickAttribution):
2518         (WebKit::NetworkProcess::dumpAdClickAttribution):
2519         (WebKit::NetworkProcess::clearAdClickAttribution):
2520         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
2521         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
2522         * NetworkProcess/NetworkProcess.h:
2523         * NetworkProcess/NetworkProcess.messages.in:
2524         * NetworkProcess/NetworkSession.cpp:
2525         (WebKit::NetworkSession::NetworkSession):
2526         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
2527         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
2528         * NetworkProcess/NetworkSession.h:
2529         * NetworkProcess/PingLoad.cpp:
2530         (WebKit::PingLoad::PingLoad):
2531         (WebKit::m_blobFiles):
2532         (WebKit::PingLoad::initialize):
2533             The PingLoad constructor is now split in two to allow for construction
2534             without a WebKit::NetworkConnectionToWebProcess object. The body of
2535             the constructor was moved into the new initialize() function which is
2536             shared between constructors.
2537         * NetworkProcess/PingLoad.h:
2538         * Sources.txt:
2539             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
2540             NetworkProcess/NetworkAdClickAttribution.cpp.
2541         * UIProcess/API/C/WKPage.cpp:
2542         (WKPageSetAdClickAttributionOverrideTimerForTesting):
2543         (WKPageSetAdClickAttributionConversionURLForTesting):
2544         * UIProcess/API/C/WKPagePrivate.h:
2545         * UIProcess/Network/NetworkProcessProxy.cpp:
2546         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
2547         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
2548         * UIProcess/Network/NetworkProcessProxy.h:
2549         * UIProcess/WebPageProxy.cpp:
2550         (WebKit::WebPageProxy::dumpAdClickAttribution):
2551         (WebKit::WebPageProxy::clearAdClickAttribution):
2552         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
2553         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
2554         * UIProcess/WebPageProxy.h:
2555         * UIProcess/WebProcessPool.cpp:
2556         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
2557         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
2558         * UIProcess/WebProcessPool.h:
2559         * WebKit.xcodeproj/project.pbxproj:
2560
2561 2019-04-15  Devin Rousso  <drousso@apple.com>
2562
2563         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
2564         https://bugs.webkit.org/show_bug.cgi?id=196872
2565         <rdar://problem/49233240>
2566
2567         Reviewed by Joseph Pecoraro.
2568
2569         * UIProcess/Automation/WebAutomationSession.cpp:
2570         (WebKit::WebAutomationSession::addSingleCookie):
2571         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
2572         itself to figure out which domain it should be set on.
2573
2574 2019-04-15  Philippe Normand  <pnormand@igalia.com>
2575
2576         [GTK][WPE] Add enable-media websetting
2577         https://bugs.webkit.org/show_bug.cgi?id=196863
2578
2579         Reviewed by Michael Catanzaro.
2580
2581         It can be useful for headless browsers, for instance. The setting is enabled by default.
2582
2583         * Shared/WebPreferences.yaml:
2584         * UIProcess/API/glib/WebKitSettings.cpp:
2585         (webKitSettingsSetProperty):
2586         (webKitSettingsGetProperty):
2587         (webkit_settings_class_init):
2588         (webkit_settings_get_enable_media):
2589         (webkit_settings_set_enable_media):
2590         * UIProcess/API/gtk/WebKitSettings.h:
2591         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2592         * UIProcess/API/wpe/WebKitSettings.h:
2593         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
2594
2595 2019-04-14  Rob Buis  <rbuis@igalia.com>
2596
2597         Link prefetch not useful for top-level navigation
2598         https://bugs.webkit.org/show_bug.cgi?id=195623
2599
2600         Reviewed by Youenn Fablet.
2601
2602         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
2603         to the same url is done within a threshold (5 seconds), reuse the
2604         prefetch cache entry, move it to the disk cache and navigate to
2605         the url, meaning no extra network trip is needed. When not used within
2606         the threshold period, the prefetch entry will be erased using a timer.
2607
2608         * NetworkProcess/NetworkProcess.cpp:
2609         (WebKit::NetworkProcess::lowMemoryHandler):
2610         * NetworkProcess/NetworkProcess.h:
2611         (WebKit::NetworkProcess::prefetchCache):
2612         * NetworkProcess/NetworkResourceLoader.cpp:
2613         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2614         (WebKit::NetworkResourceLoader::didReceiveResponse):
2615         (WebKit::NetworkResourceLoader::didReceiveBuffer):
2616         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2617         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
2618         * NetworkProcess/NetworkResourceLoader.h:
2619         * NetworkProcess/cache/PrefetchCache.cpp: Added.
2620         (WebKit::PrefetchCache::Entry::Entry):
2621         (WebKit::PrefetchCache::PrefetchCache):
2622         (WebKit::PrefetchCache::~PrefetchCache):
2623         (WebKit::PrefetchCache::clear):
2624         (WebKit::PrefetchCache::take):
2625         (WebKit::PrefetchCache::store):
2626         (WebKit::PrefetchCache::sessionPrefetchMap const):
2627         (WebKit::PrefetchCache::clearExpiredEntries):
2628         * NetworkProcess/cache/PrefetchCache.h: Added.
2629         (WebKit::PrefetchCache::Entry::response const):
2630         (WebKit::PrefetchCache::Entry::releaseBuffer):
2631         * Shared/WebPreferences.yaml:
2632         * Sources.txt:
2633         * WebKit.xcodeproj/project.pbxproj:
2634
2635 2019-04-14  Andy Estes  <aestes@apple.com>
2636
2637         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
2638         https://bugs.webkit.org/show_bug.cgi?id=196893
2639         <rdar://problem/48318983>
2640
2641         Reviewed by Anders Carlsson.
2642
2643         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
2644         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
2645         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
2646         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
2647         the LegacyCustomProtocolManagerProxy has been destroyed.
2648
2649         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
2650         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
2651         (-[WKCustomProtocolLoader cancel]):
2652         (-[WKCustomProtocolLoader connection:didFailWithError:]):
2653         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
2654         (-[WKCustomProtocolLoader connection:didReceiveData:]):
2655         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
2656         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
2657         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
2658         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
2659         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
2660         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
2661
2662 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
2663
2664         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
2665         https://bugs.webkit.org/show_bug.cgi?id=196742
2666
2667         Reviewed by Konstantin Tokarev.
2668
2669         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
2670
2671         * CMakeLists.txt:
2672         * PlatformWin.cmake:
2673         
2674         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
2675
2676 2019-04-13  Chris Dumez  <cdumez@apple.com>
2677
2678         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
2679         https://bugs.webkit.org/show_bug.cgi?id=196548
2680         <rdar://problem/49567254>
2681
2682         Reviewed by Darin Adler.
2683
2684         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
2685         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
2686         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
2687         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
2688         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
2689         incoming IPC that is not for its associated navigation.
2690
2691         * UIProcess/ProvisionalPageProxy.cpp:
2692         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
2693         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2694         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2695         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2696         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
2697         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
2698         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2699         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2700         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
2701         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2702         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
2703
2704 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2705
2706         Unreviewed, try to fix the internal build after r244239
2707
2708         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
2709         import that was missing anyways.
2710
2711         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2712
2713 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2714
2715         Enable modern compatibility mode by default in WKWebView on some devices
2716         https://bugs.webkit.org/show_bug.cgi?id=196883
2717         <rdar://problem/49864527>
2718
2719         Reviewed by Tim Horton.
2720
2721         Make some minor adjustments to new API.
2722
2723         * Shared/WebCompatibilityMode.h:
2724
2725         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
2726
2727         * Shared/WebPreferences.yaml:
2728         * Shared/WebPreferencesDefaultValues.h:
2729
2730         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
2731         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
2732
2733         * UIProcess/API/APIWebsitePolicies.h:
2734         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2735
2736         Rename the withPreferences: label to just preferences:.
2737
2738         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2739         * UIProcess/Cocoa/NavigationState.mm:
2740         (WebKit::NavigationState::setNavigationDelegate):
2741         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2742         * UIProcess/Cocoa/VersionChecks.h:
2743         * UIProcess/ios/WebPageProxyIOS.mm:
2744
2745 2019-04-12  Brian Burg  <bburg@apple.com>
2746
2747         WebDriver: fix typo in EnterFullscreen.js in error-handling code
2748         https://bugs.webkit.org/show_bug.cgi?id=196882
2749         <rdar://problem/49867122>
2750
2751         Reviewed by Devin Rousso.
2752
2753         * UIProcess/Automation/atoms/EnterFullscreen.js:
2754         (enterFullscreen):
2755
2756 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
2757
2758         Unreviewed fix for non-unified build.
2759
2760         * Shared/PrintInfo.cpp:
2761         Add missing include from r244202.
2762
2763 2019-04-12  Saam barati  <sbarati@apple.com>
2764
2765         Sometimes we need to user fewer CPUs in our threading calculations
2766         https://bugs.webkit.org/show_bug.cgi?id=196794
2767         <rdar://problem/49389497>
2768
2769         Reviewed by Yusuke Suzuki.
2770
2771         * WebProcess/com.apple.WebProcess.sb.in:
2772
2773 2019-04-12  Devin Rousso  <drousso@apple.com>
2774
2775         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
2776         https://bugs.webkit.org/show_bug.cgi?id=196847
2777         <rdar://problem/49609396>
2778
2779         Reviewed by Brian Burg.
2780
2781         * UIProcess/Automation/WebAutomationSession.cpp:
2782         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2783
2784 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
2785
2786         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
2787         https://bugs.webkit.org/show_bug.cgi?id=196845
2788
2789         Reviewed by Ryosuke Niwa.
2790
2791         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
2792         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2793         * NetworkProcess/NetworkDataTask.cpp:
2794         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
2795         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
2796         * NetworkProcess/NetworkProcess.cpp:
2797         * NetworkProcess/NetworkResourceLoadMap.cpp:
2798         * NetworkProcess/NetworkResourceLoadMap.h:
2799         * NetworkProcess/NetworkResourceLoader.cpp:
2800         * NetworkProcess/PingLoad.h:
2801         * Shared/WebCompiledContentRuleListData.cpp:
2802         * Shared/gtk/WebEventFactory.cpp:
2803         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2804         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2805         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2806         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2807         * UIProcess/Downloads/DownloadProxyMap.cpp:
2808         * UIProcess/InspectorTargetProxy.cpp:
2809         * UIProcess/PageClient.h:
2810         * UIProcess/ProcessAssertion.cpp:
2811         * UIProcess/ProvisionalPageProxy.h:
2812         * UIProcess/WebPageInspectorTargetAgent.h:
2813         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
2814         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2815         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
2816         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2817         (WKBundleSetDatabaseQuota):
2818         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
2819         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
2820
2821 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
2822
2823         Update AudioSession route sharing policy
2824         https://bugs.webkit.org/show_bug.cgi?id=196776
2825         <rdar://problem/46501611>
2826
2827         Reviewed by Jer Noble.
2828
2829         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
2830         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
2831
2832 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2833
2834         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
2835         https://bugs.webkit.org/show_bug.cgi?id=196862
2836
2837         Reviewed by Darin Adler.
2838
2839         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
2840         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
2841
2842         * UIProcess/API/APIWebsitePolicies.cpp:
2843         (API::WebsitePolicies::copy const):
2844
2845 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
2846
2847         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
2848         https://bugs.webkit.org/show_bug.cgi?id=196803
2849         rdar://problem/49078202
2850
2851         Reviewed by Antti Koivisto.
2852
2853         Flip LegacyOverflowScrollingTouchEnabled to false.
2854
2855         * Shared/WebPreferences.yaml:
2856
2857 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2858
2859         [iOS] Software keyboard is shown too frequently on some websites
2860         https://bugs.webkit.org/show_bug.cgi?id=195856
2861         <rdar://problem/49191395>
2862
2863         Reviewed by Darin Adler.
2864
2865         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
2866         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
2867         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
2868         when the element is focused.
2869
2870         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
2871         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
2872         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
2873         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
2874         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
2875         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
2876         hardware keyboard is not attached.
2877
2878         * UIProcess/API/Cocoa/WKWebView.mm:
2879         (hardwareKeyboardAvailabilityChangedCallback):
2880         * UIProcess/ios/WKContentViewInteraction.h:
2881         * UIProcess/ios/WKContentViewInteraction.mm:
2882         (-[WKContentView shouldShowAutomaticKeyboardUI]):
2883
2884         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
2885
2886         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
2887
2888         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
2889         element with inputmode="none", we'll show the input accessory view once again.
2890
2891 2019-04-12  Antoine Quint  <graouts@apple.com>
2892
2893         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
2894         https://bugs.webkit.org/show_bug.cgi?id=196830
2895         <rdar://problem/49124313>
2896
2897         Reviewed by Wenson Hsieh.
2898
2899         We add a new policy to determine whether simulated mouse events dispatch are allowed.
2900
2901         * Shared/WebsitePoliciesData.cpp:
2902         (WebKit::WebsitePoliciesData::encode const):
2903         (WebKit::WebsitePoliciesData::decode):
2904         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2905         * Shared/WebsitePoliciesData.h:
2906         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
2907         * UIProcess/API/APIWebsitePolicies.cpp:
2908         (API::WebsitePolicies::copy const):
2909         (API::WebsitePolicies::data):
2910         * UIProcess/API/APIWebsitePolicies.h:
2911         * WebKit.xcodeproj/project.pbxproj:
2912
2913 2019-04-12  Chris Dumez  <cdumez@apple.com>
2914
2915         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
2916         https://bugs.webkit.org/show_bug.cgi?id=196781
2917         <rdar://problem/49789381>
2918
2919         Reviewed by Darin Adler.
2920
2921         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
2922         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
2923         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
2924         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
2925
2926         * UIProcess/Downloads/DownloadProxyMap.cpp:
2927         (WebKit::DownloadProxyMap::invalidate):
2928         (WebKit::DownloadProxyMap::processDidClose): Deleted.
2929         * UIProcess/Downloads/DownloadProxyMap.h:
2930         * UIProcess/Network/NetworkProcessProxy.cpp:
2931         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2932         (WebKit::NetworkProcessProxy::didClose):
2933
2934 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2935
2936         [GTK] REGRESSION(r243860): Many tests failing
2937         https://bugs.webkit.org/show_bug.cgi?id=196791
2938
2939         Reviewed by Joanmarie Diggs.
2940
2941         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
2942         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
2943         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
2944         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
2945         notified of the changes in the accessibility tree.
2946
2947         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2948         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
2949         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
2950         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2951         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
2952         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
2953         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
2954         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
2955         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
2956         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2957
2958 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
2959
2960         Update 'Save Image' to more clear instructions
2961         https://bugs.webkit.org/show_bug.cgi?id=196833
2962         <rdar://problem/47446845>
2963
2964         Reviewed by Wenson Hsieh.
2965
2966         Just updating to a new string.
2967
2968         * UIProcess/API/Cocoa/_WKElementAction.mm:
2969         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2970
2971 2019-04-11  Chris Dumez  <cdumez@apple.com>
2972
2973         Unable to run system Safari with trunk WebKit
2974         https://bugs.webkit.org/show_bug.cgi?id=196777
2975         <rdar://problem/49784574>
2976
2977         Reviewed by Alex Christensen.
2978
2979         * UIProcess/API/Cocoa/WKWebView.mm:
2980         (-[WKWebView _initializeWithConfiguration:]):
2981         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
2982         data store only happens for apps rebuilt using recent SDK.
2983
2984         * UIProcess/Cocoa/VersionChecks.h:
2985         * UIProcess/Cocoa/VersionChecks.mm:
2986         (WebKit::linkedOnOrAfter):
2987         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
2988           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
2989           be controlled by the caller.
2990         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
2991           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
2992           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
2993           0 value for sdkVersion.
2994
2995 2019-04-11  Zalan Bujtas  <zalan@apple.com>
2996
2997         Add @page margin support
2998         https://bugs.webkit.org/show_bug.cgi?id=196680
2999         <rdar://problem/45217707>
3000
3001         Reviewed by Tim Horton.
3002
3003         * Shared/PrintInfo.cpp:
3004         (WebKit::PrintInfo::encode const):
3005         (WebKit::PrintInfo::decode):
3006         * Shared/PrintInfo.h:
3007         * Shared/WebPreferences.yaml:
3008         * Shared/gtk/PrintInfoGtk.cpp:
3009         (WebKit::PrintInfo::PrintInfo):
3010         * Shared/mac/PrintInfoMac.mm:
3011         (WebKit::PrintInfo::PrintInfo):
3012         * UIProcess/API/C/WKPage.cpp:
3013         (WKPageComputePagesForPrinting):
3014         * UIProcess/API/C/WKPreferences.cpp:
3015         (WKPreferencesSetPageAtRuleSupportEnabled):
3016         (WKPreferencesGetPageAtRuleSupportEnabled):
3017         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3018         * UIProcess/GenericCallback.h:
3019         * UIProcess/WebPageProxy.cpp:
3020         (WebKit::WebPageProxy::computedPagesCallback):
3021         * UIProcess/WebPageProxy.h:
3022         * UIProcess/WebPageProxy.messages.in:
3023         * UIProcess/mac/WKPrintingView.mm:
3024         (pageDidComputePageRects):
3025         (-[WKPrintingView _askPageToComputePageRects]):
3026         * WebProcess/WebPage/WebPage.cpp:
3027         (WebKit::WebPage::beginPrinting):
3028         (WebKit::WebPage::computePagesForPrinting):
3029         (WebKit::WebPage::computePagesForPrintingImpl):
3030         * WebProcess/WebPage/WebPage.h:
3031         * WebProcess/WebPage/ios/WebPageIOS.mm:
3032         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
3033
3034 2019-04-11  Dean Jackson  <dino@apple.com>
3035
3036         Extract UTI mapping and allow for additions
3037         https://bugs.webkit.org/show_bug.cgi?id=196822
3038         <rdar://problem/49822339>
3039
3040         Reviewed by Tim Horton.
3041
3042         Use the new helper to map MIME type to UTI.
3043
3044         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3045         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3046         * UIProcess/ios/WKSystemPreviewView.mm:
3047         (getUTIForSystemPreviewMIMEType):
3048
3049
3050 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3051
3052         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
3053         https://bugs.webkit.org/show_bug.cgi?id=196825
3054
3055         Reviewed by Simon Fraser.
3056
3057         Ensure the layer transactions IDs are sequential. So bail out of
3058         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
3059
3060         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
3061         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3062         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3063
3064 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3065
3066         Allow the MediaSource API to be enabled via website policy
3067         https://bugs.webkit.org/show_bug.cgi?id=196429
3068         <rdar://problem/48774333>
3069
3070         Reviewed by Tim Horton.
3071
3072         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
3073
3074         * Shared/WebPreferences.yaml:
3075
3076         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
3077         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
3078         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
3079
3080         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
3081         compatibility mode on WKWebpagePreferences.
3082
3083         * Shared/WebPreferences.yaml:
3084         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
3085         * Shared/WebsitePoliciesData.cpp:
3086         (WebKit::WebsitePoliciesData::encode const):
3087         (WebKit::WebsitePoliciesData::decode):
3088
3089         Add plumbing for m_mediaSourcePolicy in the set of website policies.
3090
3091         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3092
3093         Update the document loader with the given media source policy. There are two possibilities when applying the set
3094         of policies to the document loader; either the document loader is already attached to a Frame, or the document
3095         loader is yet to be attached to a Frame.
3096
3097         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
3098         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
3099         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
3100
3101         * Shared/WebsitePoliciesData.h:
3102         * UIProcess/API/APIWebsitePolicies.cpp:
3103         (API::WebsitePolicies::data):
3104         * UIProcess/API/APIWebsitePolicies.h:
3105         * UIProcess/API/C/WKPage.cpp:
3106         (WKPageSetPageNavigationClient):
3107         * UIProcess/Cocoa/NavigationState.mm:
3108         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3109
3110         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
3111         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
3112         default website policies on the web view configuration, even when using the C API to set the navigation client,
3113         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
3114         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
3115         webpage preferences.
3116
3117         * UIProcess/WebPageProxy.cpp:
3118         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3119         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
3120         * UIProcess/WebPageProxy.h:
3121         * WebKit.xcodeproj/project.pbxproj:
3122
3123 2019-04-11  Antti Koivisto  <antti@apple.com>
3124
3125         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
3126         https://bugs.webkit.org/show_bug.cgi?id=196813
3127         <rdar://problem/49393264>
3128
3129         Reviewed by Simon Fraser.
3130
3131         No test, can't repro.
3132
3133         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3134         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
3135
3136         Null check the nodes.
3137
3138 2019-04-10  Chris Dumez  <cdumez@apple.com>
3139
3140         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
3141         https://bugs.webkit.org/show_bug.cgi?id=196784
3142
3143         Reviewed by Antti Koivisto.
3144
3145         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
3146         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
3147         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
3148         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
3149         not sometimes be gone by the time we need it.
3150
3151         * UIProcess/SuspendedPageProxy.cpp:
3152         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
3153
3154 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3155
3156         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
3157         https://bugs.webkit.org/show_bug.cgi?id=196809
3158         <rdar://49800762>
3159
3160         Reviewed by Brady Eidson.
3161
3162         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3163         (-[WKNavigationResponse _downloadAttribute]):
3164
3165 2019-04-10  Tim Horton  <timothy_horton@apple.com>
3166
3167         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
3168         https://bugs.webkit.org/show_bug.cgi?id=196797
3169         <rdar://problem/48484715>
3170
3171         Reviewed by Simon Fraser.
3172
3173         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3174         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
3175         Validate the set of modifier keys pressed when handling a key event for scrolling:
3176         Ignore key events with multiple modifier keys pressed.
3177         Ignore key events with an invalid modifier key pressed for a given primary key.
3178
3179 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
3180
3181         requestAnimationFrame should execute before the next frame
3182         https://bugs.webkit.org/show_bug.cgi?id=177484
3183
3184         Reviewed by Simon Fraser.
3185
3186         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
3187         a single call to Page::updateRendering(). This new function implements 
3188         "Update the rendering" step of the HTML Event Loop specification
3189         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
3190
3191         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3192         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
3193         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
3194         (WebKit::DrawingAreaCoordinatedGraphics::display):
3195         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3196         (WebKit::LayerTreeHost::layerFlushTimerFired):
3197
3198         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3199         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3200         -- Call Page::updateRendering() to make sure that "Update the rendering"
3201            happens immediately before updating the page.
3202
3203         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
3204            to be exactly before flushing the layers. This fixes the assertion
3205            ASSERT(m_inLayerFlush) which was firing when running a layout test.
3206            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
3207            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
3208            twice before calling didFlushLayers().
3209
3210         * WebProcess/WebPage/WebPage.cpp:
3211         (WebKit::WebPage::layoutIfNeeded):
3212         (WebKit::WebPage::updateRendering):
3213         (WebKit::WebPage::willDisplayPage): Deleted.
3214         * WebProcess/WebPage/WebPage.h:
3215         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3216         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3217
3218 2019-04-10  Devin Rousso  <drousso@apple.com>
3219
3220         Web Inspector: save sheet should be anchored underneath the tab bar when detached
3221         https://bugs.webkit.org/show_bug.cgi?id=196722
3222         <rdar://problem/49613280>
3223
3224         Reviewed by Timothy Hatcher.
3225
3226         * WebProcess/WebPage/WebInspectorUI.h:
3227         * WebProcess/WebPage/WebInspectorUI.cpp:
3228         (WebKit::WebInspectorUI::changeSheetRect): Added.
3229         * UIProcess/WebInspectorProxy.messages.in:
3230         * UIProcess/WebInspectorProxy.h:
3231         (WebKit::WebInspectorProxy::sheetRect const): Added.
3232         * UIProcess/WebInspectorProxy.cpp:
3233         (WebKit::WebInspectorProxy::setSheetRect): Added.
3234         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3235         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3236         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3237         * UIProcess/mac/WebInspectorProxyMac.mm:
3238         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
3239         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3240         * UIProcess/win/WebInspectorProxyWin.cpp:
3241         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3242         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
3243         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3244
3245         * WebProcess/WebPage/RemoteWebInspectorUI.h:
3246         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
3247         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
3248         * UIProcess/RemoteWebInspectorProxy.messages.in:
3249         * UIProcess/RemoteWebInspectorProxy.h:
3250         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
3251         * UIProcess/RemoteWebInspectorProxy.cpp:
3252         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
3253         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3254         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
3255         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3256         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3257         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
3258         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
3259         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3260
3261 2019-04-10  Andy Estes  <aestes@apple.com>
3262
3263         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
3264         https://bugs.webkit.org/show_bug.cgi?id=196785
3265         <rdar://problem/48240051>
3266
3267         Reviewed by Tim Horton.
3268
3269         * UIProcess/ios/WKPDFView.mm:
3270         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
3271
3272 2019-04-10  Chris Dumez  <cdumez@apple.com>
3273
3274         Unreviewed, rolling out r244146.
3275
3276         Caused a few DeviceOrientation API test failures on iOS
3277
3278         Reverted changeset:
3279
3280         "Unable to run system Safari with trunk WebKit"
3281         https://bugs.webkit.org/show_bug.cgi?id=196777
3282         https://trac.webkit.org/changeset/244146
3283
3284 2019-04-10  Devin Rousso  <drousso@apple.com>
3285
3286         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
3287         https://bugs.webkit.org/show_bug.cgi?id=196725
3288         <rdar://problem/49669810>
3289
3290         Reviewed by Timothy Hatcher.
3291
3292         * WebProcess/WebPage/WebInspector.cpp:
3293         (WebKit::WebInspector::showMainResourceForFrame):
3294
3295 2019-04-10  Youenn Fablet  <youenn@apple.com>
3296
3297         Clear Cache Storage structures before removing all related files
3298         https://bugs.webkit.org/show_bug.cgi?id=196650
3299
3300         Reviewed by Alex Christensen.
3301
3302         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
3303         To make things more deterministic, clear files/folders directly
3304         after CachesStorage structures have finished being cleared.
3305
3306         * NetworkProcess/cache/CacheStorageEngine.cpp:
3307         (WebKit::CacheStorage::Engine::clearAllCaches):
3308         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3309
3310 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3311
3312         Add SPI WKNavigationResponse._downloadAttribute
3313         https://bugs.webkit.org/show_bug.cgi?id=196755
3314         <rdar://49587365>
3315
3316         Reviewed by Brady Eidson.
3317
3318         * UIProcess/API/APINavigationResponse.h:
3319         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3320         (-[WKNavigationResponse _downloadAttribute]):
3321         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
3322         * UIProcess/ProvisionalPageProxy.cpp:
3323         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3324         * UIProcess/ProvisionalPageProxy.h:
3325         * UIProcess/WebPageProxy.cpp:
3326         (WebKit::WebPageProxy::decidePolicyForResponse):
3327         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3328         * UIProcess/WebPageProxy.h:
3329         * UIProcess/WebPageProxy.messages.in:
3330         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3331         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3332         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3333
3334 2019-04-10  Youenn Fablet  <youenn@apple.com>
3335
3336         SWClientConnection should not double hop to fire some events
3337         https://bugs.webkit.org/show_bug.cgi?id=196735
3338
3339         Reviewed by Alex Christensen.
3340
3341         Removed unnecessary method.
3342
3343         * WebProcess/Storage/WebSWClientConnection.cpp:
3344         * WebProcess/Storage/WebSWClientConnection.h:
3345
3346 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
3347
3348         [iOS] Fix iokit-get-properties sandbox violations
3349         https://bugs.webkit.org/show_bug.cgi?id=196782
3350         <rdar://problem/49497720>
3351
3352         Reviewed by Brent Fulgham.
3353
3354         Add iokit properties to the WebContent sandbox on iOS.
3355
3356         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3357
3358 2019-04-10  Tim Horton  <timothy_horton@apple.com>
3359
3360         Add modern API for overriding the page's specified viewport configuration
3361         https://bugs.webkit.org/show_bug.cgi?id=167734
3362         <rdar://problem/30331795>
3363
3364         Reviewed by Simon Fraser.
3365
3366         * Shared/WebPageCreationParameters.cpp:
3367         (WebKit::WebPageCreationParameters::encode const):
3368         (WebKit::WebPageCreationParameters::decode):
3369         * Shared/WebPageCreationParameters.h:
3370         Plumb overrideViewportArguments in WebPageCreationParameters, so that
3371         if the process crashes (or swaps) they are maintained.
3372
3373         * UIProcess/API/Cocoa/WKWebView.mm:
3374         (viewportArgumentsFromDictionary):
3375         (-[WKWebView _overrideViewportWithArguments:]):
3376         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
3377         object and use the existing (now improved) overrideViewportArguments mechanism
3378         to take over the page's viewport arguments.
3379
3380         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3381         * UIProcess/WebPageProxy.cpp:
3382         (WebKit::WebPageProxy::creationParameters):
3383         * UIProcess/WebPageProxy.h:
3384         * UIProcess/ios/WebPageProxyIOS.mm:
3385         (WebKit::WebPageProxy::setOverrideViewportArguments):
3386         * WebProcess/WebPage/WebPage.cpp:
3387         Plumb overrideViewportArguments around more.
3388
3389 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
3390
3391         Add runJavaScriptInFrame for WebPageProxy/WebPage
3392         https://bugs.webkit.org/show_bug.cgi?id=196750
3393         <rdar://problem/49755738>
3394
3395         Reviewed by Youenn Fablet.
3396
3397         Tests of the new method will be covered by the internal counterpart.
3398
3399         * UIProcess/WebFrameProxy.cpp:
3400         (WebKit::WebFrameProxy::loadData):
3401         * UIProcess/WebFrameProxy.h:
3402         Add a comment.
3403         * UIProcess/WebPageProxy.cpp:
3404         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
3405         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
3406         Merge the above two runJavaScriptInMainFrame*.
3407         (WebKit::WebPageProxy::runJavaScriptInFrame):
3408         * UIProcess/WebPageProxy.h:
3409         * WebProcess/WebPage/WebPage.cpp:
3410         (WebKit::WebPage::loadDataInFrame):
3411         Add an assertion.
3412         (WebKit::WebPage::runJavaScript):
3413         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
3414         (WebKit::WebPage::runJavaScriptInFrame):
3415         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
3416         * WebProcess/WebPage/WebPage.h:
3417         * WebProcess/WebPage/WebPage.messages.in:
3418
3419 2019-04-10  Chris Dumez  <cdumez@apple.com>
3420
3421         Unable to run system Safari with trunk WebKit
3422         https://bugs.webkit.org/show_bug.cgi?id=196777
3423         <rdar://problem/49784574>
3424
3425         Reviewed by Alex Christensen.
3426
3427         * UIProcess/API/Cocoa/WKWebView.mm:
3428         (-[WKWebView _initializeWithConfiguration:]):
3429         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
3430         data store only happens for apps rebuilt using recent SDK.
3431
3432         * UIProcess/Cocoa/VersionChecks.h:
3433         * UIProcess/Cocoa/VersionChecks.mm:
3434         (WebKit::linkedOnOrAfter):
3435         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
3436           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
3437           be controlled by the caller.
3438         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
3439           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
3440           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
3441           0 value for sdkVersion.
3442
3443 2019-04-10  Chris Dumez  <cdumez@apple.com>
3444
3445         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
3446         https://bugs.webkit.org/show_bug.cgi?id=196774
3447         <rdar://problem/49460572>
3448
3449         Reviewed by Alex Christensen.
3450
3451         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
3452         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
3453         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
3454         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
3455         case we would fail to close the WebPage and audio could keep playing.
3456
3457         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
3458         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
3459         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
3460         the DidFailToSuspendAfterProcessSwap is eventually received.
3461
3462         * UIProcess/SuspendedPageProxy.cpp:
3463         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3464         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
3465         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3466         * UIProcess/SuspendedPageProxy.h:
3467         * UIProcess/WebPageProxy.cpp:
3468         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3469         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3470         * UIProcess/WebPageProxy.h:
3471         * UIProcess/WebProcessPool.cpp:
3472         * UIProcess/WebProcessPool.h:
3473
3474 2019-04-10  Timothy Hatcher  <timothy@apple.com>
3475
3476         WKScrollView background color does not match WKWebView before content is loaded.
3477         https://bugs.webkit.org/show_bug.cgi?id=196745
3478         rdar://problem/49750810
3479
3480         Reviewed by Megan Gardner.
3481
3482         * UIProcess/API/Cocoa/WKWebView.mm:
3483         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
3484         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
3485         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
3486         _contentView.backgroundColor and it has changed.
3487
3488 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
3489
3490         Fix text autoscrolling when typing in modern webkit
3491         https://bugs.webkit.org/show_bug.cgi?id=196718
3492         <rdar://problem/49225507>
3493
3494         Reviewed by Tim Horton.
3495
3496         For staging only. We need to turn off UIKit's scrolling behavior to land
3497         the changes we are making. To keep from the build ever breaking,
3498         I am temporarily circumventing the changes in UIKit. This will be removed
3499         once the next UIKit submission happens.
3500
3501         * UIProcess/ios/WKContentViewInteraction.mm:
3502         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
3503         (-[WKContentView setUpTextSelectionAssistant]):
3504
3505 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3506
3507         [iOSMac] Opt into modern compatibility mode by default
3508         https://bugs.webkit.org/show_bug.cgi?id=196763
3509         <rdar://problem/49038732>
3510
3511         Reviewed by Tim Horton.
3512
3513         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
3514
3515         * Shared/WebPreferences.yaml:
3516         * Shared/WebPreferencesDefaultValues.h:
3517
3518 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3519
3520         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
3521         https://bugs.webkit.org/show_bug.cgi?id=196744
3522         <rdar://49415309>
3523
3524         Reviewed by Chris Dumez.
3525
3526         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
3527         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
3528         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
3529         on the old one which is supposed to make it so all the message receivers associated with it have been removed
3530         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
3531         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
3532         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
3533         these messages so it can tear down the message receiver with the others it removes at close time.
3534
3535         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3536         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3537         (-[WKWebProcessPlugInBrowserContextController dealloc]):
3538         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
3539         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3540         (WebKit::WebPage::addRemoteObjectRegistry):
3541         * WebProcess/WebPage/WebPage.cpp:
3542         (WebKit::WebPage::close):
3543         * WebProcess/WebPage/WebPage.h:
3544
3545 2019-04-10  Chris Dumez  <cdumez@apple.com>
3546
3547         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
3548
3549         * UIProcess/SuspendedPageProxy.h:
3550
3551 2019-04-10  Antoine Quint  <graouts@apple.com>
3552
3553         Enable Pointer Events on watchOS
3554         https://bugs.webkit.org/show_bug.cgi?id=196771
3555         <rdar://problem/49040909>
3556
3557         Reviewed by Dean Jackson.
3558
3559         * Configurations/FeatureDefines.xcconfig:
3560
3561 2019-04-10  Brady Eidson  <beidson@apple.com>
3562
3563         Background tabs are not fully reactivated after a link is opened from an external application.
3564         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
3565
3566         Reviewed by Chris Dumez.
3567
3568         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
3569         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
3570
3571         The WKApplicationStateTrackingView logic needs to be a little more resilient.
3572
3573         * UIProcess/ios/WKApplicationStateTrackingView.mm:
3574         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
3575         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
3576           background state then fake the relevant notification.
3577         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
3578         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
3579
3580 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
3581
3582         Unreviewed, build fix for r244097
3583
3584         * NetworkProcess/NetworkProcess.cpp:
3585         (WebKit::NetworkProcess::actualPrepareToSuspend):
3586         (WebKit::NetworkProcess::resume):
3587         Added guards for ENABLE(SERVICE_WORKER)
3588
3589 2019-04-09  Keith Rollin  <krollin@apple.com>
3590
3591         Unreviewed build maintenance -- update .xcfilelists.
3592
3593         * DerivedSources-input.xcfilelist:
3594         * DerivedSources-output.xcfilelist:
3595
3596 2019-04-09  Zalan Bujtas  <zalan@apple.com>
3597
3598         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
3599         https://bugs.webkit.org/show_bug.cgi?id=196743
3600         <rdar://problem/43897551>
3601
3602         Reviewed by Tim Horton.
3603
3604         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3605         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
3606         * WebProcess/WebPage/WebPage.cpp:
3607         (WebKit::WebPage::setViewLayoutSize):
3608
3609 2019-04-09  Youenn Fablet  <youenn@apple.com>
3610
3611         Close service worker database on network process suspension
3612         https://bugs.webkit.org/show_bug.cgi?id=196623
3613         <rdar://problem/48930869>
3614
3615         Reviewed by Alex Christensen.
3616
3617         Close service worker database when preparing to suspend.
3618         On resume, push changes if any is needed.
3619
3620         * NetworkProcess/NetworkProcess.cpp:
3621         (WebKit::NetworkProcess::actualPrepareToSuspend):
3622         (WebKit::NetworkProcess::cancelPrepareToSuspend):
3623         (WebKit::NetworkProcess::processDidResume):
3624         * UIProcess/API/Cocoa/WKProcessPool.mm:
3625         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
3626         (-[WKProcessPool _sendNetworkProcessDidResume]):
3627         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3628         * UIProcess/Network/NetworkProcessProxy.h:
3629         * UIProcess/WebProcessPool.cpp:
3630         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
3631         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
3632         * UIProcess/WebProcessPool.h:
3633
3634 2019-04-09  Daniel Bates  <dabates@apple.com>
3635
3636         [iPad] Should open popover when the spacebar is pressed
3637         https://bugs.webkit.org/show_bug.cgi?id=196360
3638         <rdar://problem/49389129>
3639
3640         Reviewed by Brent Fulgham.
3641
3642         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
3643         just like it does on the Mac.
3644
3645         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
3646         hence pressing spacebar does nothing (because there is no focused element).
3647
3648         * UIProcess/ios/WKContentViewInteraction.h:
3649         * UIProcess/ios/WKContentViewInteraction.mm:
3650         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
3651         the focused element, update the accessory and then tell the accessory to begin editing.
3652         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3653         Write in terms of -accessoryOpen.
3654         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
3655         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
3656         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
3657         which will cause the popover to appear again.
3658
3659 2019-04-09  Chris Dumez  <cdumez@apple.com>
3660
3661         Unreviewed, fix webkitpy failure after r244085.
3662
3663         Use a list instead of a set for header includes so that the order is
3664         maintained.
3665
3666         * Scripts/webkit/messages.py:
3667
3668 2019-04-09  Andy Estes  <aestes@apple.com>
3669
3670         [Apple Pay] Add release logging to PaymentCoordinator
3671         https://bugs.webkit.org/show_bug.cgi?id=196738
3672
3673         Reviewed by Alex Christensen.
3674
3675         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3676         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
3677         * WebProcess/ApplePay/WebPaymentCoordinator.h:
3678
3679 2019-04-09  Jer Noble  <jer.noble@apple.com>
3680
3681         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
3682         https://bugs.webkit.org/show_bug.cgi?id=196659
3683
3684         Reviewed by Chris Dumez.
3685
3686         * Platform/IPC/Connection.h:
3687         (IPC::Connection::sendWithAsyncReply):
3688         * Platform/spi/ios/AssertionServicesSPI.h:
3689         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
3690         (WebKit::ProcessTaskStateObserver::setClient):
3691         (WebKit::ProcessTaskStateObserver::client):
3692         (WebKit::ProcessTaskStateObserver::taskState const):
3693         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
3694         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
3695         (WebKit::toProcessTaskStateObserverTaskState):
3696         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
3697         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
3698         (WebKit::ProcessTaskStateObserver::setTaskState):
3699         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
3700         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
3701         * UIProcess/ProcessAssertion.h:
3702         * UIProcess/ProcessThrottler.cpp:
3703         (WebKit::ProcessThrottler::updateAssertion):
3704         * UIProcess/ProcessThrottler.h:
3705         (WebKit::ProcessThrottler::shouldBeRunnable const):
3706         * UIProcess/WebProcessProxy.h:
3707         * UIProcess/WebProcessProxy.messages.in:
3708         * UIProcess/ios/ProcessAssertionIOS.mm:
3709         (WebKit::reasonForState):
3710         (WebKit::toBKSProcessAssertionReason):
3711         (WebKit::ProcessAssertion::ProcessAssertion):
3712         * WebKit.xcodeproj/project.pbxproj:
3713         * WebProcess/WebProcess.cpp:
3714         (WebKit::WebProcess::actualPrepareToSuspend):
3715         (WebKit::WebProcess::cancelPrepareToSuspend):
3716         (WebKit::WebProcess::processDidResume):
3717         * WebProcess/WebProcess.h:
3718         * WebProcess/cocoa/WebProcessCocoa.mm:
3719         (WebKit::WebProcess::processTaskStateDidChange):
3720
3721 2019-04-09  Alex Christensen  <achristensen@webkit.org>
3722
3723         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
3724         https://bugs.webkit.org/show_bug.cgi?id=196665
3725         <rdar://45115669>
3726
3727         Reviewed by Geoff Garen.
3728
3729         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
3730
3731         * UIProcess/API/Cocoa/WKWebView.mm:
3732         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3733         * UIProcess/Cocoa/WebViewImpl.mm:
3734         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3735
3736 2019-04-09  John Wilander  <wilander@apple.com>
3737
3738         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
3739         https://bugs.webkit.org/show_bug.cgi?id=196558
3740         <rdar://problem/47650245>
3741
3742         Reviewed by Youenn Fablet.
3743
3744         So called pixel requests have traditionally been used to send ad click
3745         attribution data to click sources. The privacy implications of such
3746         pixel requests are severe which is in part why browsers have started to
3747         block cookies from being sent in such third-party requests.
3748
3749         To allow for a smooth transition to more privacy-friendly ad click
3750         attribution, we should allow servers to make a redirect to
3751         https://click-source.example/.well-known/ad-click-attribution/ to
3752         trigger a so called conversion.
3753
3754         This patch checks for the well-known location in the path component of
3755         the redirect URL. If the request indeed goes to the well-known location,
3756         we parse the conversion data and send it to the storage in the network
3757         session.
3758
3759         * NetworkProcess/NetworkAdClickAttribution.cpp:
3760         (WebKit::NetworkAdClickAttribution::convert):
3761             Reporting function.
3762         * NetworkProcess/NetworkAdClickAttribution.h:
3763         * NetworkProcess/NetworkResourceLoader.cpp:
3764         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3765             Now checks for the well-known location through a call to
3766             WebCore::AdClickAttribution::parseConversionRequest().
3767         * NetworkProcess/NetworkSession.cpp:
3768         (WebKit::NetworkSession::convertAdClickAttribution):
3769             Piping to WebKit::NetworkAdClickAttribution::convert().
3770         * NetworkProcess/NetworkSession.h:
3771
3772 2019-04-09  Chris Dumez  <cdumez@apple.com>
3773
3774         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
3775         https://bugs.webkit.org/show_bug.cgi?id=196695
3776         <rdar://problem/48073787>
3777
3778         Reviewed by Tim Horton.
3779
3780         In order for WebContent processes to get marked as "Foreground Running" when their view
3781         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
3782         a subview of the WKContentView. The _UILayerHostView's visibility target is the
3783         WebContent process currently associated with the view.
3784
3785         * Platform/spi/ios/UIKitSPI.h:
3786         * UIProcess/PageClient.h:
3787         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
3788         * UIProcess/WebPageProxy.h:
3789         * UIProcess/WebProcessProxy.h:
3790         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
3791         * UIProcess/WebProcessProxy.messages.in:
3792         * UIProcess/ios/PageClientImplIOS.h:
3793         * UIProcess/ios/PageClientImplIOS.mm:
3794         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
3795         * UIProcess/ios/WKContentView.h:
3796         * UIProcess/ios/WKContentView.mm:
3797         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
3798         (-[WKContentView _setupVisibilityPropagationView]):
3799         (-[WKContentView _processDidExit]):
3800         (-[WKContentView _didRelaunchProcess]):
3801         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
3802         * UIProcess/ios/WebPageProxyIOS.mm:
3803         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
3804         * UIProcess/ios/WebProcessProxyIOS.mm:
3805         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
3806         * WebProcess/WebProcess.h:
3807         * WebProcess/cocoa/WebProcessCocoa.mm:
3808         (WebKit::WebProcess::platformInitializeWebProcess):
3809
3810 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
3811
3812         Remove unnecessary network process assertion for IDB close
3813         https://bugs.webkit.org/show_bug.cgi?id=196693
3814
3815         Reviewed by Geoffrey Garen.
3816
3817         * NetworkProcess/NetworkProcess.cpp:
3818         (WebKit::NetworkProcess::createIDBServer):
3819         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
3820         * NetworkProcess/NetworkProcess.h:
3821         * UIProcess/Network/NetworkProcessProxy.cpp:
3822         (WebKit::NetworkProcessProxy::didClose):
3823         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
3824         * UIProcess/Network/NetworkProcessProxy.h:
3825         * UIProcess/Network/NetworkProcessProxy.messages.in:
3826
3827 2019-04-09  Chris Dumez  <cdumez@apple.com>
3828
3829         Loads using loadHTMLString() cause flashing when process-swapping
3830         https://bugs.webkit.org/show_bug.cgi?id=196714
3831         <rdar://problem/49637354>
3832
3833         Reviewed by Antti Koivisto.
3834
3835         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
3836         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
3837         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
3838         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
3839         displaying the layer of the previous process until there is something meaningful to show in the
3840         new process.
3841
3842         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
3843         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
3844         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
3845         process may also get used for future navigations to the same site (as demonstrated by the
3846         API test) which is beneficial for performance.
3847
3848         * UIProcess/SuspendedPageProxy.cpp:
3849         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3850         * UIProcess/SuspendedPageProxy.h:
3851         * UIProcess/WebPageProxy.cpp:
3852         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3853         * UIProcess/WebProcessPool.cpp:
3854         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
3855
3856 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
3857
3858         [CMake][WinCairo] Separate copied headers into different directories
3859         https://bugs.webkit.org/show_bug.cgi?id=196655
3860
3861         Reviewed by Michael Catanzaro.
3862
3863         * CMakeLists.txt:
3864         * PlatformWin.cmake:
3865
3866 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3867
3868         [iOS] Do not allow starting selection drags when selection views are not visible
3869         https://bugs.webkit.org/show_bug.cgi?id=196686
3870         <rdar://problem/49399192>
3871
3872         Reviewed by Tim Horton.
3873
3874         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
3875         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
3876         the previously selected text. This is because the text is still selected in the document since we don't clear
3877         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
3878         longer present.
3879
3880         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
3881         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
3882         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
3883         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
3884
3885         * UIProcess/WebPageProxy.h:
3886         * UIProcess/ios/WKContentViewInteraction.mm:
3887         (-[WKContentView hasSelectablePositionAtPoint:]):
3888         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3889
3890         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
3891         (i.e. the web view is first responder, and is not suppressing text interactions).
3892
3893         (-[WKContentView _allowedDragSourceActions]):
3894         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
3895         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
3896
3897         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
3898
3899         * UIProcess/ios/WebPageProxyIOS.mm:
3900         (WebKit::WebPageProxy::requestDragStart):
3901         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
3902
3903         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
3904
3905         * WebProcess/WebCoreSupport/WebDragClient.cpp:
3906         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
3907
3908         Instead of always returning Any, consult WebPage's allowed drag source actions.
3909
3910         * WebProcess/WebPage/WebPage.h:
3911         (WebKit::WebPage::allowedDragSourceActions const):
3912         * WebProcess/WebPage/WebPage.messages.in:
3913         * WebProcess/WebPage/ios/WebPageIOS.mm:
3914         (WebKit::WebPage::requestDragStart):
3915         (WebKit::WebPage::requestAdditionalItemsForDragSession):
3916
3917         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
3918
3919 2019-04-08  Justin Fan  <justin_fan@apple.com>
3920
3921         [Web GPU] Fix Web GPU experimental feature on iOS
3922         https://bugs.webkit.org/show_bug.cgi?id=196632
3923
3924         Reviewed by Myles C. Maxfield.
3925
3926         Add feature conditionals for iOS 11.
3927         Properly make Web GPU available on iOS 11+.
3928
3929         * Configurations/FeatureDefines.xcconfig:
3930         * Configurations/WebKitTargetConditionals.xcconfig:
3931
3932 2019-04-08  Alex Christensen  <achristensen@webkit.org>
3933
3934         Fix selector name after r243834
3935         https://bugs.webkit.org/show_bug.cgi?id=196549
3936
3937         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3938         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3939         I forgot the colon in the setter's name.
3940
3941 2019-04-08  Antti Koivisto  <antti@apple.com>
3942
3943         Compute touch actions for touch point from remote layer tree regions
3944         https://bugs.webkit.org/show_bug.cgi?id=196701
3945
3946         Reviewed by Simon Fraser.
3947
3948         Add a function for finding the right layer and getting the touch actions in UI process side.
3949
3950         The code is not used yet.
3951
3952         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
3953         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
3954         (WebKit::touchActionsForPoint):
3955
3956         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
3957         taking event regions into account.
3958         Return the touch actions from the deepest event sensitive layer hit.
3959
3960         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
3961
3962         Modernize.
3963
3964 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
3965
3966         Make HSTS list handling more robust against unexpected content 
3967         https://bugs.webkit.org/show_bug.cgi?id=196552
3968         <rdar://problem/43403817>
3969
3970         Reviewed by Chris Dumez.
3971
3972         Crash logs indicate we sometimes encounter null key values during processing.
3973         This patch adds some debug assertions to catch this in test environments, and
3974         allows the code to skip the bad entries if encountered.
3975
3976         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
3977         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
3978
3979         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3980         (WebKit::filterPreloadHSTSEntry):
3981         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
3982
3983 2019-04-05  Brian Burg  <bburg@apple.com>
3984
3985         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
3986         https://bugs.webkit.org/show_bug.cgi?id=196168
3987
3988         Reviewed by Devin Rousso.
3989
3990         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
3991         So, most messages between WebAutomationSession and its proxy can use this facility and stop
3992         keeping track of callback IDs manually. This makes most code easier to read on both the
3993         sender and receiver side.
3994
3995         There are two cases that could not be converted:
3996         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
3997         be able to cancel all pending replies when a page navigates away, the web process crashes,
3998         or when handling an alert.
3999         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
4000         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
4001
4002         * UIProcess/Automation/WebAutomationSession.cpp:
4003         (WebKit::WebAutomationSession::resolveChildFrameHandle):
4004         (WebKit::WebAutomationSession::resolveParentFrameHandle):
4005         (WebKit::WebAutomationSession::computeElementLayout):
4006         (WebKit::WebAutomationSession::selectOptionElement):
4007         (WebKit::WebAutomationSession::getAllCookies):
4008         (WebKit::WebAutomationSession::deleteSingleCookie):
4009  &