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