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