Update UIKit when a cut causes a selection change
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
2
3         Update UIKit when a cut causes a selection change
4         https://bugs.webkit.org/show_bug.cgi?id=197047
5         <rdar://problem/36311563>
6
7         Reviewed by Wenson Hsieh.
8
9         We need to let UIKit know when a cut causes a selection change (always),
10         so that is can appropriately update the button on the keyboard bar.
11
12         * UIProcess/ios/WKContentViewInteraction.mm:
13         (-[WKContentView cutForWebView:]):
14
15 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
16
17         InjectedBundle parameters often need initialization function called before unarchiving
18         https://bugs.webkit.org/show_bug.cgi?id=189709
19         <rdar://problem/44573653>
20
21         Reviewed by Ryosuke Niwa.
22
23         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
24         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
25         after the bundle initialiation function runs, which gives the embedding program the opportunity to
26         register additional classes that are safe for serialization.
27
28         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
29         to be serialized by the InjectedBundle.
30         
31         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
32         Revise 'initialize' to call this new method.
33
34         * WebProcess/InjectedBundle/InjectedBundle.h:
35         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
36         (WebKit::InjectedBundle::initialize): Use the new method.
37         (WebKit::InjectedBundle::decodeBundleParameters): Added.
38         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
39         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
40         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
41         NSDictionary object may itself hold other kinds of objects.
42         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
43         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
44
45 2019-04-18  Zalan Bujtas  <zalan@apple.com>
46
47         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
48         https://bugs.webkit.org/show_bug.cgi?id=196948
49         <rdar://problem/49927131>
50
51         Reviewed by Tim Horton.
52
53         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
54         after r244291 there's no reason to have it in DrawingArea.
55
56         * UIProcess/DrawingAreaProxy.h:
57         (WebKit::DrawingAreaProxy::didUpdateGeometry):
58         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
59         * UIProcess/DrawingAreaProxy.messages.in:
60         * UIProcess/WebPageProxy.cpp:
61         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
62         (WebKit::WebPageProxy::setViewLayoutSize):
63         * UIProcess/WebPageProxy.h:
64         * UIProcess/WebPageProxy.messages.in:
65         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
66         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
67         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
68         * UIProcess/mac/WebPageProxyMac.mm:
69         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
70         * WebProcess/WebPage/WebPage.cpp:
71         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
72         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
73         * WebProcess/WebPage/WebPage.h:
74         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
75         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
76         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
77         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
78
79 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
80
81         Unreviewed, rolling out r244299.
82
83         Breaks internal tests.
84
85         Reverted changeset:
86
87         "InjectedBundle parameters often need initialization function
88         called before unarchiving"
89         https://bugs.webkit.org/show_bug.cgi?id=189709
90         https://trac.webkit.org/changeset/244299
91
92 2019-04-18  Shawn Roberts  <sroberts@apple.com>
93
94         Unreviewed manual rollout of r244248 and r244409
95         Causing assertion failures on Mac WK2 Debug builds
96         https://bugs.webkit.org/show_bug.cgi?id=195623
97
98         * NetworkProcess/NetworkProcess.cpp:
99         (WebKit::NetworkProcess::lowMemoryHandler):
100         * NetworkProcess/NetworkProcess.h:
101         (WebKit::NetworkProcess::prefetchCache): Deleted.
102         * NetworkProcess/NetworkResourceLoader.cpp:
103         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
104         (WebKit::NetworkResourceLoader::didReceiveResponse):
105         (WebKit::NetworkResourceLoader::didReceiveBuffer):
106         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
107         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
108         * NetworkProcess/NetworkResourceLoader.h:
109         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
110         * NetworkProcess/cache/PrefetchCache.h: Removed.
111         * Shared/WebPreferences.yaml:
112         * Sources.txt:
113         * WebKit.xcodeproj/project.pbxproj:
114
115 2019-04-18  Devin Rousso  <drousso@apple.com>
116
117         Web Inspector: Canvas: enable WebGL2 for inspector page
118         https://bugs.webkit.org/show_bug.cgi?id=196932
119         <rdar://problem/49916213>
120
121         Reviewed by Timothy Hatcher.
122
123         * WebProcess/WebPage/WebInspectorUI.cpp:
124         (WebKit::WebInspectorUI::WebInspectorUI):
125
126 2019-04-17  Devin Rousso  <drousso@apple.com>
127
128         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
129         https://bugs.webkit.org/show_bug.cgi?id=197044
130
131         Reviewed by Joseph Pecoraro.
132
133         * UIProcess/WebInspectorUtilities.h:
134         * UIProcess/WebInspectorUtilities.cpp:
135         (WebKit::trackInspectorPage):
136         (WebKit::untrackInspectorPage):
137         Determine the level of the inspector page by looking to see if the page being inspected is
138         in the inspector page map. If so, we must be inspecting an inspector page and should use
139         that inspector page's inspection level as the value to increment.
140
141         * UIProcess/WebInspectorProxy.cpp:
142         (WebKit::WebInspectorProxy::createFrontendPage):
143         * UIProcess/RemoteWebInspectorProxy.cpp:
144         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
145
146 2019-04-17  Tim Horton  <timothy_horton@apple.com>
147
148         Adopt different scroll view flashing SPI
149         https://bugs.webkit.org/show_bug.cgi?id=197043
150         <rdar://problem/49996476>
151
152         Reviewed by Wenson Hsieh.
153
154         * Platform/spi/ios/UIKitSPI.h:
155         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
156         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
157
158 2019-04-17  Tim Horton  <timothy_horton@apple.com>
159
160         REGRESSION (r241988): Switching tabs is slow
161         https://bugs.webkit.org/show_bug.cgi?id=197037
162         <rdar://problem/49951473>
163
164         Reviewed by Simon Fraser.
165
166         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
167         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
168         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
169         but WebPageProxy messages are identified by their WebPageProxy ID.
170         Revert that one change. The rest of the patch looks OK.
171
172 2019-04-17  Rob Buis  <rbuis@igalia.com>
173
174         Link prefetch not useful for top-level navigation
175         https://bugs.webkit.org/show_bug.cgi?id=195623
176
177         Reviewed by Alex Christensen.
178
179         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
180         not sending the DidReceiveResponse message.
181
182         * NetworkProcess/NetworkResourceLoader.cpp:
183         (WebKit::NetworkResourceLoader::didReceiveResponse):
184
185 2019-04-17  Truitt Savell  <tsavell@apple.com>
186
187         Unreviewed, rolling out r244400.
188
189         Caused testing to exit early with assertionon Debug WK2
190
191         Reverted changeset:
192
193         "UI↔Web deadlock when printing with a JavaScript alert
194         visible"
195         https://bugs.webkit.org/show_bug.cgi?id=196839
196         https://trac.webkit.org/changeset/244400
197
198 2019-04-17  Brady Eidson  <beidson@apple.com>
199
200         Link clicks in PDFs shouldn't send referrer headers.
201         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
202
203         Reviewed by Tim Horton.
204
205         * WebProcess/Plugins/PDF/PDFPlugin.mm:
206         (WebKit::PDFPlugin::clickedLink):
207         * WebProcess/WebPage/WebPage.cpp:
208         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
209
210 2019-04-17  Andy Estes  <aestes@apple.com>
211
212         [iOS] Support multiple file selection in UIDocumentPickerViewController
213         https://bugs.webkit.org/show_bug.cgi?id=197014
214         <rdar://problem/49963514>
215
216         Reviewed by Tim Horton.
217
218         * UIProcess/ios/forms/WKFileUploadPanel.mm:
219         (-[WKFileUploadPanel _showDocumentPickerMenu]):
220         Allowed multiple file selection in our UIDocumentPickerViewController when
221         _allowMultipleFiles is YES.
222
223         (displayStringForDocumentsAtURLs):
224         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
225         Changed to support multiple file selection. When more than one file is selected, use
226         WebCore::multipleFileUploadText() as the display string.
227
228 2019-04-17  Alex Christensen  <achristensen@webkit.org>
229
230         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
231         https://bugs.webkit.org/show_bug.cgi?id=197033
232
233         Reviewed by Tim Horton.
234
235         This is just cleanup that makes the code nicer without changing behavior.
236
237         * Shared/WebCompiledContentRuleListData.cpp:
238         (WebKit::WebCompiledContentRuleListData::encode const):
239         (WebKit::WebCompiledContentRuleListData::decode):
240         * Shared/WebCompiledContentRuleListData.h:
241         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
242         * UIProcess/API/APIContentRuleList.h:
243         * UIProcess/API/APIContentRuleListStore.cpp:
244         (API::createExtension):
245
246 2019-04-17  John Wilander  <wilander@apple.com>
247
248         Add prioritization of ad click conversions and cleaning of sent ad click conversions
249         https://bugs.webkit.org/show_bug.cgi?id=196934
250         <rdar://problem/49917773>
251
252         Reviewed by Chris Dumez.
253
254         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
255
256         This patch adds handling of prioritization of conversions according to these rules:
257         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
258         - If we have no previously converted attribution for this pair, just store.
259         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
260         - If we had no matching unconverted attribution but do have a previously converted attribution for this
261         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
262
263         This handling is in part done by dividing the previous m_adClickAttributionMap into 
264         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
265         as key instead of a nested HashMap.
266
267         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
268         removes attributions which have been sent out.
269
270         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
271         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
272         members to also clear them when done.
273
274         * NetworkProcess/AdClickAttributionManager.cpp:
275         (WebKit::AdClickAttributionManager::storeUnconverted):
276         (WebKit::AdClickAttributionManager::convert):
277         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
278         (WebKit::AdClickAttributionManager::clear):
279         (WebKit::AdClickAttributionManager::toString const):
280         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
281         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
282         (WebKit::AdClickAttributionManager::store): Deleted.
283         * NetworkProcess/AdClickAttributionManager.h:
284         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
285         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
286         * NetworkProcess/NetworkSession.cpp:
287         (WebKit::NetworkSession::storeAdClickAttribution):
288
289 2019-04-17  Tim Horton  <timothy_horton@apple.com>
290
291         UI↔Web deadlock when printing with a JavaScript alert visible
292         https://bugs.webkit.org/show_bug.cgi?id=196839
293         <rdar://problem/49157642>
294
295         Reviewed by Andy Estes.
296
297         * Platform/IPC/Connection.cpp:
298         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
299         (IPC::Connection::sendSyncReply):
300         (IPC::Connection::dispatchSyncMessage):
301         * Platform/IPC/Connection.h:
302         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
303         Keep track of whether we owe the other side of the connection any
304         delayed sync replies.
305
306         * UIProcess/API/Cocoa/WKWebView.mm:
307         (-[WKWebView _webViewPrintFormatter]):
308         Most actions one can take with a _WKWebViewPrintFormatter involve
309         synchronously messaging the Web Content process with an infinite timeout.
310         Doing so while the Web Content process is awaiting a reply to a deferred-reply
311         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
312         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
313         that we can't print right now.
314
315         * UIProcess/ios/WKContentView.mm:
316         (-[WKContentView _wk_pageCountForPrintFormatter:]):
317         (-[WKContentView _wk_printedDocument]):
318         The above isn't sufficient, though, because a sync message could arrive and
319         be handled between creation and use of the _WKWebViewPrintFormatter.
320         So, we also bail with a zero page count and null CGPDFDocument immediately
321         before we would send a sync message to the Web Content process. Clients
322         handle this less gracefully (e.g. showing a zero page PDF), but it is
323         very rare compared to the above case.
324
325 2019-04-17  Zalan Bujtas  <zalan@apple.com>
326
327         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
328         https://bugs.webkit.org/show_bug.cgi?id=196988
329         <rdar://problem/49955328>
330
331         Reviewed by Simon Fraser.
332
333         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
334
335         * WebProcess/WebPage/ios/WebPageIOS.mm:
336         (WebKit::isAriaRoleForImmediateClick):
337         (WebKit::nodeAlwaysRequiresClick):
338         (WebKit::WebPage::handleSyntheticClick):
339
340 2019-04-17  Alex Christensen  <achristensen@webkit.org>
341
342         WKRetainPtr's adoption constructor should be private
343         https://bugs.webkit.org/show_bug.cgi?id=197019
344
345         Reviewed by Tim Horton.
346
347         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
348
349         * UIProcess/API/C/WKContext.cpp:
350         (WKContextSetDownloadClient):
351         * UIProcess/API/cpp/WKRetainPtr.h:
352         (WebKit::WKRetainPtr::WKRetainPtr):
353         (WebKit::adoptWK):
354
355 2019-04-17  Alex Christensen  <achristensen@webkit.org>
356
357         Fix crash during teardown of PingLoad
358         https://bugs.webkit.org/show_bug.cgi?id=197024
359         <rdar://problem/49973077>
360
361         Reviewed by Jer Noble.
362
363         * NetworkProcess/PingLoad.cpp:
364         (WebKit::PingLoad::initialize):
365         Early return if weakThis is null.
366
367 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
368
369         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
370         https://bugs.webkit.org/show_bug.cgi?id=197012
371         <rdar://problem/49908848>
372
373         Reviewed by Simon Fraser.
374
375         We hit the release assertion due to the following sequence of events:
376         - Dispatch a queued event (in this case, a scroll event)
377         - Invoke the scroll event listener, which modifies layout in some way
378         - This scrolls an overflow scrollable container under the scope of layout
379         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
380
381         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
382         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
383         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
384         we end up hitting the release assertion underneath the early return.
385
386         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
387         instead of computing and sending the information immediately. While this only defers editor state updates during
388         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
389
390         Test: editing/selection/overflow-scroll-while-selecting-text.html
391
392         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
393         (WebKit::WebEditorClient::overflowScrollPositionChanged):
394         * WebProcess/WebPage/WebPage.cpp:
395         (WebKit::WebPage::didChangeOverflowScrollPosition):
396         (WebKit::WebPage::didChangeSelection):
397         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
398         * WebProcess/WebPage/WebPage.h:
399
400 2019-04-17  Chris Dumez  <cdumez@apple.com>
401
402         Remember device orientation permission for the duration of the browsing session
403         https://bugs.webkit.org/show_bug.cgi?id=196992
404         <rdar://problem/49946067>
405
406         Reviewed by Alex Christensen.
407
408         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
409         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
410         remember the previous decision for the duration of the session and not prompt again.
411
412         * Shared/WebsitePoliciesData.cpp:
413         (WebKit::WebsitePoliciesData::encode const):
414         (WebKit::WebsitePoliciesData::decode):
415         * Shared/WebsitePoliciesData.h:
416         * UIProcess/API/APIWebsitePolicies.cpp:
417         (API::WebsitePolicies::copy const):
418         (API::WebsitePolicies::data):
419         * UIProcess/API/APIWebsitePolicies.h:
420         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
421         (toDeviceOrientationOrMotionPermissionState):
422         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
423         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
424         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
425         * UIProcess/WebPageProxy.cpp:
426         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
427         * UIProcess/WebPageProxy.h:
428         * UIProcess/WebPageProxy.messages.in:
429         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
430         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
431         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
432         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
433         * UIProcess/WebsiteData/WebsiteDataStore.h:
434         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
435         * WebKit.xcodeproj/project.pbxproj:
436         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
437         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
438         * WebProcess/WebCoreSupport/WebChromeClient.h:
439         * WebProcess/WebPage/WebPage.cpp:
440         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
441         * WebProcess/WebPage/WebPage.h:
442
443 2019-04-16  Andy Estes  <aestes@apple.com>
444
445         [iOSMac] Use UIDocumentPickerViewController for picking files
446         https://bugs.webkit.org/show_bug.cgi?id=196999
447         <rdar://problem/49961414>
448
449         Reviewed by Tim Horton.
450
451         * UIProcess/ios/forms/WKFileUploadPanel.mm:
452         (-[WKFileUploadPanel _showDocumentPickerMenu]):
453         Changed to present a UIDocumentPickerViewController on iOSMac.
454
455         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
456         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
457         Replaced a deprecated delegate method implementation.
458
459 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
460
461         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
462         https://bugs.webkit.org/show_bug.cgi?id=196919
463         <rdar://problem/41630459>
464
465         Reviewed by Tim Horton.
466
467         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
468         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
469
470         * Platform/spi/ios/UIKitSPI.h:
471
472         Declare the private -dontDismiss property of UIMenuItem.
473
474         * UIProcess/API/Cocoa/WKWebView.mm:
475         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
476
477         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
478         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
479         controller. This scenario is exercised by the new layout test.
480
481         * UIProcess/ios/WKContentViewInteraction.h:
482         * UIProcess/ios/WKContentViewInteraction.mm:
483         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
484
485         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
486         to fade the callout bar until after the next remote layer tree commit.
487
488         (-[WKContentView _updateChangedSelection:]):
489
490         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
491         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
492         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
493         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
494         would be stale after triggering these actions. This effect is most noticeable when bolding text.
495
496         (-[WKContentView shouldAllowHidingSelectionCommands]):
497
498 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
499
500         Unreviewed non-unified build fix after r244307.
501
502         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
503
504 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
505
506         Allow sharing from imageSheet on an image document
507         https://bugs.webkit.org/show_bug.cgi?id=196891
508         <rdar://problem/25377386>
509
510         Reviewed by Tim Horton.
511
512         Allow sharing from an image sheet generated from an image document
513         by storing the image URL and using it as a fallback for the URL.
514         Store it as an image on WKElementAction to not accidentally trigger
515         any actions that should actually be associated with pure URLs.
516
517         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
518         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
519         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
520         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
521         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
522         (-[_WKActivatedElementInfo imageURL]):
523         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
524         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
525         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
526         * UIProcess/API/Cocoa/_WKElementAction.mm:
527         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
528         * UIProcess/ios/WKActionSheetAssistant.mm:
529         (-[WKActionSheetAssistant showImageSheet]):
530         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
531         (-[WKActionSheetAssistant showLinkSheet]):
532         * UIProcess/ios/WKContentViewInteraction.mm:
533         (-[WKContentView _showAttachmentSheet]):
534         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
535         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
536
537 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
538
539         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
540         https://bugs.webkit.org/show_bug.cgi?id=196977
541         <rdar://problem/49871194>
542
543         Reviewed by Tim Horton.
544
545         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
546         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
547         implements the new navigation delegate API.
548
549         * UIProcess/API/APINavigationClient.h:
550         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
551         * UIProcess/Cocoa/NavigationState.h:
552         * UIProcess/Cocoa/NavigationState.mm:
553         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
554
555 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
556
557         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
558         https://bugs.webkit.org/show_bug.cgi?id=196991
559         <rdar://problem/45507423>
560
561         Reviewed by Brent Fulgham.
562
563         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
564         a proper process access type needs to be set for the credential Website data type.
565
566         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
567         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
568
569 2019-04-16  Alex Christensen  <achristensen@webkit.org>
570
571         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
572         https://bugs.webkit.org/show_bug.cgi?id=196995
573
574         Reviewed by Brady Eidson.
575
576         Always call CompletionHandlers.  Otherwise things hang or assert.
577         I added an API test that asserts without this change so we don't regress this again.
578
579         * NetworkProcess/cache/CacheStorageEngine.cpp:
580         (WebKit::CacheStorage::Engine::clearAllCaches):
581         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
582
583 2019-04-16  Chris Dumez  <cdumez@apple.com>
584
585         URL set by document.open() is not communicated to the UIProcess
586         https://bugs.webkit.org/show_bug.cgi?id=196941
587         <rdar://problem/49237544>
588
589         Reviewed by Geoff Garen.
590
591         Whenever the UIProcess is notified of an explicit document.open() call, update the
592         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
593         knows it committed a load (i.e. It is no longer showing the initially empty document).
594
595         * UIProcess/PageLoadState.cpp:
596         (WebKit::PageLoadState::didExplicitOpen):
597         * UIProcess/PageLoadState.h:
598         * UIProcess/WebPageProxy.cpp:
599         (WebKit::WebPageProxy::didExplicitOpenForFrame):
600         * UIProcess/WebPageProxy.h:
601         * UIProcess/WebPageProxy.messages.in:
602         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
603         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
604         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
605
606 2019-04-16  Chris Dumez  <cdumez@apple.com>
607
608         Show prompt for device orientation access if the client does not implement the corresponding API delegate
609         https://bugs.webkit.org/show_bug.cgi?id=196971
610         <rdar://problem/49945840>
611
612         Reviewed by Alex Christensen.
613
614         Show prompt for device orientation access if the client does not implement the corresponding
615         API delegate, instead of rejecting access by default.
616
617         * UIProcess/Cocoa/UIDelegate.mm:
618         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
619         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
620         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
621         (WebKit::presentOrientationAccessAlert):
622         * WebKit.xcodeproj/project.pbxproj:
623
624 2019-04-16  Zalan Bujtas  <zalan@apple.com>
625
626         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
627         https://bugs.webkit.org/show_bug.cgi?id=196975
628         <rdar://problem/49489849>
629
630         Reviewed by Simon Fraser.
631
632         This patch ensures that we always proceed with synthetic click on form elements.
633
634         Covered by existing tests.
635
636         * WebProcess/WebPage/ios/WebPageIOS.mm:
637         (WebKit::WebPage::handleSyntheticClick):
638
639 2019-04-16  Timothy Hatcher  <timothy@apple.com>
640
641         FrameView base background color always starts white.
642         https://bugs.webkit.org/show_bug.cgi?id=196976
643
644         Reviewed by Beth Dakin.
645
646         * WebProcess/WebPage/WebPage.cpp:
647         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
648         WebFrame::createWithCoreMainFrame so the call to create the FrameView
649         for the empty page in transitionToCommittedForNewPage() gets
650         the correct color from WebPage.
651
652 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
653
654         Unreviewed, fix the build with recent SDKs.
655
656         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
657         (WebKit::WKWebViewState::store):
658
659 2019-04-16  Commit Queue  <commit-queue@webkit.org>
660
661         Unreviewed, rolling out r244321.
662         https://bugs.webkit.org/show_bug.cgi?id=196968
663
664         Causing all WK2 Debug builds to exit early after Assertion
665         failures. (Requested by ShawnRoberts on #webkit).
666
667         Reverted changeset:
668
669         "URL set by document.open() is not communicated to the
670         UIProcess"
671         https://bugs.webkit.org/show_bug.cgi?id=196941
672         https://trac.webkit.org/changeset/244321
673
674 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
675
676         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
677         https://bugs.webkit.org/show_bug.cgi?id=196954
678         <rdar://problem/48716433>
679
680         Reviewed by Ryosuke Niwa.
681
682         * UIProcess/mac/WebInspectorProxyMac.mm:
683         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
684
685 2019-04-15  Chris Dumez  <cdumez@apple.com>
686
687         URL set by document.open() is not communicated to the UIProcess
688         https://bugs.webkit.org/show_bug.cgi?id=196941
689         <rdar://problem/49237544>
690
691         Reviewed by Geoffrey Garen.
692
693         Whenever the UIProcess is notified of an explicit document.open() call, update the
694         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
695         knows it committed a load (i.e. It is no longer showing the initially empty document).
696
697         * UIProcess/PageLoadState.cpp:
698         (WebKit::PageLoadState::didExplicitOpen):
699         * UIProcess/PageLoadState.h:
700         * UIProcess/WebPageProxy.cpp:
701         (WebKit::WebPageProxy::didExplicitOpenForFrame):
702         * UIProcess/WebPageProxy.h:
703         * UIProcess/WebPageProxy.messages.in:
704         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
705         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
706         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
707
708 2019-04-15  Alex Christensen  <achristensen@webkit.org>
709
710         Stop using hyphenationFactor
711         https://bugs.webkit.org/show_bug.cgi?id=196949
712         <rdar://problem/49779594>
713
714         Reviewed by Geoffrey Garen.
715
716         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
717         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
718         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
719         There is a reason to remove it in the radar.
720
721 2019-04-15  Alex Christensen  <achristensen@webkit.org>
722
723         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
724
725         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
726         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
727
728 2019-04-15  Jer Noble  <jer.noble@apple.com>
729
730         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
731         https://bugs.webkit.org/show_bug.cgi?id=196773
732
733         Reviewed by Alex Christensen.
734
735         In addition to adding the new logging delegate method (and piping everything into it), 
736         add a new APIObject class to represent a signed integer.
737
738         * Shared/API/APINumber.h:
739         * Shared/API/APIObject.h:
740         * Shared/Cocoa/APIObject.mm:
741         (API::Object::newObject):
742         * Shared/Cocoa/WKNSNumber.mm:
743         (-[WKNSNumber dealloc]):
744         (-[WKNSNumber objCType]):
745         (-[WKNSNumber getValue:]):
746         (-[WKNSNumber longLongValue]):
747         (-[WKNSNumber _apiObject]):
748         * Shared/UserData.cpp:
749         (WebKit::UserData::encode):
750         (WebKit::UserData::decode):
751         * UIProcess/API/APIDiagnosticLoggingClient.h:
752         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
753         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
754         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
755         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
756         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
757         * UIProcess/ProvisionalPageProxy.cpp:
758         (WebKit::ProvisionalPageProxy::didReceiveMessage):
759         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
760         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
761         * UIProcess/WebPageDiagnosticLoggingClient.h:
762         * UIProcess/WebPageProxy.cpp:
763         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
764         * UIProcess/WebPageProxy.h:
765         * UIProcess/WebPageProxy.messages.in:
766         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
767         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
768         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
769
770 2019-04-15  Dean Jackson  <dino@apple.com>
771
772         Provide option to not create a longpress gesture recognizer
773         https://bugs.webkit.org/show_bug.cgi?id=196937
774         <rdar://problem/49918278>
775
776         Build fix for iOS platforms that don't have link preview.
777
778         * UIProcess/ios/WKContentViewInteraction.mm:
779         (-[WKContentView setupInteraction]):
780
781 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
782
783         InjectedBundle parameters often need initialization function called before unarchiving
784         https://bugs.webkit.org/show_bug.cgi?id=189709
785         <rdar://problem/44573653>
786
787         Reviewed by Ryosuke Niwa.
788
789         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
790         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
791         after the bundle initialiation function runs, which gives the embedding program the opportunity to
792         register additional classes that are safe for serialization.
793
794         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
795         to be serialized by the InjectedBundle.
796         
797         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
798         Revise 'initialize' to call this new method.
799
800         * WebProcess/InjectedBundle/InjectedBundle.h:
801         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
802         (WebKit::InjectedBundle::initialize): Use the new method.
803         (WebKit::InjectedBundle::decodeBundleParameters): Added.
804         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
805         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
806         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
807         NSDictionary object may itself hold other kinds of objects.
808         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
809         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
810
811 2019-04-15  Dean Jackson  <dino@apple.com>
812
813         Provide option to not create a longpress gesture recognizer
814         https://bugs.webkit.org/show_bug.cgi?id=196937
815         <rdar://problem/49918278>
816
817         Reviewed by Antoine Quint.
818
819         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
820
821         Add a property to toggle if we should add a long press gesture
822         recognizer.
823
824         * UIProcess/ios/WKContentViewInteraction.h:
825         * UIProcess/ios/WKContentViewInteraction.mm:
826         (-[WKContentView setupInteraction]):
827         (shouldUsePreviewForLongPress):
828         (-[WKContentView shouldUsePreviewForLongPress]):
829
830 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
831
832         [CMake] WebCore derived sources should only be referenced inside WebCore
833         https://bugs.webkit.org/show_bug.cgi?id=196904
834
835         Reviewed by Konstantin Tokarev.
836
837         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
838
839         * PlatformMac.cmake:
840
841 2019-04-15  Zalan Bujtas  <zalan@apple.com>
842
843         DrawingArea should only capture painting related milestones
844         https://bugs.webkit.org/show_bug.cgi?id=196926
845         <rdar://problem/48003845>
846
847         Reviewed by Tim Horton.
848
849         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
850         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
851         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
852
853         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
854         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
855         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
856         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
857         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
858         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
859         (WebKit::RemoteLayerTreeTransaction::encode const):
860         (WebKit::RemoteLayerTreeTransaction::decode):
861         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
862         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
863         * WebProcess/WebPage/DrawingArea.h:
864         (WebKit::DrawingArea::addMilestonesToDispatch):
865         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
866         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
867         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
868         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
869         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
870         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
871         * WebProcess/WebPage/WebPage.cpp:
872         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
873         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
874         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
875         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
876         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
877         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
878         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
879         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
880
881 2019-04-15  John Wilander  <wilander@apple.com>
882
883         Send delayed Ad Click Attribution conversion requests to the click source
884         https://bugs.webkit.org/show_bug.cgi?id=196838
885         <rdar://problem/47650157>
886
887         Reviewed by Chris Dumez and Youenn Fablet.
888
889         This patch schedules a conversion request with appropriate data going to the
890         click source as a result of an ad click conversion.
891
892         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
893         infrastructure to make the request. This will probably be reworked into a
894         dedicated load class further on.
895
896         New test infrastructure allows for an override of both the conversion URL
897         and the 24-48 hour timer.
898
899         * NetworkProcess/AdClickAttributionManager.cpp: Added.
900         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
901         (WebKit::AdClickAttributionManager::store):
902         (WebKit::AdClickAttributionManager::startTimer):
903             Convenience function to support test override.
904         (WebKit::AdClickAttributionManager::convert):
905             This function now sets the timer.
906         (WebKit::AdClickAttributionManager::fireConversionRequest):
907             Fire an individual request.
908         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
909             This is the timer function that iterates over all pending attributions.
910         (WebKit::AdClickAttributionManager::clear):
911             Now clears the two new test settings members.
912         (WebKit::AdClickAttributionManager::toString const):
913         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
914         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
915         (WebKit::AdClickAttributionManager::setPingLoadFunction):
916         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
917         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
918         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
919         * NetworkProcess/NetworkProcess.cpp:
920         (WebKit::NetworkProcess::storeAdClickAttribution):
921         (WebKit::NetworkProcess::dumpAdClickAttribution):
922         (WebKit::NetworkProcess::clearAdClickAttribution):
923         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
924         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
925         * NetworkProcess/NetworkProcess.h:
926         * NetworkProcess/NetworkProcess.messages.in:
927         * NetworkProcess/NetworkSession.cpp:
928         (WebKit::NetworkSession::NetworkSession):
929         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
930         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
931         * NetworkProcess/NetworkSession.h:
932         * NetworkProcess/PingLoad.cpp:
933         (WebKit::PingLoad::PingLoad):
934         (WebKit::m_blobFiles):
935         (WebKit::PingLoad::initialize):
936             The PingLoad constructor is now split in two to allow for construction
937             without a WebKit::NetworkConnectionToWebProcess object. The body of
938             the constructor was moved into the new initialize() function which is
939             shared between constructors.
940         * NetworkProcess/PingLoad.h:
941         * Sources.txt:
942             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
943             NetworkProcess/NetworkAdClickAttribution.cpp.
944         * UIProcess/API/C/WKPage.cpp:
945         (WKPageSetAdClickAttributionOverrideTimerForTesting):
946         (WKPageSetAdClickAttributionConversionURLForTesting):
947         * UIProcess/API/C/WKPagePrivate.h:
948         * UIProcess/Network/NetworkProcessProxy.cpp:
949         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
950         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
951         * UIProcess/Network/NetworkProcessProxy.h:
952         * UIProcess/WebPageProxy.cpp:
953         (WebKit::WebPageProxy::dumpAdClickAttribution):
954         (WebKit::WebPageProxy::clearAdClickAttribution):
955         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
956         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
957         * UIProcess/WebPageProxy.h:
958         * UIProcess/WebProcessPool.cpp:
959         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
960         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
961         * UIProcess/WebProcessPool.h:
962         * WebKit.xcodeproj/project.pbxproj:
963
964 2019-04-15  Devin Rousso  <drousso@apple.com>
965
966         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
967         https://bugs.webkit.org/show_bug.cgi?id=196872
968         <rdar://problem/49233240>
969
970         Reviewed by Joseph Pecoraro.
971
972         * UIProcess/Automation/WebAutomationSession.cpp:
973         (WebKit::WebAutomationSession::addSingleCookie):
974         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
975         itself to figure out which domain it should be set on.
976
977 2019-04-15  Philippe Normand  <pnormand@igalia.com>
978
979         [GTK][WPE] Add enable-media websetting
980         https://bugs.webkit.org/show_bug.cgi?id=196863
981
982         Reviewed by Michael Catanzaro.
983
984         It can be useful for headless browsers, for instance. The setting is enabled by default.
985
986         * Shared/WebPreferences.yaml:
987         * UIProcess/API/glib/WebKitSettings.cpp:
988         (webKitSettingsSetProperty):
989         (webKitSettingsGetProperty):
990         (webkit_settings_class_init):
991         (webkit_settings_get_enable_media):
992         (webkit_settings_set_enable_media):
993         * UIProcess/API/gtk/WebKitSettings.h:
994         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
995         * UIProcess/API/wpe/WebKitSettings.h:
996         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
997
998 2019-04-14  Rob Buis  <rbuis@igalia.com>
999
1000         Link prefetch not useful for top-level navigation
1001         https://bugs.webkit.org/show_bug.cgi?id=195623
1002
1003         Reviewed by Youenn Fablet.
1004
1005         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
1006         to the same url is done within a threshold (5 seconds), reuse the
1007         prefetch cache entry, move it to the disk cache and navigate to
1008         the url, meaning no extra network trip is needed. When not used within
1009         the threshold period, the prefetch entry will be erased using a timer.
1010
1011         * NetworkProcess/NetworkProcess.cpp:
1012         (WebKit::NetworkProcess::lowMemoryHandler):
1013         * NetworkProcess/NetworkProcess.h:
1014         (WebKit::NetworkProcess::prefetchCache):
1015         * NetworkProcess/NetworkResourceLoader.cpp:
1016         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1017         (WebKit::NetworkResourceLoader::didReceiveResponse):
1018         (WebKit::NetworkResourceLoader::didReceiveBuffer):
1019         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
1020         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
1021         * NetworkProcess/NetworkResourceLoader.h:
1022         * NetworkProcess/cache/PrefetchCache.cpp: Added.
1023         (WebKit::PrefetchCache::Entry::Entry):
1024         (WebKit::PrefetchCache::PrefetchCache):
1025         (WebKit::PrefetchCache::~PrefetchCache):
1026         (WebKit::PrefetchCache::clear):
1027         (WebKit::PrefetchCache::take):
1028         (WebKit::PrefetchCache::store):
1029         (WebKit::PrefetchCache::sessionPrefetchMap const):
1030         (WebKit::PrefetchCache::clearExpiredEntries):
1031         * NetworkProcess/cache/PrefetchCache.h: Added.
1032         (WebKit::PrefetchCache::Entry::response const):
1033         (WebKit::PrefetchCache::Entry::releaseBuffer):
1034         * Shared/WebPreferences.yaml:
1035         * Sources.txt:
1036         * WebKit.xcodeproj/project.pbxproj:
1037
1038 2019-04-14  Andy Estes  <aestes@apple.com>
1039
1040         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
1041         https://bugs.webkit.org/show_bug.cgi?id=196893
1042         <rdar://problem/48318983>
1043
1044         Reviewed by Anders Carlsson.
1045
1046         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
1047         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
1048         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
1049         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
1050         the LegacyCustomProtocolManagerProxy has been destroyed.
1051
1052         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
1053         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
1054         (-[WKCustomProtocolLoader cancel]):
1055         (-[WKCustomProtocolLoader connection:didFailWithError:]):
1056         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
1057         (-[WKCustomProtocolLoader connection:didReceiveData:]):
1058         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
1059         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
1060         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
1061         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
1062         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
1063         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
1064
1065 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
1066
1067         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
1068         https://bugs.webkit.org/show_bug.cgi?id=196742
1069
1070         Reviewed by Konstantin Tokarev.
1071
1072         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
1073
1074         * CMakeLists.txt:
1075         * PlatformWin.cmake:
1076         
1077         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
1078
1079 2019-04-13  Chris Dumez  <cdumez@apple.com>
1080
1081         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
1082         https://bugs.webkit.org/show_bug.cgi?id=196548
1083         <rdar://problem/49567254>
1084
1085         Reviewed by Darin Adler.
1086
1087         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
1088         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
1089         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
1090         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
1091         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
1092         incoming IPC that is not for its associated navigation.
1093
1094         * UIProcess/ProvisionalPageProxy.cpp:
1095         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
1096         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1097         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1098         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
1099         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
1100         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
1101         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1102         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1103         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
1104         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1105         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
1106
1107 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1108
1109         Unreviewed, try to fix the internal build after r244239
1110
1111         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
1112         import that was missing anyways.
1113
1114         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
1115
1116 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1117
1118         Enable modern compatibility mode by default in WKWebView on some devices
1119         https://bugs.webkit.org/show_bug.cgi?id=196883
1120         <rdar://problem/49864527>
1121
1122         Reviewed by Tim Horton.
1123
1124         Make some minor adjustments to new API.
1125
1126         * Shared/WebCompatibilityMode.h:
1127
1128         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
1129
1130         * Shared/WebPreferences.yaml:
1131         * Shared/WebPreferencesDefaultValues.h:
1132
1133         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
1134         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
1135
1136         * UIProcess/API/APIWebsitePolicies.h:
1137         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
1138
1139         Rename the withPreferences: label to just preferences:.
1140
1141         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
1142         * UIProcess/Cocoa/NavigationState.mm:
1143         (WebKit::NavigationState::setNavigationDelegate):
1144         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1145         * UIProcess/Cocoa/VersionChecks.h:
1146         * UIProcess/ios/WebPageProxyIOS.mm:
1147
1148 2019-04-12  Brian Burg  <bburg@apple.com>
1149
1150         WebDriver: fix typo in EnterFullscreen.js in error-handling code
1151         https://bugs.webkit.org/show_bug.cgi?id=196882
1152         <rdar://problem/49867122>
1153
1154         Reviewed by Devin Rousso.
1155
1156         * UIProcess/Automation/atoms/EnterFullscreen.js:
1157         (enterFullscreen):
1158
1159 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
1160
1161         Unreviewed fix for non-unified build.
1162
1163         * Shared/PrintInfo.cpp:
1164         Add missing include from r244202.
1165
1166 2019-04-12  Saam barati  <sbarati@apple.com>
1167
1168         Sometimes we need to user fewer CPUs in our threading calculations
1169         https://bugs.webkit.org/show_bug.cgi?id=196794
1170         <rdar://problem/49389497>
1171
1172         Reviewed by Yusuke Suzuki.
1173
1174         * WebProcess/com.apple.WebProcess.sb.in:
1175
1176 2019-04-12  Devin Rousso  <drousso@apple.com>
1177
1178         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
1179         https://bugs.webkit.org/show_bug.cgi?id=196847
1180         <rdar://problem/49609396>
1181
1182         Reviewed by Brian Burg.
1183
1184         * UIProcess/Automation/WebAutomationSession.cpp:
1185         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1186
1187 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
1188
1189         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
1190         https://bugs.webkit.org/show_bug.cgi?id=196845
1191
1192         Reviewed by Ryosuke Niwa.
1193
1194         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
1195         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1196         * NetworkProcess/NetworkDataTask.cpp:
1197         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
1198         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
1199         * NetworkProcess/NetworkProcess.cpp:
1200         * NetworkProcess/NetworkResourceLoadMap.cpp:
1201         * NetworkProcess/NetworkResourceLoadMap.h:
1202         * NetworkProcess/NetworkResourceLoader.cpp:
1203         * NetworkProcess/PingLoad.h:
1204         * Shared/WebCompiledContentRuleListData.cpp:
1205         * Shared/gtk/WebEventFactory.cpp:
1206         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1207         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1208         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1209         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1210         * UIProcess/Downloads/DownloadProxyMap.cpp:
1211         * UIProcess/InspectorTargetProxy.cpp:
1212         * UIProcess/PageClient.h:
1213         * UIProcess/ProcessAssertion.cpp:
1214         * UIProcess/ProvisionalPageProxy.h:
1215         * UIProcess/WebPageInspectorTargetAgent.h:
1216         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
1217         * WebProcess/Cache/WebCacheStorageConnection.cpp:
1218         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
1219         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1220         (WKBundleSetDatabaseQuota):
1221         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
1222         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
1223
1224 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
1225
1226         Update AudioSession route sharing policy
1227         https://bugs.webkit.org/show_bug.cgi?id=196776
1228         <rdar://problem/46501611>
1229
1230         Reviewed by Jer Noble.
1231
1232         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1233         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
1234
1235 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1236
1237         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
1238         https://bugs.webkit.org/show_bug.cgi?id=196862
1239
1240         Reviewed by Darin Adler.
1241
1242         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
1243         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
1244
1245         * UIProcess/API/APIWebsitePolicies.cpp:
1246         (API::WebsitePolicies::copy const):
1247
1248 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
1249
1250         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
1251         https://bugs.webkit.org/show_bug.cgi?id=196803
1252         rdar://problem/49078202
1253
1254         Reviewed by Antti Koivisto.
1255
1256         Flip LegacyOverflowScrollingTouchEnabled to false.
1257
1258         * Shared/WebPreferences.yaml:
1259
1260 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1261
1262         [iOS] Software keyboard is shown too frequently on some websites
1263         https://bugs.webkit.org/show_bug.cgi?id=195856
1264         <rdar://problem/49191395>
1265
1266         Reviewed by Darin Adler.
1267
1268         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
1269         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
1270         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
1271         when the element is focused.
1272
1273         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
1274         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
1275         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
1276         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
1277         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
1278         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
1279         hardware keyboard is not attached.
1280
1281         * UIProcess/API/Cocoa/WKWebView.mm:
1282         (hardwareKeyboardAvailabilityChangedCallback):
1283         * UIProcess/ios/WKContentViewInteraction.h:
1284         * UIProcess/ios/WKContentViewInteraction.mm:
1285         (-[WKContentView shouldShowAutomaticKeyboardUI]):
1286
1287         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
1288
1289         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
1290
1291         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
1292         element with inputmode="none", we'll show the input accessory view once again.
1293
1294 2019-04-12  Antoine Quint  <graouts@apple.com>
1295
1296         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
1297         https://bugs.webkit.org/show_bug.cgi?id=196830
1298         <rdar://problem/49124313>
1299
1300         Reviewed by Wenson Hsieh.
1301
1302         We add a new policy to determine whether simulated mouse events dispatch are allowed.
1303
1304         * Shared/WebsitePoliciesData.cpp:
1305         (WebKit::WebsitePoliciesData::encode const):
1306         (WebKit::WebsitePoliciesData::decode):
1307         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1308         * Shared/WebsitePoliciesData.h:
1309         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
1310         * UIProcess/API/APIWebsitePolicies.cpp:
1311         (API::WebsitePolicies::copy const):
1312         (API::WebsitePolicies::data):
1313         * UIProcess/API/APIWebsitePolicies.h:
1314         * WebKit.xcodeproj/project.pbxproj:
1315
1316 2019-04-12  Chris Dumez  <cdumez@apple.com>
1317
1318         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
1319         https://bugs.webkit.org/show_bug.cgi?id=196781
1320         <rdar://problem/49789381>
1321
1322         Reviewed by Darin Adler.
1323
1324         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
1325         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
1326         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
1327         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
1328
1329         * UIProcess/Downloads/DownloadProxyMap.cpp:
1330         (WebKit::DownloadProxyMap::invalidate):
1331         (WebKit::DownloadProxyMap::processDidClose): Deleted.
1332         * UIProcess/Downloads/DownloadProxyMap.h:
1333         * UIProcess/Network/NetworkProcessProxy.cpp:
1334         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1335         (WebKit::NetworkProcessProxy::didClose):
1336
1337 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1338
1339         [GTK] REGRESSION(r243860): Many tests failing
1340         https://bugs.webkit.org/show_bug.cgi?id=196791
1341
1342         Reviewed by Joanmarie Diggs.
1343
1344         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
1345         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
1346         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
1347         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
1348         notified of the changes in the accessibility tree.
1349
1350         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1351         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
1352         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
1353         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1354         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
1355         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
1356         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
1357         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
1358         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
1359         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1360
1361 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
1362
1363         Update 'Save Image' to more clear instructions
1364         https://bugs.webkit.org/show_bug.cgi?id=196833
1365         <rdar://problem/47446845>
1366
1367         Reviewed by Wenson Hsieh.
1368
1369         Just updating to a new string.
1370
1371         * UIProcess/API/Cocoa/_WKElementAction.mm:
1372         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
1373
1374 2019-04-11  Chris Dumez  <cdumez@apple.com>
1375
1376         Unable to run system Safari with trunk WebKit
1377         https://bugs.webkit.org/show_bug.cgi?id=196777
1378         <rdar://problem/49784574>
1379
1380         Reviewed by Alex Christensen.
1381
1382         * UIProcess/API/Cocoa/WKWebView.mm:
1383         (-[WKWebView _initializeWithConfiguration:]):
1384         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
1385         data store only happens for apps rebuilt using recent SDK.
1386
1387         * UIProcess/Cocoa/VersionChecks.h:
1388         * UIProcess/Cocoa/VersionChecks.mm:
1389         (WebKit::linkedOnOrAfter):
1390         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
1391           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
1392           be controlled by the caller.
1393         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
1394           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
1395           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
1396           0 value for sdkVersion.
1397
1398 2019-04-11  Zalan Bujtas  <zalan@apple.com>
1399
1400         Add @page margin support
1401         https://bugs.webkit.org/show_bug.cgi?id=196680
1402         <rdar://problem/45217707>
1403
1404         Reviewed by Tim Horton.
1405
1406         * Shared/PrintInfo.cpp:
1407         (WebKit::PrintInfo::encode const):
1408         (WebKit::PrintInfo::decode):
1409         * Shared/PrintInfo.h:
1410         * Shared/WebPreferences.yaml:
1411         * Shared/gtk/PrintInfoGtk.cpp:
1412         (WebKit::PrintInfo::PrintInfo):
1413         * Shared/mac/PrintInfoMac.mm:
1414         (WebKit::PrintInfo::PrintInfo):
1415         * UIProcess/API/C/WKPage.cpp:
1416         (WKPageComputePagesForPrinting):
1417         * UIProcess/API/C/WKPreferences.cpp:
1418         (WKPreferencesSetPageAtRuleSupportEnabled):
1419         (WKPreferencesGetPageAtRuleSupportEnabled):
1420         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1421         * UIProcess/GenericCallback.h:
1422         * UIProcess/WebPageProxy.cpp:
1423         (WebKit::WebPageProxy::computedPagesCallback):
1424         * UIProcess/WebPageProxy.h:
1425         * UIProcess/WebPageProxy.messages.in:
1426         * UIProcess/mac/WKPrintingView.mm:
1427         (pageDidComputePageRects):
1428         (-[WKPrintingView _askPageToComputePageRects]):
1429         * WebProcess/WebPage/WebPage.cpp:
1430         (WebKit::WebPage::beginPrinting):
1431         (WebKit::WebPage::computePagesForPrinting):
1432         (WebKit::WebPage::computePagesForPrintingImpl):
1433         * WebProcess/WebPage/WebPage.h:
1434         * WebProcess/WebPage/ios/WebPageIOS.mm:
1435         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1436
1437 2019-04-11  Dean Jackson  <dino@apple.com>
1438
1439         Extract UTI mapping and allow for additions
1440         https://bugs.webkit.org/show_bug.cgi?id=196822
1441         <rdar://problem/49822339>
1442
1443         Reviewed by Tim Horton.
1444
1445         Use the new helper to map MIME type to UTI.
1446
1447         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1448         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1449         * UIProcess/ios/WKSystemPreviewView.mm:
1450         (getUTIForSystemPreviewMIMEType):
1451
1452
1453 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
1454
1455         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
1456         https://bugs.webkit.org/show_bug.cgi?id=196825
1457
1458         Reviewed by Simon Fraser.
1459
1460         Ensure the layer transactions IDs are sequential. So bail out of
1461         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
1462
1463         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1464         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1465         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1466
1467 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1468
1469         Allow the MediaSource API to be enabled via website policy
1470         https://bugs.webkit.org/show_bug.cgi?id=196429
1471         <rdar://problem/48774333>
1472
1473         Reviewed by Tim Horton.
1474
1475         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
1476
1477         * Shared/WebPreferences.yaml:
1478
1479         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
1480         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
1481         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
1482
1483         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
1484         compatibility mode on WKWebpagePreferences.
1485
1486         * Shared/WebPreferences.yaml:
1487         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
1488         * Shared/WebsitePoliciesData.cpp:
1489         (WebKit::WebsitePoliciesData::encode const):
1490         (WebKit::WebsitePoliciesData::decode):
1491
1492         Add plumbing for m_mediaSourcePolicy in the set of website policies.
1493
1494         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1495
1496         Update the document loader with the given media source policy. There are two possibilities when applying the set
1497         of policies to the document loader; either the document loader is already attached to a Frame, or the document
1498         loader is yet to be attached to a Frame.
1499
1500         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
1501         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
1502         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
1503
1504         * Shared/WebsitePoliciesData.h:
1505         * UIProcess/API/APIWebsitePolicies.cpp:
1506         (API::WebsitePolicies::data):
1507         * UIProcess/API/APIWebsitePolicies.h:
1508         * UIProcess/API/C/WKPage.cpp:
1509         (WKPageSetPageNavigationClient):
1510         * UIProcess/Cocoa/NavigationState.mm:
1511         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1512
1513         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
1514         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
1515         default website policies on the web view configuration, even when using the C API to set the navigation client,
1516         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
1517         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
1518         webpage preferences.
1519
1520         * UIProcess/WebPageProxy.cpp:
1521         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1522         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
1523         * UIProcess/WebPageProxy.h:
1524         * WebKit.xcodeproj/project.pbxproj:
1525
1526 2019-04-11  Antti Koivisto  <antti@apple.com>
1527
1528         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
1529         https://bugs.webkit.org/show_bug.cgi?id=196813
1530         <rdar://problem/49393264>
1531
1532         Reviewed by Simon Fraser.
1533
1534         No test, can't repro.
1535
1536         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1537         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
1538
1539         Null check the nodes.
1540
1541 2019-04-10  Chris Dumez  <cdumez@apple.com>
1542
1543         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
1544         https://bugs.webkit.org/show_bug.cgi?id=196784
1545
1546         Reviewed by Antti Koivisto.
1547
1548         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
1549         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
1550         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
1551         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
1552         not sometimes be gone by the time we need it.
1553
1554         * UIProcess/SuspendedPageProxy.cpp:
1555         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1556
1557 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1558
1559         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
1560         https://bugs.webkit.org/show_bug.cgi?id=196809
1561         <rdar://49800762>
1562
1563         Reviewed by Brady Eidson.
1564
1565         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
1566         (-[WKNavigationResponse _downloadAttribute]):
1567
1568 2019-04-10  Tim Horton  <timothy_horton@apple.com>
1569
1570         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
1571         https://bugs.webkit.org/show_bug.cgi?id=196797
1572         <rdar://problem/48484715>
1573
1574         Reviewed by Simon Fraser.
1575
1576         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
1577         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
1578         Validate the set of modifier keys pressed when handling a key event for scrolling:
1579         Ignore key events with multiple modifier keys pressed.
1580         Ignore key events with an invalid modifier key pressed for a given primary key.
1581
1582 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1583
1584         requestAnimationFrame should execute before the next frame
1585         https://bugs.webkit.org/show_bug.cgi?id=177484
1586
1587         Reviewed by Simon Fraser.
1588
1589         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
1590         a single call to Page::updateRendering(). This new function implements 
1591         "Update the rendering" step of the HTML Event Loop specification
1592         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1593
1594         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
1595         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
1596         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
1597         (WebKit::DrawingAreaCoordinatedGraphics::display):
1598         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1599         (WebKit::LayerTreeHost::layerFlushTimerFired):
1600
1601         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1602         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1603         -- Call Page::updateRendering() to make sure that "Update the rendering"
1604            happens immediately before updating the page.
1605
1606         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
1607            to be exactly before flushing the layers. This fixes the assertion
1608            ASSERT(m_inLayerFlush) which was firing when running a layout test.
1609            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
1610            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
1611            twice before calling didFlushLayers().
1612
1613         * WebProcess/WebPage/WebPage.cpp:
1614         (WebKit::WebPage::layoutIfNeeded):
1615         (WebKit::WebPage::updateRendering):
1616         (WebKit::WebPage::willDisplayPage): Deleted.
1617         * WebProcess/WebPage/WebPage.h:
1618         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1619         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1620
1621 2019-04-10  Devin Rousso  <drousso@apple.com>
1622
1623         Web Inspector: save sheet should be anchored underneath the tab bar when detached
1624         https://bugs.webkit.org/show_bug.cgi?id=196722
1625         <rdar://problem/49613280>
1626
1627         Reviewed by Timothy Hatcher.
1628
1629         * WebProcess/WebPage/WebInspectorUI.h:
1630         * WebProcess/WebPage/WebInspectorUI.cpp:
1631         (WebKit::WebInspectorUI::changeSheetRect): Added.
1632         * UIProcess/WebInspectorProxy.messages.in:
1633         * UIProcess/WebInspectorProxy.h:
1634         (WebKit::WebInspectorProxy::sheetRect const): Added.
1635         * UIProcess/WebInspectorProxy.cpp:
1636         (WebKit::WebInspectorProxy::setSheetRect): Added.
1637         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1638         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1639         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1640         * UIProcess/mac/WebInspectorProxyMac.mm:
1641         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
1642         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1643         * UIProcess/win/WebInspectorProxyWin.cpp:
1644         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1645         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
1646         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
1647
1648         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1649         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1650         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
1651         * UIProcess/RemoteWebInspectorProxy.messages.in:
1652         * UIProcess/RemoteWebInspectorProxy.h:
1653         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
1654         * UIProcess/RemoteWebInspectorProxy.cpp:
1655         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
1656         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1657         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1658         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1659         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1660         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
1661         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1662         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
1663
1664 2019-04-10  Andy Estes  <aestes@apple.com>
1665
1666         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
1667         https://bugs.webkit.org/show_bug.cgi?id=196785
1668         <rdar://problem/48240051>
1669
1670         Reviewed by Tim Horton.
1671
1672         * UIProcess/ios/WKPDFView.mm:
1673         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
1674
1675 2019-04-10  Chris Dumez  <cdumez@apple.com>
1676
1677         Unreviewed, rolling out r244146.
1678
1679         Caused a few DeviceOrientation API test failures on iOS
1680
1681         Reverted changeset:
1682
1683         "Unable to run system Safari with trunk WebKit"
1684         https://bugs.webkit.org/show_bug.cgi?id=196777
1685         https://trac.webkit.org/changeset/244146
1686
1687 2019-04-10  Devin Rousso  <drousso@apple.com>
1688
1689         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
1690         https://bugs.webkit.org/show_bug.cgi?id=196725
1691         <rdar://problem/49669810>
1692
1693         Reviewed by Timothy Hatcher.
1694
1695         * WebProcess/WebPage/WebInspector.cpp:
1696         (WebKit::WebInspector::showMainResourceForFrame):
1697
1698 2019-04-10  Youenn Fablet  <youenn@apple.com>
1699
1700         Clear Cache Storage structures before removing all related files
1701         https://bugs.webkit.org/show_bug.cgi?id=196650
1702
1703         Reviewed by Alex Christensen.
1704
1705         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
1706         To make things more deterministic, clear files/folders directly
1707         after CachesStorage structures have finished being cleared.
1708
1709         * NetworkProcess/cache/CacheStorageEngine.cpp:
1710         (WebKit::CacheStorage::Engine::clearAllCaches):
1711         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
1712
1713 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1714
1715         Add SPI WKNavigationResponse._downloadAttribute
1716         https://bugs.webkit.org/show_bug.cgi?id=196755
1717         <rdar://49587365>
1718
1719         Reviewed by Brady Eidson.
1720
1721         * UIProcess/API/APINavigationResponse.h:
1722         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
1723         (-[WKNavigationResponse _downloadAttribute]):
1724         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
1725         * UIProcess/ProvisionalPageProxy.cpp:
1726         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1727         * UIProcess/ProvisionalPageProxy.h:
1728         * UIProcess/WebPageProxy.cpp:
1729         (WebKit::WebPageProxy::decidePolicyForResponse):
1730         (WebKit::WebPageProxy::decidePolicyForResponseShared):
1731         * UIProcess/WebPageProxy.h:
1732         * UIProcess/WebPageProxy.messages.in:
1733         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1734         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1735         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1736
1737 2019-04-10  Youenn Fablet  <youenn@apple.com>
1738
1739         SWClientConnection should not double hop to fire some events
1740         https://bugs.webkit.org/show_bug.cgi?id=196735
1741
1742         Reviewed by Alex Christensen.
1743
1744         Removed unnecessary method.
1745
1746         * WebProcess/Storage/WebSWClientConnection.cpp:
1747         * WebProcess/Storage/WebSWClientConnection.h:
1748
1749 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
1750
1751         [iOS] Fix iokit-get-properties sandbox violations
1752         https://bugs.webkit.org/show_bug.cgi?id=196782
1753         <rdar://problem/49497720>
1754
1755         Reviewed by Brent Fulgham.
1756
1757         Add iokit properties to the WebContent sandbox on iOS.
1758
1759         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1760
1761 2019-04-10  Tim Horton  <timothy_horton@apple.com>
1762
1763         Add modern API for overriding the page's specified viewport configuration
1764         https://bugs.webkit.org/show_bug.cgi?id=167734
1765         <rdar://problem/30331795>
1766
1767         Reviewed by Simon Fraser.
1768
1769         * Shared/WebPageCreationParameters.cpp:
1770         (WebKit::WebPageCreationParameters::encode const):
1771         (WebKit::WebPageCreationParameters::decode):
1772         * Shared/WebPageCreationParameters.h:
1773         Plumb overrideViewportArguments in WebPageCreationParameters, so that
1774         if the process crashes (or swaps) they are maintained.
1775
1776         * UIProcess/API/Cocoa/WKWebView.mm:
1777         (viewportArgumentsFromDictionary):
1778         (-[WKWebView _overrideViewportWithArguments:]):
1779         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
1780         object and use the existing (now improved) overrideViewportArguments mechanism
1781         to take over the page's viewport arguments.
1782
1783         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1784         * UIProcess/WebPageProxy.cpp:
1785         (WebKit::WebPageProxy::creationParameters):
1786         * UIProcess/WebPageProxy.h:
1787         * UIProcess/ios/WebPageProxyIOS.mm:
1788         (WebKit::WebPageProxy::setOverrideViewportArguments):
1789         * WebProcess/WebPage/WebPage.cpp:
1790         Plumb overrideViewportArguments around more.
1791
1792 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
1793
1794         Add runJavaScriptInFrame for WebPageProxy/WebPage
1795         https://bugs.webkit.org/show_bug.cgi?id=196750
1796         <rdar://problem/49755738>
1797
1798         Reviewed by Youenn Fablet.
1799
1800         Tests of the new method will be covered by the internal counterpart.
1801
1802         * UIProcess/WebFrameProxy.cpp:
1803         (WebKit::WebFrameProxy::loadData):
1804         * UIProcess/WebFrameProxy.h:
1805         Add a comment.
1806         * UIProcess/WebPageProxy.cpp:
1807         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
1808         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
1809         Merge the above two runJavaScriptInMainFrame*.
1810         (WebKit::WebPageProxy::runJavaScriptInFrame):
1811         * UIProcess/WebPageProxy.h:
1812         * WebProcess/WebPage/WebPage.cpp:
1813         (WebKit::WebPage::loadDataInFrame):
1814         Add an assertion.
1815         (WebKit::WebPage::runJavaScript):
1816         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
1817         (WebKit::WebPage::runJavaScriptInFrame):
1818         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
1819         * WebProcess/WebPage/WebPage.h:
1820         * WebProcess/WebPage/WebPage.messages.in:
1821
1822 2019-04-10  Chris Dumez  <cdumez@apple.com>
1823
1824         Unable to run system Safari with trunk WebKit
1825         https://bugs.webkit.org/show_bug.cgi?id=196777
1826         <rdar://problem/49784574>
1827
1828         Reviewed by Alex Christensen.
1829
1830         * UIProcess/API/Cocoa/WKWebView.mm:
1831         (-[WKWebView _initializeWithConfiguration:]):
1832         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
1833         data store only happens for apps rebuilt using recent SDK.
1834
1835         * UIProcess/Cocoa/VersionChecks.h:
1836         * UIProcess/Cocoa/VersionChecks.mm:
1837         (WebKit::linkedOnOrAfter):
1838         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
1839           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
1840           be controlled by the caller.
1841         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
1842           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
1843           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
1844           0 value for sdkVersion.
1845
1846 2019-04-10  Chris Dumez  <cdumez@apple.com>
1847
1848         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
1849         https://bugs.webkit.org/show_bug.cgi?id=196774
1850         <rdar://problem/49460572>
1851
1852         Reviewed by Alex Christensen.
1853
1854         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
1855         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
1856         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
1857         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
1858         case we would fail to close the WebPage and audio could keep playing.
1859
1860         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
1861         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
1862         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
1863         the DidFailToSuspendAfterProcessSwap is eventually received.
1864
1865         * UIProcess/SuspendedPageProxy.cpp:
1866         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1867         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
1868         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1869         * UIProcess/SuspendedPageProxy.h:
1870         * UIProcess/WebPageProxy.cpp:
1871         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1872         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1873         * UIProcess/WebPageProxy.h:
1874         * UIProcess/WebProcessPool.cpp:
1875         * UIProcess/WebProcessPool.h:
1876
1877 2019-04-10  Timothy Hatcher  <timothy@apple.com>
1878
1879         WKScrollView background color does not match WKWebView before content is loaded.
1880         https://bugs.webkit.org/show_bug.cgi?id=196745
1881         rdar://problem/49750810
1882
1883         Reviewed by Megan Gardner.
1884
1885         * UIProcess/API/Cocoa/WKWebView.mm:
1886         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
1887         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
1888         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
1889         _contentView.backgroundColor and it has changed.
1890
1891 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
1892
1893         Fix text autoscrolling when typing in modern webkit
1894         https://bugs.webkit.org/show_bug.cgi?id=196718
1895         <rdar://problem/49225507>
1896
1897         Reviewed by Tim Horton.
1898
1899         For staging only. We need to turn off UIKit's scrolling behavior to land
1900         the changes we are making. To keep from the build ever breaking,
1901         I am temporarily circumventing the changes in UIKit. This will be removed
1902         once the next UIKit submission happens.
1903
1904         * UIProcess/ios/WKContentViewInteraction.mm:
1905         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
1906         (-[WKContentView setUpTextSelectionAssistant]):
1907
1908 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1909
1910         [iOSMac] Opt into modern compatibility mode by default
1911         https://bugs.webkit.org/show_bug.cgi?id=196763
1912         <rdar://problem/49038732>
1913
1914         Reviewed by Tim Horton.
1915
1916         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
1917
1918         * Shared/WebPreferences.yaml:
1919         * Shared/WebPreferencesDefaultValues.h:
1920
1921 2019-04-10  Alex Christensen  <achristensen@webkit.org>
1922
1923         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
1924         https://bugs.webkit.org/show_bug.cgi?id=196744
1925         <rdar://49415309>
1926
1927         Reviewed by Chris Dumez.
1928
1929         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
1930         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
1931         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
1932         on the old one which is supposed to make it so all the message receivers associated with it have been removed
1933         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
1934         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
1935         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
1936         these messages so it can tear down the message receiver with the others it removes at close time.
1937
1938         * Shared/API/Cocoa/RemoteObjectRegistry.h:
1939         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1940         (-[WKWebProcessPlugInBrowserContextController dealloc]):
1941         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
1942         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1943         (WebKit::WebPage::addRemoteObjectRegistry):
1944         * WebProcess/WebPage/WebPage.cpp:
1945         (WebKit::WebPage::close):
1946         * WebProcess/WebPage/WebPage.h:
1947
1948 2019-04-10  Chris Dumez  <cdumez@apple.com>
1949
1950         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
1951
1952         * UIProcess/SuspendedPageProxy.h:
1953
1954 2019-04-10  Antoine Quint  <graouts@apple.com>
1955
1956         Enable Pointer Events on watchOS
1957         https://bugs.webkit.org/show_bug.cgi?id=196771
1958         <rdar://problem/49040909>
1959
1960         Reviewed by Dean Jackson.
1961
1962         * Configurations/FeatureDefines.xcconfig:
1963
1964 2019-04-10  Brady Eidson  <beidson@apple.com>
1965
1966         Background tabs are not fully reactivated after a link is opened from an external application.
1967         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
1968
1969         Reviewed by Chris Dumez.
1970
1971         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
1972         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
1973
1974         The WKApplicationStateTrackingView logic needs to be a little more resilient.
1975
1976         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1977         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
1978         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
1979           background state then fake the relevant notification.
1980         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
1981         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
1982
1983 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
1984
1985         Unreviewed, build fix for r244097
1986
1987         * NetworkProcess/NetworkProcess.cpp:
1988         (WebKit::NetworkProcess::actualPrepareToSuspend):
1989         (WebKit::NetworkProcess::resume):
1990         Added guards for ENABLE(SERVICE_WORKER)
1991
1992 2019-04-09  Keith Rollin  <krollin@apple.com>
1993
1994         Unreviewed build maintenance -- update .xcfilelists.
1995
1996         * DerivedSources-input.xcfilelist:
1997         * DerivedSources-output.xcfilelist:
1998
1999 2019-04-09  Zalan Bujtas  <zalan@apple.com>
2000
2001         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
2002         https://bugs.webkit.org/show_bug.cgi?id=196743
2003         <rdar://problem/43897551>
2004
2005         Reviewed by Tim Horton.
2006
2007         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2008         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2009         * WebProcess/WebPage/WebPage.cpp:
2010         (WebKit::WebPage::setViewLayoutSize):
2011
2012 2019-04-09  Youenn Fablet  <youenn@apple.com>
2013
2014         Close service worker database on network process suspension
2015         https://bugs.webkit.org/show_bug.cgi?id=196623
2016         <rdar://problem/48930869>
2017
2018         Reviewed by Alex Christensen.
2019
2020         Close service worker database when preparing to suspend.
2021         On resume, push changes if any is needed.
2022
2023         * NetworkProcess/NetworkProcess.cpp:
2024         (WebKit::NetworkProcess::actualPrepareToSuspend):
2025         (WebKit::NetworkProcess::cancelPrepareToSuspend):
2026         (WebKit::NetworkProcess::processDidResume):
2027         * UIProcess/API/Cocoa/WKProcessPool.mm:
2028         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
2029         (-[WKProcessPool _sendNetworkProcessDidResume]):
2030         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2031         * UIProcess/Network/NetworkProcessProxy.h:
2032         * UIProcess/WebProcessPool.cpp:
2033         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
2034         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
2035         * UIProcess/WebProcessPool.h:
2036
2037 2019-04-09  Daniel Bates  <dabates@apple.com>
2038
2039         [iPad] Should open popover when the spacebar is pressed
2040         https://bugs.webkit.org/show_bug.cgi?id=196360
2041         <rdar://problem/49389129>
2042
2043         Reviewed by Brent Fulgham.
2044
2045         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
2046         just like it does on the Mac.
2047
2048         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
2049         hence pressing spacebar does nothing (because there is no focused element).
2050
2051         * UIProcess/ios/WKContentViewInteraction.h:
2052         * UIProcess/ios/WKContentViewInteraction.mm:
2053         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
2054         the focused element, update the accessory and then tell the accessory to begin editing.
2055         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2056         Write in terms of -accessoryOpen.
2057         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
2058         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
2059         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
2060         which will cause the popover to appear again.
2061
2062 2019-04-09  Chris Dumez  <cdumez@apple.com>
2063
2064         Unreviewed, fix webkitpy failure after r244085.
2065
2066         Use a list instead of a set for header includes so that the order is
2067         maintained.
2068
2069         * Scripts/webkit/messages.py:
2070
2071 2019-04-09  Andy Estes  <aestes@apple.com>
2072
2073         [Apple Pay] Add release logging to PaymentCoordinator
2074         https://bugs.webkit.org/show_bug.cgi?id=196738
2075
2076         Reviewed by Alex Christensen.
2077
2078         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
2079         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
2080         * WebProcess/ApplePay/WebPaymentCoordinator.h:
2081
2082 2019-04-09  Jer Noble  <jer.noble@apple.com>
2083
2084         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
2085         https://bugs.webkit.org/show_bug.cgi?id=196659
2086
2087         Reviewed by Chris Dumez.
2088
2089         * Platform/IPC/Connection.h:
2090         (IPC::Connection::sendWithAsyncReply):
2091         * Platform/spi/ios/AssertionServicesSPI.h:
2092         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
2093         (WebKit::ProcessTaskStateObserver::setClient):
2094         (WebKit::ProcessTaskStateObserver::client):
2095         (WebKit::ProcessTaskStateObserver::taskState const):
2096         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
2097         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
2098         (WebKit::toProcessTaskStateObserverTaskState):
2099         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
2100         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
2101         (WebKit::ProcessTaskStateObserver::setTaskState):
2102         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
2103         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
2104         * UIProcess/ProcessAssertion.h:
2105         * UIProcess/ProcessThrottler.cpp:
2106         (WebKit::ProcessThrottler::updateAssertion):
2107         * UIProcess/ProcessThrottler.h:
2108         (WebKit::ProcessThrottler::shouldBeRunnable const):
2109         * UIProcess/WebProcessProxy.h:
2110         * UIProcess/WebProcessProxy.messages.in:
2111         * UIProcess/ios/ProcessAssertionIOS.mm:
2112         (WebKit::reasonForState):
2113         (WebKit::toBKSProcessAssertionReason):
2114         (WebKit::ProcessAssertion::ProcessAssertion):
2115         * WebKit.xcodeproj/project.pbxproj:
2116         * WebProcess/WebProcess.cpp:
2117         (WebKit::WebProcess::actualPrepareToSuspend):
2118         (WebKit::WebProcess::cancelPrepareToSuspend):
2119         (WebKit::WebProcess::processDidResume):
2120         * WebProcess/WebProcess.h:
2121         * WebProcess/cocoa/WebProcessCocoa.mm:
2122         (WebKit::WebProcess::processTaskStateDidChange):
2123
2124 2019-04-09  Alex Christensen  <achristensen@webkit.org>
2125
2126         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
2127         https://bugs.webkit.org/show_bug.cgi?id=196665
2128         <rdar://45115669>
2129
2130         Reviewed by Geoff Garen.
2131
2132         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
2133
2134         * UIProcess/API/Cocoa/WKWebView.mm:
2135         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2136         * UIProcess/Cocoa/WebViewImpl.mm:
2137         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2138
2139 2019-04-09  John Wilander  <wilander@apple.com>
2140
2141         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
2142         https://bugs.webkit.org/show_bug.cgi?id=196558
2143         <rdar://problem/47650245>
2144
2145         Reviewed by Youenn Fablet.
2146
2147         So called pixel requests have traditionally been used to send ad click
2148         attribution data to click sources. The privacy implications of such
2149         pixel requests are severe which is in part why browsers have started to
2150         block cookies from being sent in such third-party requests.
2151
2152         To allow for a smooth transition to more privacy-friendly ad click
2153         attribution, we should allow servers to make a redirect to
2154         https://click-source.example/.well-known/ad-click-attribution/ to
2155         trigger a so called conversion.
2156
2157         This patch checks for the well-known location in the path component of
2158         the redirect URL. If the request indeed goes to the well-known location,
2159         we parse the conversion data and send it to the storage in the network
2160         session.
2161
2162         * NetworkProcess/NetworkAdClickAttribution.cpp:
2163         (WebKit::NetworkAdClickAttribution::convert):
2164             Reporting function.
2165         * NetworkProcess/NetworkAdClickAttribution.h:
2166         * NetworkProcess/NetworkResourceLoader.cpp:
2167         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2168             Now checks for the well-known location through a call to
2169             WebCore::AdClickAttribution::parseConversionRequest().
2170         * NetworkProcess/NetworkSession.cpp:
2171         (WebKit::NetworkSession::convertAdClickAttribution):
2172             Piping to WebKit::NetworkAdClickAttribution::convert().
2173         * NetworkProcess/NetworkSession.h:
2174
2175 2019-04-09  Chris Dumez  <cdumez@apple.com>
2176
2177         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
2178         https://bugs.webkit.org/show_bug.cgi?id=196695
2179         <rdar://problem/48073787>
2180
2181         Reviewed by Tim Horton.
2182
2183         In order for WebContent processes to get marked as "Foreground Running" when their view
2184         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
2185         a subview of the WKContentView. The _UILayerHostView's visibility target is the
2186         WebContent process currently associated with the view.
2187
2188         * Platform/spi/ios/UIKitSPI.h:
2189         * UIProcess/PageClient.h:
2190         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
2191         * UIProcess/WebPageProxy.h:
2192         * UIProcess/WebProcessProxy.h:
2193         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
2194         * UIProcess/WebProcessProxy.messages.in:
2195         * UIProcess/ios/PageClientImplIOS.h:
2196         * UIProcess/ios/PageClientImplIOS.mm:
2197         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
2198         * UIProcess/ios/WKContentView.h:
2199         * UIProcess/ios/WKContentView.mm:
2200         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2201         (-[WKContentView _setupVisibilityPropagationView]):
2202         (-[WKContentView _processDidExit]):
2203         (-[WKContentView _didRelaunchProcess]):
2204         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
2205         * UIProcess/ios/WebPageProxyIOS.mm:
2206         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
2207         * UIProcess/ios/WebProcessProxyIOS.mm:
2208         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
2209         * WebProcess/WebProcess.h:
2210         * WebProcess/cocoa/WebProcessCocoa.mm:
2211         (WebKit::WebProcess::platformInitializeWebProcess):
2212
2213 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
2214
2215         Remove unnecessary network process assertion for IDB close
2216         https://bugs.webkit.org/show_bug.cgi?id=196693
2217
2218         Reviewed by Geoffrey Garen.
2219
2220         * NetworkProcess/NetworkProcess.cpp:
2221         (WebKit::NetworkProcess::createIDBServer):
2222         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
2223         * NetworkProcess/NetworkProcess.h:
2224         * UIProcess/Network/NetworkProcessProxy.cpp:
2225         (WebKit::NetworkProcessProxy::didClose):
2226         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
2227         * UIProcess/Network/NetworkProcessProxy.h:
2228         * UIProcess/Network/NetworkProcessProxy.messages.in:
2229
2230 2019-04-09  Chris Dumez  <cdumez@apple.com>
2231
2232         Loads using loadHTMLString() cause flashing when process-swapping
2233         https://bugs.webkit.org/show_bug.cgi?id=196714
2234         <rdar://problem/49637354>
2235
2236         Reviewed by Antti Koivisto.
2237
2238         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
2239         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
2240         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
2241         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
2242         displaying the layer of the previous process until there is something meaningful to show in the
2243         new process.
2244
2245         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
2246         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
2247         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
2248         process may also get used for future navigations to the same site (as demonstrated by the
2249         API test) which is beneficial for performance.
2250
2251         * UIProcess/SuspendedPageProxy.cpp:
2252         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2253         * UIProcess/SuspendedPageProxy.h:
2254         * UIProcess/WebPageProxy.cpp:
2255         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
2256         * UIProcess/WebProcessPool.cpp:
2257         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
2258
2259 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
2260
2261         [CMake][WinCairo] Separate copied headers into different directories
2262         https://bugs.webkit.org/show_bug.cgi?id=196655
2263
2264         Reviewed by Michael Catanzaro.
2265
2266         * CMakeLists.txt:
2267         * PlatformWin.cmake:
2268
2269 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2270
2271         [iOS] Do not allow starting selection drags when selection views are not visible
2272         https://bugs.webkit.org/show_bug.cgi?id=196686
2273         <rdar://problem/49399192>
2274
2275         Reviewed by Tim Horton.
2276
2277         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
2278         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
2279         the previously selected text. This is because the text is still selected in the document since we don't clear
2280         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
2281         longer present.
2282
2283         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
2284         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
2285         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
2286         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
2287
2288         * UIProcess/WebPageProxy.h:
2289         * UIProcess/ios/WKContentViewInteraction.mm:
2290         (-[WKContentView hasSelectablePositionAtPoint:]):
2291         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2292
2293         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
2294         (i.e. the web view is first responder, and is not suppressing text interactions).
2295
2296         (-[WKContentView _allowedDragSourceActions]):
2297         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
2298         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2299
2300         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
2301
2302         * UIProcess/ios/WebPageProxyIOS.mm:
2303         (WebKit::WebPageProxy::requestDragStart):
2304         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
2305
2306         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
2307
2308         * WebProcess/WebCoreSupport/WebDragClient.cpp:
2309         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
2310
2311         Instead of always returning Any, consult WebPage's allowed drag source actions.
2312
2313         * WebProcess/WebPage/WebPage.h:
2314         (WebKit::WebPage::allowedDragSourceActions const):
2315         * WebProcess/WebPage/WebPage.messages.in:
2316         * WebProcess/WebPage/ios/WebPageIOS.mm:
2317         (WebKit::WebPage::requestDragStart):
2318         (WebKit::WebPage::requestAdditionalItemsForDragSession):
2319
2320         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
2321
2322 2019-04-08  Justin Fan  <justin_fan@apple.com>
2323
2324         [Web GPU] Fix Web GPU experimental feature on iOS
2325         https://bugs.webkit.org/show_bug.cgi?id=196632
2326
2327         Reviewed by Myles C. Maxfield.
2328
2329         Add feature conditionals for iOS 11.
2330         Properly make Web GPU available on iOS 11+.
2331
2332         * Configurations/FeatureDefines.xcconfig:
2333         * Configurations/WebKitTargetConditionals.xcconfig:
2334
2335 2019-04-08  Alex Christensen  <achristensen@webkit.org>
2336
2337         Fix selector name after r243834
2338         https://bugs.webkit.org/show_bug.cgi?id=196549
2339
2340         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2341         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2342         I forgot the colon in the setter's name.
2343
2344 2019-04-08  Antti Koivisto  <antti@apple.com>
2345
2346         Compute touch actions for touch point from remote layer tree regions
2347         https://bugs.webkit.org/show_bug.cgi?id=196701
2348
2349         Reviewed by Simon Fraser.
2350
2351         Add a function for finding the right layer and getting the touch actions in UI process side.
2352
2353         The code is not used yet.
2354
2355         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
2356         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
2357         (WebKit::touchActionsForPoint):
2358
2359         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
2360         taking event regions into account.
2361         Return the touch actions from the deepest event sensitive layer hit.
2362
2363         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2364
2365         Modernize.
2366
2367 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
2368
2369         Make HSTS list handling more robust against unexpected content 
2370         https://bugs.webkit.org/show_bug.cgi?id=196552
2371         <rdar://problem/43403817>
2372
2373         Reviewed by Chris Dumez.
2374
2375         Crash logs indicate we sometimes encounter null key values during processing.
2376         This patch adds some debug assertions to catch this in test environments, and
2377         allows the code to skip the bad entries if encountered.
2378
2379         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
2380         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
2381
2382         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2383         (WebKit::filterPreloadHSTSEntry):
2384         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
2385
2386 2019-04-05  Brian Burg  <bburg@apple.com>
2387
2388         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
2389         https://bugs.webkit.org/show_bug.cgi?id=196168
2390
2391         Reviewed by Devin Rousso.
2392
2393         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
2394         So, most messages between WebAutomationSession and its proxy can use this facility and stop
2395         keeping track of callback IDs manually. This makes most code easier to read on both the
2396         sender and receiver side.
2397
2398         There are two cases that could not be converted:
2399         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
2400         be able to cancel all pending replies when a page navigates away, the web process crashes,
2401         or when handling an alert.
2402         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
2403         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
2404
2405         * UIProcess/Automation/WebAutomationSession.cpp:
2406         (WebKit::WebAutomationSession::resolveChildFrameHandle):
2407         (WebKit::WebAutomationSession::resolveParentFrameHandle):
2408         (WebKit::WebAutomationSession::computeElementLayout):
2409         (WebKit::WebAutomationSession::selectOptionElement):
2410         (WebKit::WebAutomationSession::getAllCookies):
2411         (WebKit::WebAutomationSession::deleteSingleCookie):
2412         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
2413         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
2414         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
2415         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
2416         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
2417         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
2418         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
2419         * UIProcess/Automation/WebAutomationSession.h:
2420         * UIProcess/Automation/WebAutomationSession.messages.in:
2421         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2422         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
2423         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
2424         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
2425         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
2426         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2427         (WebKit::WebAutomationSessionProxy::selectOptionElement):
2428         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2429         (WebKit::WebAutomationSessionProxy::deleteCookie):
2430         * WebProcess/Automation/WebAutomationSessionProxy.h:
2431         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
2432
2433 2019-04-08  Alex Christensen  <achristensen@webkit.org>
2434
2435         REGRESSION(236463) DownloadManager can call a null CompletionHandler
2436         https://bugs.webkit.org/show_bug.cgi?id=196414
2437         <rdar://problem/48389434>
2438
2439         Reviewed by Geoff Garen.
2440
2441         * NetworkProcess/NetworkResourceLoader.cpp:
2442         (WebKit::NetworkResourceLoader::convertToDownload):
2443         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
2444         r236463 introduced an unchecked code path that can allow this to happen.
2445
2446 2019-04-07  Commit Queue  <commit-queue@webkit.org>
2447
2448         Unreviewed, rolling out r243956.
2449         https://bugs.webkit.org/show_bug.cgi?id=196688
2450
2451         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
2452         by aakashjain on #webkit).
2453
2454         Reverted changeset:
2455
2456         "Clicking "Go Back" from a safe browsing warning from an
2457         iframe should navigate the WKWebView back to the previous
2458         page"
2459         https://bugs.webkit.org/show_bug.cgi?id=196665
2460         https://trac.webkit.org/changeset/243956
2461
2462 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
2463
2464         Remove stray byte added by r241131
2465         https://bugs.webkit.org/show_bug.cgi?id=196682
2466
2467         Reviewed by Alexey Proskuryakov.
2468
2469         Sublime Text thinks WKWebView.mm is binary instead of text.
2470
2471         According to online documentation and bisecting, this is because r241131
2472         introduced a stray byte (probably a null byte?) into the file.
2473
2474         I fixed this with Cmd-C Cmd-V.
2475
2476         * UIProcess/API/Cocoa/WKWebView.mm:
2477         (-[WKWebView _initializeWithConfiguration:]):
2478
2479 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2480
2481         Hide next and previous form control buttons when WKWebView is editable
2482         https://bugs.webkit.org/show_bug.cgi?id=196672
2483         <rdar://problem/35625321>
2484
2485         Reviewed by Tim Horton.
2486
2487         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
2488         editability.
2489
2490         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
2491
2492         * Platform/spi/ios/UIKitSPI.h:
2493         * UIProcess/API/Cocoa/WKWebView.mm:
2494         (-[WKWebView _setEditable:]):
2495         * UIProcess/ios/WKContentViewInteraction.h:
2496         * UIProcess/ios/WKContentViewInteraction.mm:
2497         (-[WKContentView _updateAccessory]):
2498         (-[WKContentView _didChangeWebViewEditability]):
2499
2500 2019-04-06  Antti Koivisto  <antti@apple.com>
2501
2502         Combine event and touch action regions into a single class
2503         https://bugs.webkit.org/show_bug.cgi?id=196644
2504         <rdar://problem/49643614>
2505
2506         Reviewed by Darin Adler.
2507
2508         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2509         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2510         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
2511         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
2512         (WebKit::RemoteLayerTreeNode::eventRegion const):
2513         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
2514         (WebKit::RemoteLayerTreeNode::setEventRegion):
2515         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2516         (WebKit::PlatformCALayerRemote::setEventRegion):
2517         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2518
2519 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
2520
2521         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
2522         https://bugs.webkit.org/show_bug.cgi?id=196077
2523         <rdar://problem/49108202>
2524
2525         Reviewed by Chris Dumez.
2526
2527         When a new web view is created, it is possible we don't have the web content process till a load
2528         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
2529         value down to web process via WebPageCreationParameters when a new process is created, just like
2530         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
2531
2532         * Shared/WebPageCreationParameters.cpp:
2533         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
2534         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
2535         * Shared/WebPageCreationParameters.h:
2536         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
2537             don't need the iVar in WKWebView any more.
2538         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
2539         (-[WKWebView _setViewScale:]): Ditto.
2540         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
2541         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
2542         * UIProcess/WebPageProxy.cpp:
2543         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
2544             web process creation parameter.
2545         * UIProcess/WebPageProxy.h:
2546         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
2547         * UIProcess/ios/WebPageProxyIOS.mm:
2548         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
2549             to web process.
2550         * WebProcess/WebPage/WebPage.cpp:
2551         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
2552             set that to viewport configuration.
2553
2554 2019-04-05  Jer Noble  <jer.noble@apple.com>
2555
2556         [Cocoa] Deactivate the audio session before the WebProcess suspends.
2557         https://bugs.webkit.org/show_bug.cgi?id=196658
2558
2559         Reviewed by Eric Carlson.
2560
2561         Notify the PlatformMediaSessionManager when the process suspends or resumes.
2562
2563         * WebProcess/WebProcess.cpp:
2564         (WebKit::WebProcess::actualPrepareToSuspend):
2565         (WebKit::WebProcess::cancelPrepareToSuspend):
2566         (WebKit::WebProcess::processDidResume):
2567
2568 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
2569
2570         [iOS] Web process gets suspended while holding locked database files
2571         https://bugs.webkit.org/show_bug.cgi?id=196519
2572         <rdar://problem/49531797>
2573
2574         Reviewed by Chris Dumez.
2575
2576         * WebProcess/WebProcess.cpp:
2577         (WebKit::WebProcess::actualPrepareToSuspend):
2578
2579 2019-04-05  Alex Christensen  <achristensen@webkit.org>
2580
2581         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
2582         https://bugs.webkit.org/show_bug.cgi?id=196665
2583         <rdar://45115669>
2584
2585         Reviewed by Geoff Garen.
2586
2587         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
2588
2589         * UIProcess/API/Cocoa/WKWebView.mm:
2590         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2591         * UIProcess/Cocoa/WebViewImpl.mm:
2592         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2593
2594 2019-04-05  Alex Christensen  <achristensen@webkit.org>
2595
2596         Undeprecate WKNavigationData
2597         https://bugs.webkit.org/show_bug.cgi?id=196559
2598         <rdar://44927425>
2599
2600         Reviewed by Geoff Garen.
2601
2602         * UIProcess/API/Cocoa/WKNavigationData.h:
2603         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
2604         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
2605         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
2606
2607 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
2608
2609         [iOS] Web process gets suspended while holding locked database files
2610         https://bugs.webkit.org/show_bug.cgi?id=196519
2611         <rdar://problem/49531797>
2612
2613         Reviewed by Chris Dumez.
2614
2615         * Shared/WebSQLiteDatabaseTracker.cpp:
2616         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
2617         * Shared/WebSQLiteDatabaseTracker.h:
2618         * WebProcess/WebProcess.cpp:
2619         (WebKit::m_webSQLiteDatabaseTracker):
2620         (WebKit::WebProcess::actualPrepareToSuspend):
2621         (WebKit::WebProcess::processWillSuspendImminently):
2622         (WebKit::WebProcess::cancelPrepareToSuspend):
2623         (WebKit::WebProcess::processDidResume):
2624         * WebProcess/WebProcess.h:
2625
2626 2019-04-05  Commit Queue  <commit-queue@webkit.org>
2627
2628         Unreviewed, rolling out r243833.
2629         https://bugs.webkit.org/show_bug.cgi?id=196645
2630
2631         This change breaks build of WPE and GTK ports (Requested by
2632         annulen on #webkit).
2633
2634         Reverted changeset:
2635
2636         "[CMake][WTF] Mirror XCode header directories"
2637         https://bugs.webkit.org/show_bug.cgi?id=191662
2638         https://trac.webkit.org/changeset/243833
2639
2640 2019-04-05  David Kilzer  <ddkilzer@apple.com>
2641
2642         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
2643         <https://bugs.webkit.org/show_bug.cgi?id=193951>
2644         <rdar://problem/47621366>
2645
2646         Fixes the following build warnings:
2647             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2648             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2649             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
2650
2651         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
2652         _WKInspectorWindow.h.  In r240685, a second Headers entry was
2653         added, but the first one was never removed.
2654
2655 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2656
2657         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
2658         https://bugs.webkit.org/show_bug.cgi?id=196593
2659         <rdar://problem/49599153>
2660
2661         Reviewed by Michael Catanzaro.
2662
2663         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
2664         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
2665
2666 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
2667
2668         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
2669         https://bugs.webkit.org/show_bug.cgi?id=196635
2670
2671         Reviewed by Antti Koivisto.
2672
2673         Remove WKBundleSetAsyncFrameScrollingEnabled().
2674
2675         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2676         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
2677         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2678
2679 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
2680
2681         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
2682         https://bugs.webkit.org/show_bug.cgi?id=195584
2683
2684         Reviewed by Zalan Bujtas.
2685
2686         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
2687         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
2688         just as we do for frames.
2689
2690         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
2691
2692         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
2693         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
2694         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
2695         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
2696
2697         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
2698         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
2699         already been put in the right locations, but the UI process needs to know that a scroll happened).
2700         However, we need to prevent notifications from programmatic scrolls getting back to the
2701         web process, because this causes jumpiness. This is done via an early return in
2702         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
2703
2704         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
2705         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
2706         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
2707         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
2708         a delegate, and that will take care of the requestedScrollPosition update.
2709         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
2710         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
2711         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
2712         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
2713         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
2714
2715 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
2716
2717         Unreviewed, rolling out r243888.
2718
2719         Introduced layout test crashes.
2720
2721         Reverted changeset:
2722
2723         "[macOS][iOS] Add filter to syscall sandbox rule"
2724         https://bugs.webkit.org/show_bug.cgi?id=196613
2725         https://trac.webkit.org/changeset/243888
2726
2727 2019-04-04  Youenn Fablet  <youenn@apple.com>
2728
2729         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
2730         https://bugs.webkit.org/show_bug.cgi?id=196543
2731
2732         Reviewed by Alex Christensen.
2733
2734         Renamed methods used to set cache storage quota to be storage generic
2735         since they will apply to all storage.
2736
2737         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
2738         to NetworkProcess (start-up time and new WebsiteDataStore time).
2739
2740         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
2741
2742         * NetworkProcess/NetworkProcess.cpp:
2743         (WebKit::NetworkProcess::initializeNetworkProcess):
2744         (WebKit::NetworkProcess::addWebsiteDataStore):
2745         (WebKit::NetworkProcess::initializeStorageQuota):
2746         (WebKit::NetworkProcess::setCacheStorageParameters):
2747         * NetworkProcess/NetworkProcess.h:
2748         * NetworkProcess/NetworkProcess.messages.in:
2749         * Shared/WebsiteDataStoreParameters.cpp:
2750         (WebKit::WebsiteDataStoreParameters::encode const):
2751         (WebKit::WebsiteDataStoreParameters::decode):
2752         * Shared/WebsiteDataStoreParameters.h:
2753         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2754         (WKWebsiteDataStoreSetPerOriginStorageQuota):
2755         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
2756         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2757         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2758         (-[WKWebsiteDataStore _perOriginStorageQuota]):
2759         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
2760         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
2761         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
2762         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2763         * UIProcess/Network/NetworkProcessProxy.cpp:
2764         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
2765         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2766         (WebKit::WebsiteDataStore::parameters):
2767         * UIProcess/WebsiteData/WebsiteDataStore.h:
2768         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
2769         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
2770         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
2771         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
2772         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2773         (WebKit::WebsiteDataStoreConfiguration::copy):
2774         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2775         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
2776         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
2777         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
2778         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
2779
2780 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2781
2782         Changing default website policies shouldn't change default website policies in subsequent navigations
2783         https://bugs.webkit.org/show_bug.cgi?id=196562
2784         <rdar://problem/49573377>
2785
2786         Reviewed by Tim Horton.
2787
2788         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
2789         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
2790         a modified version of the default website policies into the decision handler without impacting future
2791         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
2792         of the default website policies to the navigation delegate when deciding navigation policies.
2793
2794         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
2795
2796         * UIProcess/API/APIWebsitePolicies.cpp:
2797         (API::WebsitePolicies::copy const):
2798
2799         Add a helper method to copy a set of website policies.
2800
2801         * UIProcess/API/APIWebsitePolicies.h:
2802         * UIProcess/Cocoa/NavigationState.mm:
2803         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2804
2805 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2806
2807         Unreviewed, fix -Wreturn-type warning
2808
2809         * Shared/WebsiteData/WebsiteData.cpp:
2810         (WebKit::WebsiteData::ownerProcess):
2811
2812 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2813
2814         [macOS] Fix sandbox violations
2815         https://bugs.webkit.org/show_bug.cgi?id=196616
2816         <rdar://problem/49498040>
2817
2818         Reviewed by Brent Fulgham.
2819
2820         Fix some observed sandbox violations in the WebContent process on macOS.
2821
2822         * WebProcess/com.apple.WebProcess.sb.in:
2823
2824 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
2825
2826         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
2827         https://bugs.webkit.org/show_bug.cgi?id=196555
2828         <rdar://problem/47303865>
2829
2830         Reviewed by Youenn Fablet.
2831
2832         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
2833
2834         * UIProcess/API/Cocoa/WKWebView.mm:
2835         (-[WKWebView _setPageMuted:]):
2836         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
2837         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
2838         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2839
2840         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2841         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
2842         a log comment typo.
2843
2844         * UIProcess/WebPageProxy.cpp:
2845         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
2846         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
2847         (WebKit::WebPageProxy::setMuted): Ditto.
2848         * UIProcess/WebPageProxy.h:
2849         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
2850
2851 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
2852
2853         [macOS][iOS] Add filter to syscall sandbox rule
2854         https://bugs.webkit.org/show_bug.cgi?id=196613
2855         <rdar://problem/49531420>
2856
2857         Reviewed by Brent Fulgham.
2858
2859         This will restrict the existing sandbox rule for the syscall.
2860
2861         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2862         * WebProcess/com.apple.WebProcess.sb.in:
2863
2864 2019-04-04  Youenn Fablet  <youenn@apple.com>
2865
2866         Service Worker Process does not have the right domain name
2867         https://bugs.webkit.org/show_bug.cgi?id=196585
2868
2869         Reviewed by Chris Dumez.
2870
2871         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
2872         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2873         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
2874
2875 2019-04-04  Chris Dumez  <cdumez@apple.com>
2876
2877         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
2878         https://bugs.webkit.org/show_bug.cgi?id=196604
2879         <rdar://problem/49074131>
2880
2881         Reviewed by Geoffrey Garen.
2882
2883         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
2884         is while I figure out how to enable this on iOS without regressed PLT.
2885
2886         * UIProcess/WebProcessPool.h:
2887
2888 2019-04-04  Miguel Gomez  <magomez@igalia.com>
2889
2890         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
2891         https://bugs.webkit.org/show_bug.cgi?id=188839
2892
2893         Reviewed by Žan Doberšek.
2894
2895         Even if a platform layer has changed, don't wait for a main thread callback to finish the
2896         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
2897
2898         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
2899         (WebKit::CompositingRunLoop::scheduleUpdate):
2900         (WebKit::CompositingRunLoop::stopUpdates):
2901         (WebKit::CompositingRunLoop::updateCompleted):
2902         (WebKit::CompositingRunLoop::updateTimerFired):
2903         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
2904         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
2905         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2906         (WebKit::ThreadedCompositor::renderLayerTree):
2907         (WebKit::ThreadedCompositor::sceneUpdateFinished):
2908         (WebKit::ThreadedCompositor::displayRefreshMonitor):
2909         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
2910         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2911         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
2912         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
2913
2914 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2915
2916         [ATK] Cleanup WebPageAccessibilityObjectAtk
2917         https://bugs.webkit.org/show_bug.cgi?id=196537
2918
2919         Reviewed by Michael Catanzaro.
2920
2921         Several changes and cleanups:
2922
2923          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
2924          - Rename the header to remove the Atk prefix to match the cpp file and class name.
2925          - Use pragma once.
2926          - Use nullptr instead of 0.
2927          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
2928          - Return generic AtkObject* from constructor.
2929
2930         * SourcesGTK.txt:
2931         * WebProcess/WebPage/WebPage.h:
2932         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
2933         (accessibilityRootObjectWrapper):
2934         (webkitWebPageAccessibilityObjectInitialize):
2935         (webkitWebPageAccessibilityObjectGetIndexInParent):
2936         (webkitWebPageAccessibilityObjectGetNChildren):
2937         (webkitWebPageAccessibilityObjectRefChild):
2938         (webkit_web_page_accessibility_object_class_init):
2939         (webkitWebPageAccessibilityObjectNew):
2940         (webkitWebPageAccessibilityObjectRefresh):
2941         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
2942         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
2943         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
2944         (WebKit::WebPage::platformInitialize):
2945         (WebKit::WebPage::updateAccessibilityTree):
2946
2947 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2948
2949         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
2950         https://bugs.webkit.org/show_bug.cgi?id=196535
2951
2952         Reviewed by Michael Catanzaro.
2953
2954         This way the properties are not cached. Right now, if number of children is queried before the socket is
2955         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
2956
2957         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
2958         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
2959         * UIProcess/gtk/WebPageProxyGtk.cpp:
2960         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
2961
2962 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2963
2964         [ATK] Embed the AtkSocket as soon as we receive the plug ID
2965         https://bugs.webkit.org/show_bug.cgi?id=196534
2966
2967         Reviewed by Michael Catanzaro.
2968
2969         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
2970         can simply embed the socket when the plug ID is received.
2971
2972         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2973         (webkitWebViewBaseGetAccessible):
2974         * UIProcess/WebPageProxy.h:
2975         * UIProcess/gtk/WebPageProxyGtk.cpp:
2976         (WebKit::WebPageProxy::bindAccessibilityTree):
2977
2978 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2979
2980         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
2981         https://bugs.webkit.org/show_bug.cgi?id=193914
2982
2983         Reviewed by Michael Catanzaro.
2984
2985         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
2986         root accessibility object wrapper.
2987
2988         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2989         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2990         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2991
2992 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2993
2994         Simplify some "programmaticScroll" code paths
2995         https://bugs.webkit.org/show_bug.cgi?id=196589
2996
2997         Reviewed by Zalan Bujtas.
2998
2999         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
3000         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
3001         * WebProcess/WebPage/ios/WebPageIOS.mm:
3002         (WebKit::WebPage::updateVisibleContentRects):
3003
3004 2019-04-03  Chris Dumez  <cdumez@apple.com>
3005
3006         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
3007         https://bugs.webkit.org/show_bug.cgi?id=196588
3008         <rdar://problem/49365787>
3009
3010         Reviewed by Ryosuke Niwa.
3011
3012         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
3013         This can lead to returning stale frames to the client if it asks for those.
3014
3015         * UIProcess/WebPageProxy.cpp:
3016         (WebKit::WebPageProxy::resetState):
3017
3018 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
3019
3020         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
3021         https://bugs.webkit.org/show_bug.cgi?id=196587
3022
3023         Reviewed by Zalan Bujtas.
3024
3025         This argument was unused.
3026
3027         * UIProcess/API/gtk/PageClientImpl.cpp:
3028         (WebKit::PageClientImpl::requestScroll):
3029         * UIProcess/API/gtk/PageClientImpl.h:
3030         * UIProcess/API/wpe/PageClientImpl.cpp:
3031         (WebKit::PageClientImpl::requestScroll):
3032         * UIProcess/API/wpe/PageClientImpl.h:
3033         * UIProcess/PageClient.h:
3034         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3035         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
3036         * UIProcess/WebPageProxy.cpp:
3037         (WebKit::WebPageProxy::requestScroll):
3038         * UIProcess/WebPageProxy.h:
3039         * UIProcess/ios/PageClientImplIOS.h:
3040         * UIProcess/ios/PageClientImplIOS.mm:
3041         (WebKit::PageClientImpl::requestScroll):
3042         * UIProcess/mac/PageClientImplMac.h:
3043         * UIProcess/mac/PageClientImplMac.mm:
3044         (WebKit::PageClientImpl::requestScroll):
3045         * UIProcess/win/PageClientImpl.cpp:
3046         (WebKit::PageClientImpl::requestScroll):
3047         * UIProcess/win/PageClientImpl.h:
3048
3049 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
3050
3051         -apple-trailing-word is needed for browser detection
3052         https://bugs.webkit.org/show_bug.cgi?id=196575
3053
3054         Unreviewed.
3055
3056         * Configurations/FeatureDefines.xcconfig:
3057
3058 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3059
3060         Add a WebKit internal feature flag to always enable modern compatibility mode by default
3061         https://bugs.webkit.org/show_bug.cgi?id=196526
3062         <rdar://problem/49532923>
3063
3064         Reviewed by Tim Horton.
3065
3066         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
3067         enabled for all apps on the system.
3068
3069         * Shared/WebPreferences.yaml:
3070
3071 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3072
3073         Fix internal build after r243829
3074         https://bugs.webkit.org/show_bug.cgi?id=196549
3075
3076         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3077         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3078         Some SDK's don't include this selector in the header.
3079         Use NSSelectorFromString.
3080
3081 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
3082
3083         [CMake][WTF] Mirror XCode header directories
3084         https://bugs.webkit.org/show_bug.cgi?id=191662
3085
3086         Reviewed by Konstantin Tokarev.
3087
3088         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
3089         builds.
3090
3091         * CMakeLists.txt:
3092
3093 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3094
3095         Add SPI to disable legacy TLS fallback
3096         https://bugs.webkit.org/show_bug.cgi?id=196549
3097         <rdar://44979744>
3098
3099         Reviewed by Geoffrey Garen.
3100
3101         * NetworkProcess/NetworkSessionCreationParameters.cpp:
3102         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
3103         (WebKit::NetworkSessionCreationParameters::encode const):
3104         (WebKit::NetworkSessionCreationParameters::decode):
3105         * NetworkProcess/NetworkSessionCreationParameters.h:
3106         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3107         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3108         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
3109         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
3110         (-[WKWebsiteDataStore _allowsTLSFallback]):
3111         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3112         * UIProcess/WebProcessPool.cpp:
3113         (WebKit::WebProcessPool::ensureNetworkProcess):
3114         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3115         (WebKit::WebsiteDataStore::parameters):
3116         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3117         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
3118         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
3119         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
3120         * UIProcess/WebsiteData/WebsiteDataStore.h:
3121         (WebKit::WebsiteDataStore::allowsTLSFallback const):
3122         (WebKit::WebsiteDataStore::networkingHasBegun):
3123         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
3124
3125 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
3126
3127         Remove support for -apple-trailing-word
3128         https://bugs.webkit.org/show_bug.cgi?id=196525
3129
3130         Reviewed by Zalan Bujtas.
3131
3132         This CSS property is nonstandard and not used.
3133
3134         * Configurations/FeatureDefines.xcconfig:
3135
3136 2019-04-03  Alex Christensen  <achristensen@webkit.org>
3137
3138         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
3139         https://bugs.webkit.org/show_bug.cgi?id=196476
3140
3141         Reviewed by Chris Dumez.
3142
3143         Re-apply a change I reverted in r241754 now that it's safe to do so.
3144
3145         * UIProcess/WebPageProxy.cpp:
3146         (WebKit::WebPageProxy::didCommitLoadForFrame):
3147
3148 2019-04-03  Daniel Bates  <dabates@apple.com>
3149
3150         [iOS] Should be able to dismiss picker or popover using the keyboard
3151         https://bugs.webkit.org/show_bug.cgi?id=196272
3152         <rdar://problem/48943170>
3153
3154         Reviewed by Wenson Hsieh.
3155
3156         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
3157         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
3158         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
3159
3160         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
3161         * UIProcess/ios/WKContentViewInteraction.mm:
3162         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
3163         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
3164         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
3165         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
3166         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
3167         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
3168         do not resign first responder status as the page activation state should not be changed.
3169         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
3170         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
3171         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
3172         respectively. If the input peripheral does not handle it then do what we do now.
3173         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3174         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
3175         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
3176         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
3177         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
3178         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
3179         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
3180         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
3181         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
3182         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
3183         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
3184         we are always editable because it is not possible to perform a selection operation when we have a popover open.
3185         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
3186         * UIProcess/ios/forms/WKFormColorControl.h:
3187         * UIProcess/ios/forms/WKFormColorControl.mm:
3188         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
3189         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
3190         (-[WKFormColorControl assistantView]): Deleted.
3191         (-[WKFormColorControl beginEditing]): Deleted.
3192         (-[WKFormColorControl endEditing]): Deleted.
3193         * UIProcess/ios/forms/WKFormInputControl.h:
3194         * UIProcess/ios/forms/WKFormInputControl.mm:
3195         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
3196         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
3197         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
3198         (-[WKFormInputControl beginEditing]): Deleted.
3199         (-[WKFormInputControl endEditing]): Deleted.
3200         (-[WKFormInputControl assistantView]): Deleted.
3201         * UIProcess/ios/forms/WKFormPeripheral.h:
3202         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
3203         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
3204         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
3205         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
3206         (-[WKFormPeripheralBase endEditing]): Ditto.
3207         (-[WKFormPeripheralBase assistantView]): Ditto.
3208         (-[WKFormPeripheralBase control]): Return the control.
3209         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
3210         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
3211         Command + .).
3212         * UIProcess/ios/forms/WKFormSelectControl.h:
3213         * UIProcess/ios/forms/WKFormSelectControl.mm:
3214         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
3215         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
3216         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
3217         (-[WKFormSelectControl assistantView]): Deleted.
3218         (-[WKFormSelectControl beginEditing]): Deleted.
3219         (-[WKFormSelectControl endEditing]): Deleted.
3220         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3221         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
3222         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
3223
3224 2019-04-03  Youenn Fablet  <youenn@apple.com>
3225
3226         Resetting quota should take into account third party origins
3227         https://bugs.webkit.org/show_bug.cgi?id=196462
3228
3229         Reviewed by Geoffrey Garen.
3230
3231         When clearing the storage quota, we were resetting it to the default value
3232         without taking care of whether third party or not.
3233         Updated the code to ensure that the default quota is computed based on the origin.
3234
3235         Updated existing test to cover this case.
3236
3237         * NetworkProcess/NetworkProcess.cpp:
3238         (WebKit::NetworkProcess::clearStorageQuota):
3239         (WebKit::NetworkProcess::setCacheStorageParameters):
3240         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
3241         (WebKit::NetworkProcess::storageQuotaManager):
3242         * NetworkProcess/NetworkProcess.h:
3243         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
3244         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
3245         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
3246
3247 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3248
3249         Get rid of HTMLInputElement::setEditingValue
3250         https://bugs.webkit.org/show_bug.cgi?id=196402
3251
3252         Reviewed by Darin Adler.
3253
3254         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
3255         (webkit_dom_element_html_input_element_set_editing_value):
3256         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
3257         (webkit_dom_html_input_element_set_editing_value):
3258
3259 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3260
3261         Add a WebKit internal feature flag to always enable modern compatibility mode by default
3262         https://bugs.webkit.org/show_bug.cgi?id=196526
3263         <rdar://problem/49532923>
3264
3265         Reviewed by Antoine Quint.
3266
3267         * Shared/WebPreferences.yaml:
3268
3269 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3270
3271         Introduce and add plumbing for a website policy for meta viewport tag handling
3272         https://bugs.webkit.org/show_bug.cgi?id=196285
3273
3274         Reviewed by Tim Horton.
3275
3276         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
3277         viewport tag and use native web page parameters instead of the default parameters.
3278
3279         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
3280         * Shared/WebsitePoliciesData.cpp:
3281         (WebKit::WebsitePoliciesData::encode const):
3282         (WebKit::WebsitePoliciesData::decode):
3283         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3284
3285         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
3286
3287         * Shared/WebsitePoliciesData.h:
3288         * UIProcess/API/APIWebsitePolicies.cpp:
3289         (API::WebsitePolicies::data):
3290         * UIProcess/API/APIWebsitePolicies.h:
3291
3292         Add additional plumbing for the policy flag.
3293
3294         * WebKit.xcodeproj/project.pbxproj:
3295         * WebProcess/WebPage/ios/WebPageIOS.mm:
3296         (WebKit::WebPage::resetViewportDefaultConfiguration):
3297
3298         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
3299         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
3300
3301 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3302
3303         Add plumbing for a compatibility mode preference in WebKit
3304         https://bugs.webkit.org/show_bug.cgi?id=196005
3305
3306         Reviewed by Tim Horton.
3307
3308         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
3309         (API::WebsitePolicies) for compatibility mode.
3310
3311         * Shared/WebCompatibilityMode.h: Added.
3312         * UIProcess/API/APIWebsitePolicies.h:
3313         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
3314         * UIProcess/Cocoa/NavigationState.mm:
3315         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3316         * UIProcess/WebPageProxy.cpp:
3317         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
3318         * UIProcess/WebPageProxy.h:
3319         * UIProcess/ios/WebPageProxyIOS.mm:
3320         * WebKit.xcodeproj/project.pbxproj:
3321
3322 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3323
3324         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
3325         https://bugs.webkit.org/show_bug.cgi?id=196487
3326
3327         Reviewed by Žan Doberšek.
3328
3329         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
3330         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
3331
3332         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3333         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
3334         synchronous update if needed.
3335
3336 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3337
3338         Web Inspector: [GTK] Copy copies to nowhere
3339         https://bugs.webkit.org/show_bug.cgi?id=181228
3340
3341         Reviewed by Michael Catanzaro.
3342
3343         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
3344         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
3345         the web process.
3346
3347         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
3348         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
3349         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
3350         * UIProcess/gtk/WebContextMenuProxyGtk.h:
3351
3352 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3353
3354         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
3355         https://bugs.webkit.org/show_bug.cgi?id=196284
3356         <rdar://problem/47228232>
3357
3358         Reviewed by Tim Horton.
3359
3360         Tests for both of these APIs will be added in a subsequent patch.
3361
3362         * Shared/API/Cocoa/WebKit.h:
3363         * UIProcess/API/APIPageConfiguration.cpp:
3364         (API::PageConfiguration::defaultWebsitePolicies const):
3365         (API::PageConfiguration::setDefaultWebsitePolicies):
3366         * UIProcess/API/APIPageConfiguration.h:
3367         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
3368
3369         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
3370         navigation action.
3371
3372         * UIProcess/API/Cocoa/WKWebView.mm:
3373         (-[WKWebView _initializeWithConfiguration:]):
3374         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3375         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3376
3377         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
3378
3379         (-[WKWebViewConfiguration copyWithZone:]):
3380         (-[WKWebViewConfiguration defaultWebpagePreferences]):
3381         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
3382         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
3383         * UIProcess/Cocoa/NavigationState.h:
3384         * UIProcess/Cocoa/NavigationState.mm:
3385         (WebKit::NavigationState::setNavigationDelegate):
3386         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3387
3388         Invoke the new WKWebpagePreferences-based navigation delegate method.
3389
3390         * WebKit.xcodeproj/project.pbxproj:
3391         * mac/postprocess-framework-headers.sh:
3392         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
3393
3394         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
3395         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
3396         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
3397
3398 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
3399
3400         Eliminate plugin sandbox exceptions
3401         https://bugs.webkit.org/show_bug.cgi?id=196510
3402
3403         Reviewed by Chris Dumez.
3404
3405         * PluginProcess/mac/PluginProcessMac.mm:
3406         (WebKit::PluginProcess::initializeSandbox):
3407         * UIProcess/Plugins/PluginInfoStore.cpp:
3408         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
3409         * UIProcess/Plugins/PluginInfoStore.h:
3410         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
3411         (WebKit::PluginInfoStore::shouldUsePlugin):
3412         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
3413
3414 2019-04-02  Alex Christensen  <achristensen@webkit.org>
3415
3416         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
3417         https://bugs.webkit.org/show_bug.cgi?id=196503
3418
3419         Reviewed by Chris Dumez.
3420
3421         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
3422         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
3423         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
3424         have the process not send the message when it knows the navigation is continuing in another process.
3425         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
3426
3427         * UIProcess/WebPageProxy.cpp:
3428         (WebKit::WebPageProxy::didCommitLoadForFrame):
3429         * WebProcess/WebPage/WebFrame.cpp:
3430         (WebKit::WebFrame::didReceivePolicyDecision):
3431         (WebKit::WebFrame::documentLoaderDetached):
3432         * WebProcess/WebPage/WebFrame.h:
3433
3434 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
3435
3436         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
3437         https://bugs.webkit.org/show_bug.cgi?id=196500
3438         <rdar://problem/49497788>
3439
3440         Reviewed by Brent Fulgham.
3441
3442         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
3443         'artwork-scale-factor' is causing sandbox violations.
3444
3445         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3446
3447 2019-04-02  Chris Dumez  <cdumez@apple.com>
3448
3449         [WK2] Add support for Window's beforeprint / afterprint events
3450         https://bugs.webkit.org/show_bug.cgi?id=196478
3451
3452         Reviewed by Alex Christensen.
3453
3454         Add support for Window's beforeprint / afterprint events as per:
3455         - https://html.spec.whatwg.org/#dom-print
3456
3457         Blink and Gecko already support this.
3458
3459         * WebProcess/WebPage/WebPage.cpp:
3460         (WebKit::WebPage::beginPrinting):
3461         (WebKit::WebPage::endPrinting):
3462
3463 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3464
3465         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
3466         https://bugs.webkit.org/show_bug.cgi?id=196496
3467         <rdar://problem/49521634>
3468
3469         Reviewed by Chris Dumez.
3470
3471         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
3472         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
3473         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
3474         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
3475         Objective-C object (which is now WKWebpagePreferences, after my change).
3476
3477         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
3478         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
3479         handler.
3480
3481         Tests:  WebKit.WebsitePoliciesWithBridgingCast
3482                 WebKit.WebsitePoliciesWithUnexpectedType
3483
3484         * UIProcess/Cocoa/NavigationState.mm:
3485         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3486
3487 2019-04-01  Chris Dumez  <cdumez@apple.com>
3488
3489         Unreviewed, drop debug logging landed as part of r242903 by mistake.
3490
3491         * UIProcess/WebPageProxy.cpp:
3492         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3493
3494 2019-04-01  Remy Demarest  <rdemarest@apple.com>
3495
3496         Add SPI to give injected bundles access to displayed PDFDocuments
3497         https://bugs.webkit.org/show_bug.cgi?id=196471
3498         <rdar://problem/48080768>
3499
3500         Reviewed by Tim Horton.
3501
3502         * WebKit.xcodeproj/project.pbxproj:
3503
3504         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
3505         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
3506         (WKBundlePageGetPDFDocumentInFrame):
3507
3508 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3509
3510         [WebKit2] Introduce a public version of WKWebsitePolicies
3511         https://bugs.webkit.org/show_bug.cgi?id=195989
3512         <rdar://problem/47228232>
3513
3514         Reviewed by Tim Horton.
3515
3516         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
3517         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
3518         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
3519         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
3520
3521         No change in behavior.
3522
3523         * Shared/Cocoa/APIObject.mm:
3524         (API::Object::newObject):
3525
3526         Wrap API::WebsitePolicies with WKWebpagePreferences.
3527
3528         * SourcesCocoa.txt:
3529         * UIProcess/API/Cocoa/WKWebView.mm:
3530         (-[WKWebView _updateWebsitePolicies:]):
3531         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
3532         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
3533
3534         Introduce WKWebpagePreferences.
3535
3536         (+[WKWebpagePreferences defaultPreferences]):
3537         (-[WKWebpagePreferences dealloc]):
3538         (-[WKWebpagePreferences init]):
3539         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
3540         (-[WKWebpagePreferences _contentBlockersEnabled]):
3541         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
3542         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
3543         (-[WKWebpagePreferences _setAutoplayPolicy:]):
3544         (-[WKWebpagePreferences _autoplayPolicy]):
3545         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
3546         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
3547         (-[WKWebpagePreferences _setPopUpPolicy:]):
3548         (-[WKWebpagePreferences _popUpPolicy]):
3549         (-[WKWebpagePreferences _customHeaderFields]):
3550         (-[WKWebpagePreferences _setCustomHeaderFields:]):
3551         (-[WKWebpagePreferences _websiteDataStore]):
3552         (-[WKWebpagePreferences _setWebsiteDataStore:]):
3553         (-[WKWebpagePreferences _setCustomUserAgent:]):
3554         (-[WKWebpagePreferences _customUserAgent]):
3555         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
3556         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
3557         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
3558         (-[WKWebpagePreferences _customNavigatorPlatform]):
3559         (-[WKWebpagePreferences _apiObject]):
3560         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
3561         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
3562
3563         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
3564         WKWebpagePreferences.
3565
3566         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3567         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3568
3569         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
3570         WKWebpagePreferences.
3571
3572         (-[_WKWebsitePolicies init]):
3573         (-[_WKWebsitePolicies webpagePreferences]):
3574         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
3575         (-[_WKWebsitePolicies contentBlockersEnabled]):
3576         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
3577         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
3578         (-[_WKWebsitePolicies setAutoplayPolicy:]):
3579         (-[_WKWebsitePolicies autoplayPolicy]):
3580         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
3581         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
3582         (-[_WKWebsitePolicies setPopUpPolicy:]):
3583         (-[_WKWebsitePolicies popUpPolicy]):
3584         (-[_WKWebsitePolicies customHeaderFields]):
3585         (-[_WKWebsitePolicies setCustomHeaderFields:]):
3586         (-[_WKWebsitePolicies websiteDataStore]):
3587         (-[_WKWebsitePolicies setWebsiteDataStore:]):
3588         (-[_WKWebsitePolicies setCustomUserAgent:]):
3589         (-[_WKWebsitePolicies customUserAgent]):
3590         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
3591         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
3592         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
3593         (-[_WKWebsitePolicies customNavigatorPlatform]):
3594         (-[_WKWebsitePolicies description]):
3595         (-[_WKWebsitePolicies _apiObject]):
3596         (-[_WKWebsitePolicies dealloc]): Deleted.
3597         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
3598         * UIProcess/Cocoa/NavigationState.mm:
3599         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3600         * WebKit.xcodeproj/project.pbxproj:
3601
3602 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3603
3604         Unable to copy and paste a PDF from Notes into Mail compose body
3605         https://bugs.webkit.org/show_bug.cgi?id=196442
3606         <rdar://problem/48573098>
3607
3608         Reviewed by Tim Horton.
3609
3610         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
3611         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
3612         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
3613
3614         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
3615
3616         * UIProcess/ios/WKContentViewInteraction.mm:
3617         (-[WKContentView canPerformActionForWebView:withSender:]):
3618
3619 2019-04-01  Tim Horton  <timothy_horton@apple.com>
3620
3621         Make UIWKDocumentContext rects per-character instead of per-word
3622         https://bugs.webkit.org/show_bug.cgi?id=196459
3623
3624         Reviewed by Wenson Hsieh.
3625
3626         * WebProcess/WebPage/ios/WebPageIOS.mm:
3627         (WebKit::WebPage::requestDocumentEditingContext):
3628         Switch to CharacterIterator instead of TextIterator directly, to get
3629         per-character rects as the API requests.
3630
3631 2019-04-01  Chris Dumez  <cdumez@apple.com>
3632
3633         UIProcess crash when a prewarmed process is terminated
3634         https://bugs.webkit.org/show_bug.cgi?id=196451
3635         <rdar://problem/49245471>
3636
3637         Reviewed by Geoffrey Garen.
3638
3639         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
3640         true after r243384. For example, prewarmed WebContent processe do not get a data store
3641         until they actually get used.
3642
3643         * UIProcess/API/Cocoa/WKProcessPool.mm:
3644         (-[WKProcessPool _prewarmedProcessIdentifier]):
3645         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3646         * UIProcess/WebProcessPool.cpp:
3647         (WebKit::WebProcessPool::networkProcessIdentifier):
3648         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
3649         * UIProcess/WebProcessPool.h:
3650         * UIProcess/WebProcessProxy.cpp:
3651         (WebKit::WebProcessProxy::didClose):
3652         (WebKit::WebProcessProxy::didFinishLaunching):
3653         (WebKit::WebProcessProxy::requestTermination):
3654         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
3655         * UIProcess/WebProcessProxy.h:
3656
3657 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
3658
3659         [GTK][WPE] Add more websitedatastore directories to web process sandbox
3660         https://bugs.webkit.org/show_bug.cgi?id=196447
3661
3662         Reviewed by Michael Catanzaro.
3663
3664         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3665         (WebKit::bubblewrapSpawn):
3666         * UIProcess/glib/WebProcessProxyGLib.cpp:
3667         (WebKit::WebProcessProxy::platformGetLaunchOptions):
3668
3669 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
3670
3671         [macOS] Crash when loading Twitter with autoplay video enabled.
3672         https://bugs.webkit.org/show_bug.cgi?id=196446
3673         <rdar://problem/49060359>
3674
3675         Reviewed by Brent Fulgham.
3676
3677         This is caused by a syscall violation.
3678
3679         * WebProcess/com.apple.WebProcess.sb.in:
3680
3681 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
3682
3683         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
3684         https://bugs.webkit.org/show_bug.cgi?id=196297
3685
3686         Reviewed by Michael Catanzaro.
3687
3688         More information can be found here: https://www.exploit-db.com/exploits/46594
3689
3690         Note that this sandbox never made it into production so does not
3691         warrant any CVE specific to WebKit.
3692
3693         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
3694         (WebKit::setupSeccomp):
3695
3696 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
3697
3698         [iOS] Crash when changing inputmode for certain types of focusable elements
3699         https://bugs.webkit.org/show_bug.cgi?id=196431
3700         <rdar://problem/49454962>
3701
3702         Reviewed by Tim Horton.
3703
3704         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
3705         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
3706         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
3707         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
3708         focused element doesn't fall into one of the aforementioned categories.
3709
3710         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
3711         element. See below for more details.
3712
3713         Test: fast/forms/change-inputmode-crash.html
3714
3715         * WebProcess/WebPage/WebPage.cpp:
3716         (WebKit::isTextFormControlOrEditableContent):
3717
3718         Clean up some existing logic by introducing a helper method for determining whether an element should
3719         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
3720         of checking against the tag name.
3721
3722         (WebKit::WebPage::elementDidFocus):
3723         (WebKit::WebPage::focusedElementDidChangeInputMode):
3724
3725 2019-03-31  Sam Weinig  <weinig@apple.com>
3726
3727         Remove more i386 specific configurations
3728         https://bugs.webkit.org/show_bug.cgi?id=196430
3729
3730         Reviewed by Alexey Proskuryakov.
3731
3732         * Configurations/BaseTarget.xcconfig:
3733         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
3734  
3735         * Configurations/FeatureDefines.xcconfig:
3736         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
3737
3738 2019-03-31  Andy Estes  <aestes@apple.com>
3739
3740         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
3741         https://bugs.webkit.org/show_bug.cgi?id=196433
3742         <rdar://problem/49293305>
3743
3744         Reviewed by Tim Horton.
3745
3746         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
3747         decision behavior. The configuration setting defaults to YES for clients linked on or after
3748         this WebKit change and NO otherwise.
3749
3750         * NetworkProcess/NetworkResourceLoader.cpp:
3751         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
3752         * Shared/WebPreferences.yaml:
3753         * Shared/ios/QuickLookDocumentData.cpp:
3754         (WebKit::QuickLookDocumentData::isEmpty const):
3755         * Shared/ios/QuickLookDocumentData.h:
3756         * UIProcess/API/Cocoa/WKWebView.mm:
3757         (-[WKWebView _initializeWithConfiguration:]):
3758         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3759         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
3760         (-[WKWebViewConfiguration init]):
3761         (-[WKWebViewConfiguration encodeWithCoder:]):
3762         (-[WKWebViewConfiguration initWithCoder:]):
3763         (-[WKWebViewConfiguration copyWithZone:]):
3764         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
3765         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
3766         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3767         * UIProcess/Cocoa/VersionChecks.h:
3768         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
3769         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
3770
3771 2019-03-30  Zalan Bujtas  <zalan@apple.com>
3772
3773         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
3774         https://bugs.webkit.org/show_bug.cgi?id=196408
3775         <rdar://problem/49436797>
3776
3777         Reviewed by Simon Fraser.
3778
3779         Hover intent fails when an unrelated frame commits a load the same time.
3780         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
3781         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
3782
3783         * WebProcess/WebPage/ios/WebPageIOS.mm:
3784         (WebKit::WebPage::cancelPotentialTap):
3785         (WebKit::WebPage::cancelPotentialTapInFrame):
3786
3787 2019-03-29  John Wilander  <wilander@apple.com>
3788
3789         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
3790         https://bugs.webkit.org/show_bug.cgi?id=196407
3791         <rdar://problem/47859936>
3792
3793         Reviewed by Brent Fulgham.
3794
3795         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
3796         moved Resource Load Statistics from the UI process to the network process. One
3797         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
3798         our compatibility fix for federated logins using popups. This patch redirects
3799         these IPC calls to the network process and cleans up some assumptions around
3800         them.
3801
3802         * CMakeLists.txt:
3803             Removed the old IPC receiver.
3804         * DerivedSources.make:
3805             Removed the old IPC receiver.
3806         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
3807         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
3808             This is no longer needed since there is a dedicated update mechanism
3809             that actually sends the update.
3810         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
3811         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3812         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
3813         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
3814             Two new IPC receivers to pipe the calls to the network process.
3815         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
3816             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
3817             this purpose.
3818         * NetworkProcess/NetworkConnectionToWebProcess.h:
3819         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3820         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
3821             Removed the old IPC receiver.
3822         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3823         * WebKit.xcodeproj/project.pbxproj:
3824         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3825         (WKBundleResourceLoadStatisticsNotifyObserver):
3826             Function name update.
3827         * WebProcess/WebProcess.cpp:
3828             Now calls IPC to the network process instead of the UI process.
3829
3830 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
3831
3832         Delete WebMetal implementation in favor of WebGPU
3833         https://bugs.webkit.org/show_bug.cgi?id=195418
3834
3835         Reviewed by Dean Jackson.
3836
3837         * Configurations/FeatureDefines.xcconfig:
3838         * Shared/WebPreferences.yaml:
3839         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3840         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3841
3842 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
3843
3844         [Curl] Add Server Trust Evaluation Support.
3845         https://bugs.webkit.org/show_bug.cgi?id=191646
3846
3847         Reviewed by Fujii Hironori.
3848
3849         Tests: http/tests/ssl/iframe-upgrade.https.html
3850                http/tests/ssl/mixedContent/insecure-websocket.html
3851                http/tests/ssl/upgrade-origin-usage.html
3852
3853         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3854         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3855         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
3856         (WebKit::NetworkDataTaskCurl::restartWithCredential):
3857         * NetworkProcess/curl/NetworkDataTaskCurl.h:
3858
3859 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
3860
3861         Implement ResizeObserver.
3862         https://bugs.webkit.org/show_bug.cgi?id=157743
3863
3864         Reviewed by Simon Fraser.
3865
3866         Add WebPreferences and FeatureDefines for ResizeObserver.
3867
3868         * Configurations/FeatureDefines.xcconfig:
3869         * Shared/WebPreferences.yaml:
3870
3871 2019-03-28  Timothy Hatcher  <timothy@apple.com>
3872
3873         CFDictionary encoder crashes on non-string keys.
3874         https://bugs.webkit.org/show_bug.cgi?id=196388
3875         rdar://problem/49339242
3876
3877         Reviewed by Ryosuke Niwa.
3878
3879         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
3880         size for dictionaries and arrays when unknown keys or values are skipped.
3881         Allow null array encoding and decoding like dictionary already allowed.
3882
3883         * Shared/cf/ArgumentCodersCF.cpp:
3884         (IPC::encode):
3885         (IPC::decode):
3886
3887 2019-03-28  John Wilander  <wilander@apple.com>
3888
3889         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
3890         https://bugs.webkit.org/show_bug.cgi?id=196281
3891         <rdar://problem/48938748>
3892
3893         Reviewed by Alex Christensen.
3894
3895         The move of Resource Load Statistics to the network process requires that it
3896         calls the UI process when clearing website data (previously the other way
3897         around). This patch achieves that.
3898
3899         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
3900         filters its WebsiteDataTypes down to just the ones applicable for the UI
3901         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
3902         IPC.
3903
3904         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
3905         the UI process side makes use of the re-introduced
3906         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
3907         data records and call WebsiteDataStore::removeData(). The re-introduced
3908         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
3909         https://trac.webkit.org/changeset/242056/webkit, then under the name
3910         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
3911         was dead code was the lack of IPC call that this patch adds.
3912
3913         * NetworkProcess/NetworkProcess.cpp:
3914         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
3915            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
3916            are WebsiteDataTypes applicable to the UI process.
3917         * NetworkProcess/NetworkProcess.h:
3918         * Shared/WebsiteData/WebsiteData.cpp:
3919         (WebKit::WebsiteData::ownerProcess):
3920         (WebKit::WebsiteData::filter):
3921             Convenience functions to manage process ownership of website data types.
3922         * Shared/WebsiteData/WebsiteData.h:
3923         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3924         (WKWebsiteDataStoreStatisticsHasLocalStorage):
3925             Test infrastructure, called by the TestRunner.
3926         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3927         * UIProcess/Network/NetworkProcessProxy.cpp:
3928         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
3929             New function to be called from the network process.
3930         * UIProcess/Network/NetworkProcessProxy.h:
3931         * UIProcess/Network/NetworkProcessProxy.messages.in:
3932         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
3933         (WebKit::WebsiteDataRecord::matches const):
3934             Now matches with WebCore::RegistrableDomain instead of a string.
3935         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
3936             Replaced by WebsiteDataRecord::matches().
3937         * UIProcess/WebsiteData/WebsiteDataRecord.h:
3938         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3939         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
3940             Re-introduced. It was removed as dead code in r242056.
3941         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
3942         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
3943             Test infrastructure, called by the TestRunner.
3944         * UIProcess/WebsiteData/WebsiteDataStore.h:
3945
3946 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
3947
3948         API::Data::createWithoutCopying should do a null check before calling CFRelease
3949         https://bugs.webkit.org/show_bug.cgi?id=196276
3950         <rdar://problem/48059859>
3951
3952         Reviewed by Alex Christensen.
3953
3954         * Shared/Cocoa/APIDataCocoa.mm:
3955         (API::Data::createWithoutCopying):
3956
3957 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
3958
3959         [iOS] Automatic focus of input field is flaky
3960         https://bugs.webkit.org/show_bug.cgi?id=196302
3961
3962         Reviewed by Brent Fulgham.
3963
3964         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
3965         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
3966         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
3967         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
3968
3969         * Shared/WebPageCreationParameters.cpp:
3970         (WebKit::WebPageCreationParameters::encode const):
3971         (WebKit::WebPageCreationParameters::decode):
3972         * Shared/WebPageCreationParameters.h:
3973         * UIProcess/API/Cocoa/WKWebView.mm:
3974         (hardwareKeyboardAvailabilityChangedCallback):
3975         * UIProcess/WebPageProxy.cpp:
3976         (WebKit::WebPageProxy::creationParameters):
3977         * UIProcess/WebPageProxy.h:
3978         * UIProcess/WebProcessProxy.cpp:
3979         * UIProcess/WebProcessProxy.h:
3980         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
3981         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
3982         * UIProcess/ios/WKContentViewInteraction.mm:
3983         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3984         * UIProcess/ios/WebPageProxyIOS.mm:
3985         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
3986         (WebKit::WebPageProxy::applicationWillEnterForeground):
3987         * WebProcess/WebPage/WebPage.cpp:
3988         * WebProcess/WebPage/WebPage.h:
3989
3990 2019-03-28  Tim Horton  <timothy_horton@apple.com>
3991
3992         Fix the build.
3993
3994         * UIProcess/ios/WKActionSheetAssistant.mm:
3995         (-[WKActionSheetAssistant showImageSheet]):
3996         * UIProcess/ios/WKContentViewInteraction.mm:
3997         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):