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