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