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