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