[Extra zoom mode] Support pushing input view controllers onto the navigation stack
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [Extra zoom mode] Support pushing input view controllers onto the navigation stack
4         https://bugs.webkit.org/show_bug.cgi?id=184397
5         <rdar://problem/39265294>
6
7         Reviewed by Timothy Hatcher.
8
9         Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
10         the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
11         and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
12         within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
13         presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
14         approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
15         UINavigationController to hook into this behavior, with modal presentation as a fallback.
16
17         At a high level, this patch makes the following tweaks to implement this behavior:
18
19         1. Store the currently presented view controller using a single member variable
20            (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
21            which view controller to present or dismiss much more straightforward.
22
23         2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
24            pushing an input view controller onto the navigation stack after presenting the focused form control view
25            controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
26
27         3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
28            navigation stack rather than presenting them modally means that we end up in a state where neither the
29            WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
30            Instead, have the WKTimePickerViewController actually become first responder when presenting.
31
32         4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
33            -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
34            presentation.
35
36         * UIProcess/ios/WKContentViewInteraction.h:
37
38         Remove the separate member variables for each type of input view controller, and instead have one to keep track
39         of the current (and only) presented input view controller.
40
41         * UIProcess/ios/WKContentViewInteraction.mm:
42         (-[WKContentView _willStartScrollingOrZooming]):
43         (-[WKContentView _didEndScrollingOrZooming]):
44         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
45         (-[WKContentView _stopAssistingNode]):
46
47         Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
48
49         (-[WKContentView reloadContextViewForPresentedListViewController]):
50
51         Adjust for consolidation of the different input view controller member variables to a single member (see changes
52         in WKContentViewInteraction.h).
53
54         (-[WKContentView addFocusedFormControlOverlay]):
55         (-[WKContentView removeFocusedFormControlOverlay]):
56         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
57         (-[WKContentView dismissAllInputViewControllers:]):
58
59         Add an `animated` argument. In the case where a different view controller was presented after presenting the
60         input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
61         the web view or focus overlay underneath.
62
63         (-[WKContentView focusedFormControlViewDidSubmit:]):
64         (-[WKContentView focusedFormControlViewDidCancel:]):
65         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
66         (-[WKContentView rectForFocusedFormControlView:]):
67         (-[WKContentView nextRectForFocusedFormControlView:]):
68         (-[WKContentView previousRectForFocusedFormControlView:]):
69         (-[WKContentView scrollViewForFocusedFormControlView:]):
70         (-[WKContentView actionNameForFocusedFormControlView:]):
71         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
72         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
73         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
74         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
75         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
76
77         Boilerplate renaming of focus overlay delegate methods.
78
79         (-[WKContentView _wheelChangedWithEvent:]):
80
81         Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
82
83         (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
84         (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
85
86         Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
87
88         (-[WKContentView dismissAllInputViewControllers]): Deleted.
89         (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
90         (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
91         (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
92         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
93         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
94         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
95         (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
96         (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
97         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
98         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
99         (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
100         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
101         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
102         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
103
104         Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
105         the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
106         present the focused form overlay as a separate view controller using the UINavigationController, and then
107         immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
108         updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
109         this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
110         overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
111         the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
112
113         * WebKit.xcodeproj/project.pbxproj:
114
115 2018-04-11  Youenn Fablet  <youenn@apple.com>
116
117         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
118         https://bugs.webkit.org/show_bug.cgi?id=184374
119
120         Reviewed by Chris Dumez.
121
122         Pass full FetchOptions parameters as part of NetworkResourceLoadParameters.
123         This will allow handling redirection mode as well as credentials in case of cross origin redirections.
124         In case of SameOrigin credentials and there is a redirection from same-origin to cross-origin,
125         we will be able to stop using credentials without going to WebProcess.
126
127         To handle properly cross-origin checks, we have to be able to use SecurityOrigin as in WebProcess.
128         We make WebProcess sends Origin Access White list information to NetworkProcess.
129         This allows supporting the white list when doing loading in NetworkProcess.
130         This only works consistently if all WebProcesses share the same whitelist.
131
132         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
133         (WebKit::NetworkConnectionToWebProcess::loadPing):
134         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
135         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
136         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
137         * NetworkProcess/NetworkConnectionToWebProcess.h:
138         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
139         * NetworkProcess/NetworkLoadChecker.cpp:
140         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
141         (WebKit::NetworkLoadChecker::checkRedirection):
142         (WebKit::NetworkLoadChecker::continueCheckingRequest):
143         (WebKit::NetworkLoadChecker::checkCORSRequest):
144         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
145         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
146         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
147         * NetworkProcess/NetworkLoadChecker.h:
148         (WebKit::NetworkLoadChecker::create):
149         * NetworkProcess/NetworkResourceLoadParameters.cpp:
150         (WebKit::NetworkResourceLoadParameters::encode const):
151         (WebKit::NetworkResourceLoadParameters::decode):
152         * NetworkProcess/NetworkResourceLoadParameters.h:
153         * NetworkProcess/PingLoad.cpp:
154         (WebKit::PingLoad::PingLoad):
155         (WebKit::PingLoad::willPerformHTTPRedirection):
156         * NetworkProcess/PingLoad.h:
157         * WebProcess/InjectedBundle/InjectedBundle.cpp:
158         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
159         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
160         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
161         * WebProcess/Network/WebLoaderStrategy.cpp:
162         (WebKit::WebLoaderStrategy::startPingLoad):
163
164 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
165
166         [GTK] WaylandCompositorDisplay leaks its wl_display
167         https://bugs.webkit.org/show_bug.cgi?id=184406
168
169         Reviewed by Carlos Garcia Campos.
170
171         Since we allocate our own wl_display here, need to chain up to the parent constructor
172         passing NativeDisplayOwned::Yes, or it won't ever be released. Move the initialize call to
173         the create function to ensure it's called after the constructor completes.
174
175         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
176         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
177         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
178
179 2018-04-11  Youenn Fablet  <youenn@apple.com>
180
181         Use more r-values in NetworkResourceLoader
182         https://bugs.webkit.org/show_bug.cgi?id=184478
183
184         Reviewed by Chris Dumez.
185
186         Pass load parameters as r-values to remove some unneeded copies.
187         Ditto for ResourceRequest inside NetworkResourceLoader.
188
189         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
190         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
191         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
192         * NetworkProcess/NetworkConnectionToWebProcess.h:
193         * NetworkProcess/NetworkResourceLoader.cpp:
194         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
195         (WebKit::NetworkResourceLoader::start):
196         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
197         (WebKit::NetworkResourceLoader::startNetworkLoad):
198         (WebKit::NetworkResourceLoader::continueWillSendRequest):
199         (WebKit::NetworkResourceLoader::validateCacheEntry):
200         * NetworkProcess/NetworkResourceLoader.h:
201
202 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
203
204         [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
205         https://bugs.webkit.org/show_bug.cgi?id=184352
206         <rdar://problem/39237683>
207
208         Reviewed by Andy Estes.
209
210         Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
211         any information requested in the UI process that is dependent on the `title` of the focused element is broken
212         in the case of select elements. An existing example of this is the title of the table view controller used to
213         present select menus on iPad.
214
215         To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
216         HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
217         zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
218         controller's title.
219
220         Test: fast/forms/ios/ipad/select-with-title.html
221
222         * UIProcess/API/Cocoa/WKWebView.mm:
223         (-[WKWebView selectFormPopoverTitle]):
224         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
225
226         Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
227         element.
228
229         * UIProcess/ios/WKContentViewInteraction.h:
230         * UIProcess/ios/WKContentViewInteraction.mm:
231         (-[WKContentView selectFormPopoverTitle]):
232         * UIProcess/ios/forms/WKFormSelectControl.h:
233         * UIProcess/ios/forms/WKFormSelectControl.mm:
234         (-[WKFormSelectControl selectFormPopoverTitle]):
235         * UIProcess/ios/forms/WKFormSelectPopover.h:
236         * UIProcess/ios/forms/WKFormSelectPopover.mm:
237         (-[WKSelectPopover initWithView:hasGroups:]):
238         (-[WKSelectPopover tableViewController]):
239         * WebProcess/WebPage/ios/WebPageIOS.mm:
240
241         Always send the title across if the focused node is an HTMLElement.
242
243         (WebKit::WebPage::getAssistedNodeInformation):
244
245 2018-04-11  Ryan Haddad  <ryanhaddad@apple.com>
246
247         Unreviewed, rolling out r230508.
248
249         Breaks internal builds.
250
251         Reverted changeset:
252
253         "Remove block selection code"
254         https://bugs.webkit.org/show_bug.cgi?id=184470
255         https://trac.webkit.org/changeset/230508
256
257 2018-04-11  Antoine Quint  <graouts@apple.com>
258
259         [Web Animations] Turn Web Animations on by default
260         https://bugs.webkit.org/show_bug.cgi?id=184491
261
262         Reviewed by Simon Fraser.
263
264         * Shared/WebPreferences.yaml:
265
266 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
267
268         Unreviewed test fix after r230468
269
270         Roll out an assertion added in r230468 that should not be present
271         until https://bugs.webkit.org/show_bug.cgi?id=184451 is landed.
272
273         * Shared/mac/HangDetectionDisablerMac.mm:
274         (WebKit::setClientsMayIgnoreEvents):
275
276 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
277
278         Unreviewed follow-up to r230468.
279
280         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
281
282         * UIProcess/mac/PageClientImplMac.mm:
283         (WebKit::PageClientImpl::isViewWindowActive):
284         (WebKit::PageClientImpl::setCursor):
285
286 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
287
288         [Win] Add UserAgentWin.cpp
289         https://bugs.webkit.org/show_bug.cgi?id=184438
290
291         Reviewed by Michael Catanzaro.
292
293         * WebProcess/WebPage/win/WebPageWin.cpp:
294         (WebKit::WebPage::platformUserAgent const):
295         Use WebCore::standardUserAgentForURL.
296
297 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
298
299         Remove block selection code
300         https://bugs.webkit.org/show_bug.cgi?id=184470
301
302         Reviewed by Timothy Hatcher.
303         
304         Remove block selection code that isn't run and is currently not even used.
305         Had to put this back in for a bug in the mid-year release, but we're past that
306         so it's time for this to go away.
307
308         * Platform/spi/ios/UIKitSPI.h:
309         * UIProcess/PageClient.h:
310         * UIProcess/WebPageProxy.h:
311         * UIProcess/WebPageProxy.messages.in:
312         * UIProcess/ios/PageClientImplIOS.h:
313         * UIProcess/ios/PageClientImplIOS.mm:
314         (WebKit::PageClientImpl::stopAssistingNode):
315         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
316         * UIProcess/ios/WKContentViewInteraction.h:
317         * UIProcess/ios/WKContentViewInteraction.mm:
318         (toSelectionHandlePosition): Deleted.
319         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
320         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
321         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
322         * UIProcess/ios/WebPageProxyIOS.mm:
323         (WebKit::WebPageProxy::saveImageToLibrary):
324         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
325         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
326         * WebProcess/WebPage/WebPage.h:
327         * WebProcess/WebPage/WebPage.messages.in:
328         * WebProcess/WebPage/ios/WebPageIOS.mm:
329         (WebKit::rangeAtWordBoundaryForPosition):
330         (WebKit::distanceBetweenRectsForPosition): Deleted.
331         (WebKit::rectsEssentiallyTheSame): Deleted.
332         (WebKit::unionDOMRanges): Deleted.
333         (WebKit::computeEdgeCenter): Deleted.
334         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
335         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
336         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
337         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
338         (WebKit::shouldExpand): Deleted.
339         (WebKit::WebPage::changeBlockSelection): Deleted.
340         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
341
342 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
343
344         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
345         https://bugs.webkit.org/show_bug.cgi?id=184435
346         <rdar://problem/38726260>
347
348         Reviewed by Dean Jackson.
349
350         Adds support for an alternate codepath when computing a zoom rect when double tapping that doesn't take the hit-
351         tested node into account, and instead cycles the zoom scale between 2 fixed values (in addition to the initial
352         scale). In the next patch, these fixed scales will be determined by computing zoom scales needed to make most of
353         the text on the page legible (i.e. the first text legibility zoom scale), and another to make all of the text on
354         the page legible, with the exception of outliers (this is the second text legibility zoom scale).
355
356         See comments below for more detail.
357
358         * UIProcess/Cocoa/ViewGestureController.h:
359         * UIProcess/Cocoa/ViewGestureController.messages.in:
360         * UIProcess/ios/SmartMagnificationController.h:
361         * UIProcess/ios/SmartMagnificationController.messages.in:
362         * UIProcess/ios/SmartMagnificationController.mm:
363         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
364         * UIProcess/mac/ViewGestureControllerMac.mm:
365         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
366         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
367         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
368
369         Rename the boolean `isReplacedElement` argument to `fitEntireRect` instead. The UI process only uses this on iOS
370         to determine whether or not to fit the entire element rect to the viewport and add padding. This patch renames
371         this variable because we are not zooming to a replaced element in the case where text legibility on the page
372         (rather than element geometry) is being used to figure out the zoom scale, but we still want to fit the entire
373         target rect to the viewport.
374
375         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
376
377         If text legiblity zoom scaling is preferred, then compute first and second-level text legibility zoom scales to
378         zoom to upon double tap (where the second zoom scale is greater than the first). To choose a target zoom
379         scale, choose the lowest target zoom scale that is at least a small amount less than the current scale. If
380         neither of the two scales fulfill this description, then zoom back out to the initial scale. This has the effect
381         of consistently cycling between all three zoom scales as the user double taps.
382
383         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
384
385         Introduce a new helper method that computes and caches target scales to zoom to when double tapping to zoom. If
386         a cached pair of target scales is already present, it skips this computation and immediately returns it.
387
388         (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
389         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
390
391         Factor out logic to compute min and max zoom scales into a separate helper, and call it from both
392         computeZoomInformationForNode and computeTextLegibilityScales.
393
394         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
395
396         Invalidate cached text legibility scales when layout is triggered.
397
398         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
399         * WebProcess/WebPage/WebPage.cpp:
400         (WebKit::WebPage::mainFrameDidLayout):
401         * WebProcess/WebPage/WebPage.h:
402         (WebKit::WebPage::viewportConfiguration const):
403
404         Expose WebPage's ViewportConfiguration as a const reference.
405
406         * WebProcess/WebPage/ios/WebPageIOS.mm:
407         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
408
409         Adds a platform hook for opting into text-legibility-based zoom scaling instead of regular hit-testing-based
410         zoom scaling heuristics.
411
412 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
413
414         Fix availability annotations for _WKAttachment SPI
415         https://bugs.webkit.org/show_bug.cgi?id=184473
416         <rdar://problem/39319732>
417
418         Reviewed by Dan Bernstein.
419
420         _WKAttachmentInfo is available in WK_MAC_TBA and WK_IOS_TBA, but the SPI method -[_WKAttachment requestInfo:]
421         is currently available in macOS 10.13.4 and iOS 11.3. Instead, the availability of this SPI should match the
422         availability of the SPI object it depends on.
423
424         * UIProcess/API/Cocoa/_WKAttachment.h:
425
426 2018-04-10  Chris Dumez  <cdumez@apple.com>
427
428         Avoid constructing a service worker RegistrationStore for private sessions
429         https://bugs.webkit.org/show_bug.cgi?id=184463
430         <rdar://problem/36613948>
431
432         Reviewed by Youenn Fablet.
433
434         Avoid constructing a service worker RegistrationStore for private sessions since there
435         is no need for persistence and the registrationDatabaseDirectory is the empty string in
436         such cases.
437
438         * StorageProcess/StorageProcess.cpp:
439         (WebKit::StorageProcess::initializeWebsiteDataStore):
440
441 2018-04-10  Andy Estes  <aestes@apple.com>
442
443         [iOS] Navigate to URL and page number annotations in WKPDFView
444         https://bugs.webkit.org/show_bug.cgi?id=184410
445
446         Reviewed by Timothy Hatcher.
447
448         Implemented navigation to URL and page number (same-document) link annotations in PDFs.
449
450         * UIProcess/ios/WKPDFView.mm:
451         (-[WKPDFView _scrollToURLFragment:]):
452         (-[WKPDFView web_didSameDocumentNavigation:]):
453         (-[WKPDFView pdfHostViewController:updatePageCount:]):
454         (-[WKPDFView pdfHostViewController:goToURL:]):
455         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
456
457 2018-04-10  Andy Estes  <aestes@apple.com>
458
459         [iOS] WKPDFView should conform to _WKWebViewPrintProvider
460         https://bugs.webkit.org/show_bug.cgi?id=184471
461
462         Reviewed by Dan Bernstein.
463
464         * UIProcess/API/Cocoa/WKWebView.mm:
465         (-[WKWebView _printProvider]):
466
467         The print provider will always be either _contentView or _customContentView, but
468         might not be _currentContentView.
469
470         * UIProcess/ios/WKPDFView.mm:
471         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
472
473         Asked _hostViewController for the page count, clamped to 1 if
474         -[_WKWebViewPrintFormatter snapshotFirstPage] is YES.
475
476         (-[WKPDFView _wk_printedDocument]):
477
478         Created a CGPDFDocumentRef from _data and returned it.
479
480 2018-04-10  Youenn Fablet  <youenn@apple.com>
481
482         Beacon redirect responses should be CORS validated
483         https://bugs.webkit.org/show_bug.cgi?id=184378
484
485         Reviewed by Chris Dumez.
486
487         Add CORS checks to any redirection response if mode is CORS.
488         Update response tainting and redirected accordingly.
489
490         * NetworkProcess/NetworkLoadChecker.cpp:
491         (WebKit::NetworkLoadChecker::checkRedirection):
492         (WebKit::NetworkLoadChecker::validateResponse):
493         * NetworkProcess/NetworkLoadChecker.h:
494         * NetworkProcess/PingLoad.cpp:
495         (WebKit::PingLoad::willPerformHTTPRedirection):
496
497 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
498
499         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
500         https://bugs.webkit.org/show_bug.cgi?id=184268
501         <rdar://problem/39144446>
502
503         Reviewed by Chris Dumez.
504
505         Webpage for multipart stream responses failed to refresh because content policy was set to 
506         be ignore when provisonalDocumentLoader was null and navigation ID could not be retrieved. 
507         As loading should not stop in this case, we set navigation ID 0 and still ask for content 
508         policy.
509
510         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
511         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
512
513 2018-04-10  Andy Estes  <aestes@apple.com>
514
515         [iOS] Use PDFKit to render PDFs in WKWebView
516         https://bugs.webkit.org/show_bug.cgi?id=184387
517
518         Reviewed by Beth Dakin.
519
520         Adopted PDFHostViewController for rendering PDFs in WKWebView.
521
522         This patch implements rendering the PDF document and page number indicator. Link
523         navigation, find-in-page, and printing will be implemented in follow-up patches.
524
525         WKLegacyPDFView is still the default PDF view.
526
527         * Configurations/WebKit.xcconfig:
528
529         Linked WebKit with PDFKit on iOS.
530
531         * UIProcess/API/Cocoa/WKWebView.mm:
532         (-[WKWebView _currentContentView]):
533         (-[WKWebView viewForZoomingInScrollView:]):
534
535         When WKPDFView loads a PDF document, it replaces itself with a view vended by
536         PDFHostViewController as the WKScrollView's content view. Abstracted WKWebView's
537         concept of the "current content view" to be either the WKContentView or a view of
538         the custom content view's choosing (-web_contentView).
539
540         (-[WKWebView scrollViewWillBeginZooming:withView:]):
541         (-[WKWebView scrollViewDidZoom:]):
542         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
543
544         Forwarded these calls to _customContentView if it responds to the equivalent
545         WKWebViewContentProvider selectors.
546
547         * UIProcess/Cocoa/WKWebViewContentProvider.h:
548
549         Defined new protocol selectors.
550
551         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
552         (-[WKWebViewContentProviderRegistry init]):
553         * UIProcess/ios/WKLegacyPDFView.h:
554         * UIProcess/ios/WKLegacyPDFView.mm:
555
556         Changed ENABLE(WKPDFVIEW) to ENABLE(WKLEGACYPDFVIEW).
557
558         (-[WKLegacyPDFView web_contentView]):
559
560         Added. Returns self as the content view.
561
562         * UIProcess/ios/WKPDFView.h: Added.
563         * UIProcess/ios/WKPDFView.mm: Added.
564         (-[WKPDFView dealloc]):
565
566         Removed the host view and page number indicator from their superviews.
567
568         (-[WKPDFView gestureRecognizerShouldBegin:]):
569
570         Forwarded to _hostViewController.
571
572         (-[WKPDFView web_initWithFrame:webView:]):
573
574         Set ours and the scroll view's background color to UIColor.grayColor to match
575         WKLegacyPDFView.
576
577         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
578
579         Created a PDFHostViewController and set its root view as the scroll view's content
580         view after removing the WKPDFView itself. This allows WKPDFView to act as a
581         placeholder content view until the PDF is loaded. Added the host view controller's
582         page number indicator to the fixed overlay view. Finally, loaded the PDF document
583         by calling -[PDFHostViewController setDocumentData:withScrollView:].
584
585         (-[WKPDFView _offsetForPageNumberIndicator]):
586
587         Computed an offset for the page number indicator like WKLegacyPDFView did, taking
588         into account the overlaid accessory views inset, computed unobscured safe area
589         inset, and computed obscured inset.
590
591         (-[WKPDFView _movePageNumberIndicatorToPoint:animated:]):
592
593         Moved the page number indicator using the margin and animation duration from
594         WKLegacyPDFView.
595
596         (-[WKPDFView _updateLayoutAnimated:]):
597
598         Added a convenience method to update the PDF view layout and position the page
599         number indicator.
600
601         (-[WKPDFView web_setMinimumSize:]):
602
603         Updated our own frame in case we are still the placeholder content view.
604         Called -_updateLayoutAnimated:.
605
606         (-[WKPDFView web_setOverlaidAccessoryViewsInset:]):
607
608         Stored the inset and called -_updateLayoutAnimated:.
609
610         (-[WKPDFView web_computedContentInsetDidChange]):
611
612         Called -_updateLayoutAnimated:.
613
614         (-[WKPDFView web_setFixedOverlayView:]):
615
616         Stored the fixed overlay view.
617
618         (-[WKPDFView web_didSameDocumentNavigation:]):
619         (-[WKPDFView web_countStringMatches:options:maxCount:]):
620         (-[WKPDFView web_findString:options:maxCount:]):
621         (-[WKPDFView web_hideFindUI]):
622
623         Added FIXMEs.
624
625         (-[WKPDFView web_contentView]):
626
627         If there is a host view controller, return its root view. Otherwise, return self.
628
629         (-[WKPDFView web_scrollViewDidScroll:]):
630         (-[WKPDFView web_scrollViewWillBeginZooming:withView:]):
631         (-[WKPDFView web_scrollViewDidEndZooming:withView:atScale:]):
632         (-[WKPDFView web_scrollViewDidZoom:]):
633
634         Called -[PDFHostViewController updatePDFViewLayout].
635
636         (-[WKPDFView web_dataRepresentation]):
637
638         Returned _data.
639
640         (-[WKPDFView web_suggestedFilename]):
641
642         Returned _suggestedFilename.
643
644         (-[WKPDFView web_isBackground]):
645
646         Returned self.isBackground.
647
648         * UIProcess/ios/WKSystemPreviewView.mm:
649         (-[WKSystemPreviewView web_contentView]):
650
651         Added. Returns self as the content view.
652
653         * WebKit.xcodeproj/project.pbxproj:
654
655 2018-04-10  Miguel Gomez  <magomez@igalia.com>
656
657         [GTK][WPE] Race condition when destroying webprocesses
658         https://bugs.webkit.org/show_bug.cgi?id=184445
659
660         Reviewed by Carlos Garcia Campos.
661
662         Ensure that the WebProcess is properly closing its pages when it's exiting because
663         the UIProcess has invalidated the IPC connection.
664
665         * WebProcess/WebProcess.cpp:
666         (WebKit::WebProcess::didClose):
667
668 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
669
670         Add missing availability macros after r230462
671         https://bugs.webkit.org/show_bug.cgi?id=184426
672
673         Reviewed by Timothy Hatcher.
674
675         Annotate new SPI added in r230462 with the appropriate availability macros.
676
677         * UIProcess/API/Cocoa/WKViewPrivate.h:
678         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
679
680 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
681
682         Add ProcessPrivilege assertions to places that access NSApp
683         https://bugs.webkit.org/show_bug.cgi?id=184322
684         <rdar://problem/39194560>
685
686         Reviewed by Per Arne Vollan.
687
688         Add ProcessPrivilege assertions to places where we interact with NSApp so
689         that we can prevent accidentally using them in the WebContent process.
690
691         * Shared/mac/ChildProcessMac.mm:
692         (WebKit::ChildProcess::stopNSAppRunLoop):
693         * Shared/mac/HangDetectionDisablerMac.mm:
694         (WebKit::setClientsMayIgnoreEvents):
695         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
696         (WebKit::WebProcessPool::platformInitializeWebProcess):
697         * UIProcess/Cocoa/WebViewImpl.mm:
698         (WebKit::WebViewImpl::WebViewImpl):
699         (WebKit::WebViewImpl::becomeFirstResponder):
700         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
701         (WebKit::WebViewImpl::validateUserInterfaceItem):
702         (WebKit::WebViewImpl::startSpeaking):
703         (WebKit::WebViewImpl::stopSpeaking):
704         (WebKit::applicationFlagsForDrag):
705         (WebKit::WebViewImpl::doneWithKeyEvent):
706         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
707         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
708         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
709         (WebKit::PluginProcessProxy::enterFullscreen):
710         (WebKit::PluginProcessProxy::beginModal):
711         (WebKit::PluginProcessProxy::endModal):
712         * UIProcess/mac/DisplayLink.cpp:
713         (WebKit::DisplayLink::DisplayLink):
714         (WebKit::DisplayLink::~DisplayLink):
715         * UIProcess/mac/PageClientImplMac.mm:
716         (WebKit::PageClientImpl::isViewWindowActive):
717         (WebKit::PageClientImpl::setCursor):
718         * UIProcess/mac/WebPageProxyMac.mm:
719         (WebKit::WebPageProxy::getIsSpeaking):
720         (WebKit::WebPageProxy::speak):
721         (WebKit::WebPageProxy::stopSpeaking):
722         (WebKit::WebPageProxy::startDisplayLink):
723         * UIProcess/mac/WebPopupMenuProxyMac.mm:
724         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
725
726 2018-04-09  John Wilander  <wilander@apple.com>
727
728         Refactor Ignore HSTS code
729         https://bugs.webkit.org/show_bug.cgi?id=184433
730         <rdar://problem/39298238>
731
732         Reviewed by Darin Adler.
733
734         This patch refactors our ignore HSTS code. The convenience functions are moved
735         out of CFNetwork SPI in PAL, and into where they are used. It also switches
736         from performSelector: calls to straight function calls, after checking that
737         there is a responder.
738
739         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
740         (schemeWasUpgradedDueToDynamicHSTS):
741         (setIgnoreHSTS):
742         (ignoreHSTS):
743             Add convenience functions here since they were moved out of
744             CFNetworkSPI.h.
745
746 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
747
748         Rename UNUSED to BUNUSED
749         https://bugs.webkit.org/show_bug.cgi?id=184093
750
751         Reviewed by Yusuke Suzuki.
752
753         * UIProcess/API/Cocoa/WKWebView.mm:
754         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
755
756 2018-04-09  Timothy Hatcher  <timothy@apple.com>
757
758         Add support for setting a background color on WKWebView and WKView
759         https://bugs.webkit.org/show_bug.cgi?id=184426
760
761         Reviewed by Wenson Hsieh.
762
763         * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property.
764         * UIProcess/API/Cocoa/WKWebView.mm:
765         (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl.
766         (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl.
767         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property.
768         * UIProcess/API/mac/WKView.mm:
769         (-[WKView _backgroundColor]): Added. Call through to WebViewImpl.
770         (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl.
771         * UIProcess/Cocoa/WebViewImpl.h:
772         * UIProcess/Cocoa/WebViewImpl.mm:
773         (WebKit::WebViewImpl::setBackgroundColor): Added.
774         (WebKit::WebViewImpl::backgroundColor const): Added.
775         (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set.
776
777 2018-04-09  Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
778
779         [WinCairo] Add WebKit Shared/win event files for wincairo webkit
780         https://bugs.webkit.org/show_bug.cgi?id=183043
781
782         Reviewed by Brent Fulgham.
783
784         * Shared/NativeWebKeyboardEvent.h:
785         (WebKit::NativeWebKeyboardEvent::nativeEvent const):
786         * Shared/NativeWebMouseEvent.h:
787         (WebKit::NativeWebMouseEvent::nativeEvent const):
788         * Shared/NativeWebTouchEvent.h:
789         * Shared/NativeWebWheelEvent.h:
790         (WebKit::NativeWebWheelEvent::nativeEvent const):
791         * Shared/win/NativeWebKeyboardEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
792         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
793         * Shared/win/NativeWebMouseEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
794         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
795         * Shared/win/NativeWebTouchEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebTouchEvent.h.
796         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
797         * Shared/win/NativeWebWheelEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
798         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
799         * Shared/win/WebEventFactory.cpp: Added.
800         (WebKit::relativeCursorPosition):
801         (WebKit::point):
802         (WebKit::horizontalScrollChars):
803         (WebKit::verticalScrollLines):
804         (WebKit::clickCount):
805         (WebKit::IsKeyInDownState):
806         (WebKit::modifiersForEvent):
807         (WebKit::modifiersForCurrentKeyState):
808         (WebKit::keyboardEventTypeForEvent):
809         (WebKit::isSystemKeyEvent):
810         (WebKit::isKeypadEvent):
811         (WebKit::textFromEvent):
812         (WebKit::unmodifiedTextFromEvent):
813         (WebKit::keyIdentifierFromEvent):
814         (WebKit::WebEventFactory::createWebMouseEvent):
815         (WebKit::WebEventFactory::createWebWheelEvent):
816         (WebKit::WebEventFactory::createWebKeyboardEvent):
817         (WebKit::WebEventFactory::createWebTouchEvent):
818         * Shared/win/WebEventFactory.h: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
819         (WebKit::createNativeEvent):
820
821 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
822
823         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
824         https://bugs.webkit.org/show_bug.cgi?id=184344
825         <rdar://problem/39224969>
826
827         Reviewed by Per Arne Vollan.
828
829         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
830         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
831         we do not want to allow in the WebContent process.
832
833         Instead, we should just use the cached screen information the WebContent process already possesses.
834
835         This patch makes the following changes:
836         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
837            the WindowServer directly.
838         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
839            the user space version of the coordinates. A nil Window just means we want to get coordinates in
840            terms of the primary display.
841         3. Keep track of the primary display so we can refer to it later.
842         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
843         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
844            than whichever screen happened to hash to the lowest value.
845
846         Reviewed by Per Arne Vollan.
847
848         * UIProcess/WebProcessPool.cpp:
849         (WebKit::displayReconfigurationCallBack): Update for new getScreenProperties implementation.
850         (WebKit::WebProcessPool::initializeNewWebProcess): Ditto.
851         * WebProcess/WebProcess.cpp:
852         (WebKit::WebProcess::setScreenProperties): Ditto.
853         * WebProcess/WebProcess.h:
854         * WebProcess/WebProcess.messages.in: Ditto.
855
856 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
857
858         [WPE] Add API version to library soname and pkg-config files
859         https://bugs.webkit.org/show_bug.cgi?id=180608
860
861         Reviewed by Žan Doberšek.
862
863         * PlatformWPE.cmake:
864         * wpe/wpe-webkit.pc.in:
865
866 2018-04-09  Jer Noble  <jer.noble@apple.com>
867
868         Fix the selection assistant selectionView build
869         https://bugs.webkit.org/show_bug.cgi?id=184423
870         <rdar://problem/39288235>
871
872         Reviewed by Wenson Hsieh.
873
874         * Platform/spi/ios/UIKitSPI.h:
875         * UIProcess/ios/WKContentView.mm:
876         (-[WKContentView _didExitStableState]):
877         * UIProcess/ios/WKContentViewInteraction.mm:
878         (-[WKContentView _updateChangedSelection:]):
879
880 2018-04-09  Megan Gardner  <megan_gardner@apple.com>
881
882         Switch to UIWKTextInteractionAssistant for non-editable text
883         https://bugs.webkit.org/show_bug.cgi?id=182834
884
885         Switch to only using one assistant for text selection.
886
887         Reviewed by Timothy Hatcher and Andy Estes.
888
889         * UIProcess/ios/WKContentViewInteraction.mm:
890         (-[WKContentView useSelectionAssistantWithGranularity:]):
891
892 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
893
894         Unreviewed, move 'using namespace' back to the right place after r230429
895
896         * Shared/glib/ProcessExecutablePathGLib.cpp:
897
898 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
899
900         Unreviewed, rolling out r230390.
901
902         Broke accelerated compositing
903
904         Reverted changeset:
905
906         "[GTK] WaylandCompositorDisplay leaks its wl_display"
907         https://bugs.webkit.org/show_bug.cgi?id=184406
908         https://trac.webkit.org/changeset/230390
909
910 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
911
912         [Extra zoom mode] Disable fast clicking by default in extra zoom mode
913         https://bugs.webkit.org/show_bug.cgi?id=184411
914         <rdar://problem/38726867>
915
916         Reviewed by Andy Estes.
917
918         As it turns out, existing fast-clicking heuristics don't work so well in extra zoom mode. Even at device-width,
919         since the page is scaled to fit within the viewport, having single taps take precedence over double taps leads
920         to a confusing experience when trying to double tap to zoom further on content that contains links and other
921         click targets. Revert to legacy behavior here by disabling these heuristics.
922
923         * UIProcess/API/Cocoa/WKWebView.mm:
924         (-[WKWebView _initializeWithConfiguration:]):
925
926 2018-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
927
928         [Extra zoom mode] Add an SPI hook for clients to opt in to focus overlay UI
929         https://bugs.webkit.org/show_bug.cgi?id=184370
930         <rdar://problem/39250494>
931
932         Reviewed by Timothy Hatcher and Andy Estes.
933
934         Add a new SPI hook for internal clients to opt in to showing the focused form control overlay. By default, the
935         overlay is not shown.
936
937         * UIProcess/API/Cocoa/_WKInputDelegate.h:
938
939 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
940
941         [WPE] Use GNU install directories
942         https://bugs.webkit.org/show_bug.cgi?id=184377
943
944         Reviewed by Carlos Garcia Campos.
945
946         Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
947         WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
948
949         * PlatformWPE.cmake:
950         * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
951         (WebKit::getExecutablePath):
952         (WebKit::findWebKitProcess):
953         (WebKit::executablePathOfWebProcess):
954         (WebKit::executablePathOfPluginProcess):
955         (WebKit::executablePathOfNetworkProcess):
956         (WebKit::executablePathOfStorageProcess):
957         * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
958         * SourcesGTK.txt:
959         * SourcesWPE.txt:
960
961 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
962
963         [GTK] WaylandCompositorDisplay leaks its wl_display
964         https://bugs.webkit.org/show_bug.cgi?id=184406
965
966         Reviewed by Carlos Garcia Campos.
967
968         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
969         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
970         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): Fix the leak.
971
972 2018-04-08  Zan Dobersek  <zdobersek@igalia.com>
973
974         Non-Cocoa ports use default directory for ServiceWorker data during testing
975         https://bugs.webkit.org/show_bug.cgi?id=183784
976
977         Reviewed by Youenn Fablet.
978
979         Add API to WKWebsiteDataStore that enables setting and retrieving the
980         service worker registration directory for a given data store object.
981         This enables setting the temporary directory for testing purposes in
982         WebKitTestRunner.
983
984         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
985         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
986         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
987         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
988
989 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
990
991         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
992         https://bugs.webkit.org/show_bug.cgi?id=184127
993
994         Reviewed by Konstantin Tokarev.
995
996         * CMakeLists.txt: Link with WebCore as private,
997         WebCoreHeaderInterface as public to WebKit if WebCore is a static
998         library.
999         * CMakeLists.txt:
1000         * PlatformGTK.cmake: Added PRIVATE keyword for WebKit_LIBRARIES.
1001         * PlatformWPE.cmake: Ditto.
1002         * PlatformWin.cmake: Ditto.
1003
1004 2018-04-08  Andy Estes  <aestes@apple.com>
1005
1006         [iOS] WKContentView and WKLegacyPDFView should share application state tracking logic
1007         https://bugs.webkit.org/show_bug.cgi?id=184402
1008
1009         Reviewed by Dan Bernstein.
1010
1011         WKContentView and WKLegacyPDFView have nearly identical logic for tracking
1012         application foreground state. Let's share it so we can more easily create new
1013         content views with proper application state tracking.
1014
1015         * UIProcess/ios/WKApplicationStateTrackingView.h: Added.
1016         * UIProcess/ios/WKApplicationStateTrackingView.mm: Added.
1017         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
1018         (-[WKApplicationStateTrackingView willMoveToWindow:]):
1019         (-[WKApplicationStateTrackingView didMoveToWindow]):
1020         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
1021         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]):
1022         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
1023         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
1024         (-[WKApplicationStateTrackingView isBackground]):
1025
1026         Moved common logic from WKContentView and WKLegacyPDFView into
1027         WKApplicationStateTrackingView.
1028
1029         * UIProcess/ios/WKContentView.h:
1030         * UIProcess/ios/WKContentView.mm:
1031         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
1032         (-[WKContentView willMoveToWindow:]):
1033         (-[WKContentView _applicationDidCreateWindowContext]):
1034         (-[WKContentView didMoveToWindow]): Deleted.
1035         (-[WKContentView isBackground]): Deleted.
1036         (-[WKContentView _applicationDidEnterBackground]): Deleted.
1037         (-[WKContentView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
1038         (-[WKContentView _applicationWillEnterForeground]): Deleted.
1039
1040         Made WKContentView a subclass of WKApplicationStateTrackingView.
1041
1042         * UIProcess/ios/WKLegacyPDFView.h:
1043         * UIProcess/ios/WKLegacyPDFView.mm:
1044         (-[WKLegacyPDFView web_initWithFrame:webView:]):
1045         (-[WKLegacyPDFView web_isBackground]):
1046         (-[WKLegacyPDFView _applicationWillEnterForeground]):
1047         (-[WKLegacyPDFView willMoveToWindow:]): Deleted.
1048         (-[WKLegacyPDFView didMoveToWindow]): Deleted.
1049         (-[WKLegacyPDFView _applicationDidEnterBackground]): Deleted.
1050         (-[WKLegacyPDFView _applicationDidCreateWindowContext]): Deleted.
1051         (-[WKLegacyPDFView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
1052
1053         Made WKLegacyPDFView a subclass of WKApplicationStateTrackingView.
1054
1055         * WebKit.xcodeproj/project.pbxproj:
1056
1057 2018-04-08  Dan Bernstein  <mitz@apple.com>
1058
1059         [Cocoa] Keep library validation disabled for WebContent.Development
1060         https://bugs.webkit.org/show_bug.cgi?id=184393
1061
1062         Reviewed by Anders Carlsson.
1063
1064         * Configurations/WebContent.Development.entitlements: Added. Includes the
1065           com.apple.security.cs.disable-library-validation entitlement set to true.
1066         * Configurations/WebContentService.Development.xcconfig: Set CODE_SIGN_ENTITLEMENTS to the
1067           above.
1068         * WebKit.xcodeproj/project.pbxproj: Added reference to new file.
1069
1070 2018-04-06  Brian Burg  <bburg@apple.com>
1071
1072         REGRESSION(r228371): WebAutomationSession::deleteAllCookies doesn't delete some cookies
1073         https://bugs.webkit.org/show_bug.cgi?id=184334
1074         <rdar://problem/39212863>
1075
1076         Reviewed by Timothy Hatcher.
1077
1078         When WebDriver adds a cookie for 'localhost', it actually uses the domain '.localhost' per RFC.
1079         When deleting cookies, we first fetch all cookies matching the document's hostname, and
1080         then delete them one by one. However, this code path does not add the dot prefix. This causes
1081         no cookies to match the requested domain, and thus none of them are deleted.
1082
1083         * UIProcess/Automation/WebAutomationSession.cpp:
1084         (WebKit::domainByAddingDotPrefixIfNeeded): Extract this helper method.
1085         (WebKit::WebAutomationSession::addSingleCookie): Use helper method.
1086         (WebKit::WebAutomationSession::deleteAllCookies): Add a dot prefix when
1087         requesting to delete all cookies for a hostname.
1088
1089 2018-04-06  Youenn Fablet  <youenn@apple.com>
1090
1091         Response headers should be filtered when sent from NetworkProcess to WebProcess
1092         https://bugs.webkit.org/show_bug.cgi?id=184310
1093
1094         Reviewed by Ryosuke Niwa.
1095
1096         Pass destination parameter to NetworkResourceLoader.
1097         Use new sanitization routine to filter response headers as needed:
1098         - Cross-origin routines are filtered by removing any non CORS allowed headers.
1099         - Same-origin responses are filtered by removing non used headers, except when filtering would be visible by JS (XHR, fetch).
1100         In all cases, Set-Cookie/Set-Cookie2 headers are filtered out.
1101
1102         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1103         (WebKit::NetworkResourceLoadParameters::encode const):
1104         (WebKit::NetworkResourceLoadParameters::decode):
1105         * NetworkProcess/NetworkResourceLoadParameters.h:
1106         * NetworkProcess/NetworkResourceLoader.cpp:
1107         (WebKit::NetworkResourceLoader::didReceiveResponse):
1108         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1109         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
1110         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1111         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1112         * NetworkProcess/NetworkResourceLoader.h:
1113         * WebProcess/Network/WebLoaderStrategy.cpp:
1114         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1115         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1116         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
1117
1118 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
1119
1120         Make all sync IPCs during ScriptDisallowedScope set DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1121         https://bugs.webkit.org/show_bug.cgi?id=182449
1122         <rdar://problem/39222541>
1123
1124         Reviewed by Chris Dumez.
1125
1126         Release assert that a sync IPC inside ScriptDisallowedScope sets DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1127         to avoid executing arbitrary scripts as a result of processing incoming sync IPCs.
1128
1129         * Platform/IPC/Connection.h:
1130         (IPC::Connection::sendSync): Added the release assertion.
1131
1132 2018-04-05  Youenn Fablet  <youenn@apple.com>
1133
1134         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
1135         https://bugs.webkit.org/show_bug.cgi?id=184306
1136
1137         Reviewed by Ryosuke Niwa.
1138
1139         * NetworkProcess/NetworkContentRuleListManager.cpp:
1140         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1141
1142 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
1143
1144         WebContent process is calling CGDisplayUsesInvertedPolarity
1145         https://bugs.webkit.org/show_bug.cgi?id=184337
1146         <rdar://problem/39215702>
1147
1148         Reviewed by Zalan Bujtas.
1149
1150         The PlatformScreenMac code is still calling display-related routines directly, specifically
1151         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
1152         the UIProcess.
1153         
1154         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
1155         the compile guards so all macOS builds use this behavior.
1156         
1157         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
1158         routines in the future.
1159
1160         * UIProcess/WebProcessPool.cpp:
1161         (WebKit::WebProcessPool::initializeNewWebProcess): Activate screen brokering code for all builds.
1162         * WebProcess/WebProcess.cpp: Ditto.
1163         * WebProcess/WebProcess.h: Ditto.
1164         * WebProcess/WebProcess.messages.in: Ditto.
1165
1166 2018-04-05  Brady Eidson  <beidson@apple.com>
1167
1168         Process Swap on Navigation causes many webpages to hang due to attempted process swap for iframe navigations.
1169         <rdar://problem/39162236> and https://bugs.webkit.org/show_bug.cgi?id=184318
1170
1171         Reviewed by Andy Estes.
1172
1173         * UIProcess/WebPageProxy.cpp:
1174         (WebKit::WebPageProxy::receivedPolicyDecision): Don't consider a swap if the navigation is not in the main frame.
1175
1176 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
1177
1178         WebContent process sometimes hangs in WebProcess::ensureNetworkProcessConnection
1179         https://bugs.webkit.org/show_bug.cgi?id=184326
1180
1181         Reviewed by Chris Dumez.
1182
1183         The hang was caused by UI process never sending the reply back to GetNetworkProcessConnection
1184         due to m_pendingOutgoingMachMessage being set and the event handler for DISPATCH_MACH_SEND_POSSIBLE
1185         never getting called. This is because the event handler registration happens asynchronously,
1186         and may not have completed by the time we send the first IPC to the web content process
1187         in which case it can timeout and we may never get the callback.
1188
1189         Fixed the hang by waiting for the event handler registration to be completed using
1190         dispatch_source_set_registration_handler. To do this, this patch adds a new boolean instance variable,
1191         m_isInitializingSendSource, to Connection which is set to true between the time mach port is created
1192         and until the event handler registration has been completed. platformCanSendOutgoingMessages returns
1193         false while m_isInitializingSendSource is set to prevent the attempt to send messages like we do when
1194         m_pendingOutgoingMachMessage is set to true.
1195
1196         * Platform/IPC/Connection.h:
1197         (IPC::Connection::m_isInitializingSendSource): Added.
1198         * Platform/IPC/mac/ConnectionMac.mm:
1199         (IPC::Connection::platformInvalidate): Set m_isInitializingSendSource to false.
1200         (IPC::Connection::sendMessage): Assert that m_isInitializingSendSource is false.
1201         (IPC::Connection::platformCanSendOutgoingMessages const): Return false if m_isInitializingSendSource
1202         is set to true.
1203         (IPC::Connection::sendOutgoingMessage): Assert that m_isInitializingSendSource is false.
1204         (IPC::Connection::initializeSendSource): Set m_isInitializingSendSource to true temporarily until
1205         dispatch_source_set_registration_handler's callback is called. Resume and send any pending outgoing
1206         messages.
1207         (IPC::Connection::resumeSendSource): Extracted from initializeSendSource.
1208
1209 2018-04-05  Youenn Fablet  <youenn@apple.com>
1210
1211         WebRTC data channel only applications require capture permissions for direct connections
1212         https://bugs.webkit.org/show_bug.cgi?id=174500
1213         <rdar://problem/34134281>
1214
1215         Unreviewed.
1216         Changed the code to suppress: "error: unused variable 'error' [-Werror,-Wunused-variable]"
1217         Added some logging to this error case as a side bonus.
1218
1219         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
1220         (WebKit::NetworkMDNSRegister::registerMDNSName):
1221
1222 2018-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1223
1224         REGRESSION(r229831): Test WebKit2.ProvisionalURLAfterWillSendRequestCallback times out since r229831
1225         https://bugs.webkit.org/show_bug.cgi?id=184293
1226
1227         Reviewed by Alex Christensen.
1228
1229         The problem is that after willSendRequest callback changes the request, the load is cancelled while
1230         transitioning to committed state. This happens because the load is not waiting for the response policy check, so
1231         it continues and when transitioning to committed, FrameLoader::closeURL() invalidates the current policy check
1232         that causes a load failure. The new request returned by the API doesn't have any requester, so it's no longer
1233         considered a main resource load. In the network process the resource load task doesn't wait for the response
1234         policy and continues the load, sending the data to the web process. Once the first data is received, the load
1235         transitions to commit, but the response policy check is still ongoing. This can only happen when using the C API
1236         (I don't know about the Cocoa API), but not with the GLib API because it doesn't allow to create a new request,
1237         only to modify the passed in one. With the C API we loss other internal things of the request like the priority,
1238         but I guess the most important one is the requester.
1239
1240         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1241         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
1242
1243 2018-04-04  Ryan Haddad  <ryanhaddad@apple.com>
1244
1245         Unreviewed, rolling out r230283.
1246
1247         Caused webkitpy test failures.
1248
1249         Reverted changeset:
1250
1251         "Use CompletionHandlers for DelayedReplies"
1252         https://bugs.webkit.org/show_bug.cgi?id=182269
1253         https://trac.webkit.org/changeset/230283
1254
1255 2018-04-04  Youenn Fablet  <youenn@apple.com>
1256
1257         webrtc/video-update-often.html is flakily crashing on iOS simulator Debug
1258         https://bugs.webkit.org/show_bug.cgi?id=184022
1259
1260         Reviewed by Jer Noble.
1261
1262         Remove client context once the new context identifier is set.
1263         Covered by test no longer crashing locally.
1264
1265         * WebProcess/cocoa/PlaybackSessionManager.mm:
1266         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
1267
1268 2018-04-04  Youenn Fablet  <youenn@apple.com>
1269
1270         WebRTC data channel only applications require capture permissions for direct connections
1271         https://bugs.webkit.org/show_bug.cgi?id=174500
1272         <rdar://problem/34134281>
1273
1274         Reviewed by Eric Carlson.
1275
1276         Add support for MDNS registration and resolution by NetworkProcess.
1277         WebProcess gives instruction to do the actual registrations/resolutions.
1278
1279         * CMakeLists.txt:
1280         * DerivedSources.make:
1281         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1282         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1283         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1284         * NetworkProcess/NetworkConnectionToWebProcess.h:
1285         (WebKit::NetworkConnectionToWebProcess::mdnsRegister):
1286         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Added.
1287         (WebKit::NetworkMDNSRegister::NetworkMDNSRegister):
1288         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
1289         (WebKit::NetworkMDNSRegister::unregisterMDNSNames):
1290         (WebKit::PendingRegistrationRequest::PendingRegistrationRequest):
1291         (WebKit::registerMDNSNameCallback):
1292         (WebKit::NetworkMDNSRegister::registerMDNSName):
1293         (WebKit::PendingResolutionRequest::PendingResolutionRequest):
1294         (WebKit::PendingResolutionRequest::~PendingResolutionRequest):
1295         (WebKit::PendingResolutionRequest::timeout):
1296         (WebKit::resolveMDNSNameCallback):
1297         (WebKit::NetworkMDNSRegister::resolveMDNSName):
1298         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Added.
1299         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: Added.
1300         * Shared/WebPreferences.yaml:
1301         * UIProcess/API/C/WKPreferences.cpp:
1302         (WKPreferencesSetWebRTCMDNSICECandidatesEnabled):
1303         (WKPreferencesGetWebRTCMDNSICECandidatesEnabled):
1304         * UIProcess/API/C/WKPreferencesRef.h:
1305         * WebKit.xcodeproj/project.pbxproj:
1306         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1307         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1308         * WebProcess/Network/NetworkProcessConnection.cpp:
1309         (WebKit::NetworkProcessConnection::didReceiveMessage):
1310         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
1311         (WebKit::LibWebRTCNetwork::mdnsRegister):
1312         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
1313         (WebKit::LibWebRTCProvider::unregisterMDNSNames):
1314         (WebKit::LibWebRTCProvider::registerMDNSName):
1315         (WebKit::LibWebRTCProvider::resolveMDNSName):
1316         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1317         * WebProcess/Network/webrtc/WebMDNSRegister.cpp: Added.
1318         (WebKit::WebMDNSRegister::finishedRegisteringMDNSName):
1319         (WebKit::WebMDNSRegister::finishedResolvingMDNSName):
1320         (WebKit::WebMDNSRegister::unregisterMDNSNames):
1321         (WebKit::WebMDNSRegister::registerMDNSName):
1322         (WebKit::WebMDNSRegister::resolveMDNSName):
1323         * WebProcess/Network/webrtc/WebMDNSRegister.h: Added.
1324         * WebProcess/Network/webrtc/WebMDNSRegister.messages.in: Added.
1325
1326 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1327
1328         Use CompletionHandlers for DelayedReplies
1329         https://bugs.webkit.org/show_bug.cgi?id=182269
1330
1331         Reviewed by Youenn Fablet.
1332
1333         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
1334         called once and only once.  This is what CompletionHandlers are for.
1335
1336         No change in behavior.  Just cleaner code.
1337
1338         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1339         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1340         * NetworkProcess/NetworkConnectionToWebProcess.h:
1341         * NetworkProcess/NetworkResourceLoader.cpp:
1342         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
1343         (WebKit::sendReplyToSynchronousRequest):
1344         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1345         * NetworkProcess/NetworkResourceLoader.h:
1346         * Platform/IPC/Connection.h:
1347         * Platform/IPC/HandleMessage.h:
1348         (IPC::callMemberFunctionImpl):
1349         (IPC::callMemberFunction):
1350         (IPC::handleMessageDelayed):
1351         * PluginProcess/PluginControllerProxy.cpp:
1352         (WebKit::PluginControllerProxy::setInitializationReply):
1353         (WebKit::PluginControllerProxy::takeInitializationReply):
1354         * PluginProcess/PluginControllerProxy.h:
1355         * PluginProcess/WebProcessConnection.cpp:
1356         (WebKit::WebProcessConnection::destroyPlugin):
1357         (WebKit::WebProcessConnection::createPlugin):
1358         (WebKit::WebProcessConnection::createPluginAsynchronously):
1359         * PluginProcess/WebProcessConnection.h:
1360         * Scripts/webkit/messages.py:
1361         (message_to_struct_declaration):
1362         (generate_message_handler):
1363         * UIProcess/Network/NetworkProcessProxy.cpp:
1364         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1365         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1366         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
1367         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
1368         * UIProcess/Network/NetworkProcessProxy.h:
1369         * UIProcess/Plugins/PluginProcessManager.cpp:
1370         (WebKit::PluginProcessManager::getPluginProcessConnection):
1371         * UIProcess/Plugins/PluginProcessManager.h:
1372         * UIProcess/Plugins/PluginProcessProxy.cpp:
1373         (WebKit::PluginProcessProxy::getPluginProcessConnection):
1374         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
1375         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
1376         * UIProcess/Plugins/PluginProcessProxy.h:
1377         * UIProcess/Storage/StorageProcessProxy.cpp:
1378         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1379         (WebKit::StorageProcessProxy::didClose):
1380         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
1381         * UIProcess/Storage/StorageProcessProxy.h:
1382         * UIProcess/WebPageProxy.cpp:
1383         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
1384         (WebKit::WebPageProxy::createNewPage):
1385         (WebKit::WebPageProxy::runJavaScriptAlert):
1386         (WebKit::WebPageProxy::runJavaScriptConfirm):
1387         (WebKit::WebPageProxy::runJavaScriptPrompt):
1388         (WebKit::WebPageProxy::webGLPolicyForURL):
1389         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1390         (WebKit::WebPageProxy::getToolbarsAreVisible):
1391         (WebKit::WebPageProxy::getMenuBarIsVisible):
1392         (WebKit::WebPageProxy::getStatusBarIsVisible):
1393         (WebKit::WebPageProxy::getWindowFrame):
1394         (WebKit::WebPageProxy::screenToRootView):
1395         (WebKit::WebPageProxy::rootViewToScreen):
1396         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1397         (WebKit::WebPageProxy::exceededDatabaseQuota):
1398         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
1399         * UIProcess/WebPageProxy.h:
1400         * UIProcess/WebProcessPool.cpp:
1401         (WebKit::WebProcessPool::networkProcessCrashed):
1402         (WebKit::WebProcessPool::getNetworkProcessConnection):
1403         (WebKit::WebProcessPool::getStorageProcessConnection):
1404         * UIProcess/WebProcessPool.h:
1405         * UIProcess/WebProcessProxy.cpp:
1406         (WebKit::WebProcessProxy::getPluginProcessConnection):
1407         (WebKit::WebProcessProxy::getNetworkProcessConnection):
1408         (WebKit::WebProcessProxy::getStorageProcessConnection):
1409         * UIProcess/WebProcessProxy.h:
1410         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1411         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
1412         * WebProcess/Storage/WebSWContextManagerConnection.h:
1413         * WebProcess/WebPage/WebPage.h:
1414         * WebProcess/WebPage/ios/WebPageIOS.mm:
1415         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1416
1417 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1418
1419         Remove legacyCustomProtocolManager from NetworkSessionCreationParameters
1420         https://bugs.webkit.org/show_bug.cgi?id=182178
1421
1422         Reviewed by Youenn Fablet.
1423
1424         Now that we only make NetworkSessions in the NetworkProcess, we don't need to pass this parameter around.
1425
1426         * NetworkProcess/NetworkProcess.cpp:
1427         (WebKit::NetworkProcess::initializeNetworkProcess):
1428         * NetworkProcess/NetworkSessionCreationParameters.h:
1429         (WebKit::NetworkSessionCreationParameters::decode):
1430         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1431         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1432         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1433         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1434         * Shared/WebsiteDataStoreParameters.cpp:
1435         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1436         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1437         (WebKit::WebsiteDataStore::parameters):
1438
1439 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1440
1441         Move PingHandle to WebKitLegacy
1442         https://bugs.webkit.org/show_bug.cgi?id=184145
1443
1444         Reviewed by Youenn Fablet.
1445
1446         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1447
1448 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
1449
1450         Failures from mach port reference handling should be fatal
1451         https://bugs.webkit.org/show_bug.cgi?id=184202
1452         <rdar://problem/37771114>
1453
1454         Reviewed by Anders Carlsson.
1455
1456         Update for new location of MachSendRight.h. Switch to
1457         #pragma once in a few places.
1458
1459         * Platform/IPC/mac/ConnectionMac.mm:
1460         (IPC::Connection::platformInvalidate): Adopt new 'safe mach_port_t deallocation' function.
1461         (IPC::Connection::initializeSendSource): Ditto.
1462         (IPC::Connection::receiveSourceEventHandler): Ditto.
1463         * Platform/SharedMemory.h:
1464         * Platform/cocoa/SharedMemoryCocoa.cpp:
1465         (WebKit::SharedMemory::Handle::clear): Ditto.
1466         (WebKit::makeMemoryEntry): Ditto.
1467         (WebKit::SharedMemory::createSendRight const): Ditto.
1468         * Platform/mac/LayerHostingContext.h:
1469         * Platform/mac/LayerHostingContext.mm:
1470         * PluginProcess/PluginControllerProxy.h:
1471         * PluginProcess/PluginProcess.h:
1472         (WebKit::PluginProcess::compositingRenderServerPort const):
1473         * Scripts/messages.py:
1474         (headers_for_type): Update for new location of MachSendRight.
1475         * Shared/Plugins/PluginProcessCreationParameters.h:
1476         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
1477         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1478         (WebKit::RemoteLayerBackingStore::encode const):
1479         * Shared/WebCoreArgumentCoders.h:
1480         * Shared/WebProcessCreationParameters.h:
1481         * Shared/mac/WebCoreArgumentCodersMac.mm:
1482         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1483         * UIProcess/DrawingAreaProxy.cpp:
1484         * UIProcess/DrawingAreaProxy.h:
1485         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1486         (WebKit::ProcessLauncher::launchProcess): Ditto. Remove uneeded mach_port_dealloc called after
1487         xpc_dictionary_set_mach_send. While '..._set_mach_send' retains the send right, it gets automatically
1488         released when the message is handled. We only want to manually deallocate the send right if
1489         the message failed to send.
1490         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1491         * UIProcess/WebPageProxy.cpp:
1492         * UIProcess/WebPageProxy.h:
1493         * UIProcess/WebPageProxy.messages.in:
1494         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1495         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1496         * UIProcess/mac/WKViewLayoutStrategy.mm:
1497         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1498         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1499         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1500         * WebProcess/Plugins/PluginController.h:
1501         * WebProcess/Plugins/PluginView.h:
1502         * WebProcess/WebPage/DrawingArea.h:
1503         (WebKit::DrawingArea::addFence):
1504         (WebKit::DrawingArea::updateGeometry):
1505         * WebProcess/WebPage/DrawingArea.messages.in:
1506         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1507         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1508         (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
1509         * WebProcess/WebPage/WebPage.cpp:
1510         (WebKit::WebPage::setTopContentInsetFenced):
1511         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1512         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1513         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1514         * WebProcess/WebProcess.h:
1515         (WebKit::WebProcess::compositingRenderServerPort const):
1516         * WebProcess/cocoa/VideoFullscreenManager.mm:
1517         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
1518
1519 2018-04-04  Beth Dakin  <bdakin@apple.com>
1520
1521         Fix the print formatter build
1522         https://bugs.webkit.org/show_bug.cgi?id=184289
1523         -and corresponding-
1524         rdar://problem/39164641
1525
1526         Reviewed by Dan Bernstein.
1527
1528         * UIProcess/API/Cocoa/WKWebView.mm:
1529         (-[WKWebView _webViewPrintFormatter]):
1530         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1531         * UIProcess/_WKWebViewPrintFormatter.h:
1532         * UIProcess/_WKWebViewPrintFormatter.mm:
1533         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1534         * UIProcess/ios/WKContentView.mm:
1535         * UIProcess/ios/WKPDFView.mm:
1536
1537 2018-04-04  Andy Estes  <aestes@apple.com>
1538
1539         [iOS] Rename WKPDFView to WKLegacyPDFView
1540         https://bugs.webkit.org/show_bug.cgi?id=184286
1541
1542         Rubber-stamped by Wenson Hsieh.
1543
1544         A series of upcoming patches will implement a new WKPDFView based on PDFKit.
1545
1546         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1547         (-[WKWebViewContentProviderRegistry init]):
1548         * UIProcess/ios/WKLegacyPDFView.h: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.h.
1549         * UIProcess/ios/WKLegacyPDFView.mm: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.mm.
1550         (-[WKLegacyPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
1551         * WebKit.xcodeproj/project.pbxproj:
1552
1553 2018-04-04  Yousuke Kimoto  <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
1554
1555         [WinCairo] Add WebKit Shared/win files for wincairo webkit
1556         https://bugs.webkit.org/show_bug.cgi?id=183044
1557
1558         Reviewed by Alex Christensen.
1559
1560         * Shared/win/ChildProcessMainWin.cpp: Added.
1561
1562 2018-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1563
1564         [Extra zoom mode] Remove effective font size constraints when determining focus zoom scale
1565         https://bugs.webkit.org/show_bug.cgi?id=184287
1566         <rdar://problem/39063886>
1567
1568         Reviewed by Timothy Hatcher.
1569
1570         As it turns out, form controls on some important websites can be very wide, with a small font size, which
1571         renders the approach taken in <https://trac.webkit.org/r230171> moot, since we'll just end up zooming to a scale
1572         that is too large anyways. To mitigate this for now, remove the minimum font scaling threshold while we think of
1573         more clever ways to account for this scenario.
1574
1575         * UIProcess/API/Cocoa/WKWebView.mm:
1576         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1577
1578 2018-04-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1579
1580         [Win] WebFrameLoaderClient: 'getpid': identifier not found
1581         https://bugs.webkit.org/show_bug.cgi?id=184291
1582
1583         Reviewed by Konstantin Tokarev.
1584
1585         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1586         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1587         Use WTF::getCurrentProcessID() instead of getpid().
1588         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
1589
1590 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1591
1592         ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
1593         https://bugs.webkit.org/show_bug.cgi?id=153210
1594
1595         Reviewed by Alex Christensen.
1596
1597         The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
1598         FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
1599         FrameLoader::reload() returns before creating the document loader.
1600
1601         * WebProcess/WebPage/WebPage.cpp:
1602         (WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
1603         and reset it otherwise.
1604
1605 2018-04-03  Youenn Fablet  <youenn@apple.com>
1606
1607         Make NetworkProcess get ContentBlocker information from UIProcess
1608         https://bugs.webkit.org/show_bug.cgi?id=184205
1609         <rdar://problem/39146551>
1610
1611         Unreviewed.
1612         Updated decode/encode methods to not hit null identifier assertion.
1613
1614         * Shared/WebPageCreationParameters.cpp:
1615         (WebKit::WebPageCreationParameters::encode const):
1616         (WebKit::WebPageCreationParameters::decode):
1617         * Shared/WebPageGroupData.cpp:
1618         (WebKit::WebPageGroupData::encode const):
1619         (WebKit::WebPageGroupData::decode):
1620
1621 2018-04-03  Andy Estes  <aestes@apple.com>
1622
1623         [iOS] WKWebView shouldn't know about WKPDFView
1624         https://bugs.webkit.org/show_bug.cgi?id=184283
1625
1626         Reviewed by Timothy Hatcher.
1627
1628         WKWebView shouldn't be checking if _customContentView is a particular kind of
1629         class (e.g., WKPDFView). Instead, it should interact with the _customContentView
1630         using the WKWebViewContentProvider protocol.
1631
1632         Reimplement -_isBackground, -_isDisplayingPDF, -_dataForDisplayedPDF, and
1633         -_suggestedFilenameForDisplayedPDF using new WKWebViewContentProvider protocol
1634         methods that WKPDFView implements.
1635
1636         * UIProcess/API/Cocoa/WKWebView.mm:
1637         (-[WKWebView _isBackground]):
1638         (-[WKWebView _isDisplayingPDF]):
1639         (-[WKWebView _dataForDisplayedPDF]):
1640         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
1641         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1642         * UIProcess/ios/WKPDFView.h:
1643         * UIProcess/ios/WKPDFView.mm:
1644         (-[WKPDFView web_dataRepresentation]):
1645         (-[WKPDFView web_suggestedFilename]):
1646         (-[WKPDFView web_isBackground]):
1647         (-[WKPDFView suggestedFilename]): Deleted.
1648         (-[WKPDFView pdfDocument]): Deleted.
1649         (-[WKPDFView isBackground]): Deleted.
1650
1651 2018-04-03  Brent Fulgham  <bfulgham@apple.com>
1652
1653         Guard against keychain/certificate access outside the network process
1654         https://bugs.webkit.org/show_bug.cgi?id=184214
1655         <rdar://problem/38734795>
1656
1657         Reviewed by Youenn Fablet.
1658
1659         Use the ProcessPrivilege assertions to guard against accessing the Keychain from
1660         a non-Networking process.
1661
1662         * Shared/cf/ArgumentCodersCF.cpp:
1663         (IPC::encode): Assert if we access the keychain from a proces other than the Network or UI process.
1664         (IPC::decode): Ditto.
1665
1666 2018-04-03  Youenn Fablet  <youenn@apple.com>
1667
1668         NetworkResourceLoader does not need to expose all redirect response headers
1669         https://bugs.webkit.org/show_bug.cgi?id=184114
1670         <rdar://problem/39010557>
1671
1672         Reviewed by Ryosuke Niwa.
1673
1674         WebProcess instructs NetworkProcess whether to sanitize response headers based on a runtime flag.
1675         We sanitize redirection response headers in case this is not related to a navigation load.
1676         Navigation loads may currently require the full response for content blockers.
1677
1678         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1679         (WebKit::NetworkResourceLoadParameters::encode const):
1680         (WebKit::NetworkResourceLoadParameters::decode):
1681         * NetworkProcess/NetworkResourceLoadParameters.h:
1682         * NetworkProcess/NetworkResourceLoader.cpp:
1683         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1684         (WebKit::NetworkResourceLoader::sanitizeRedirectResponseIfPossible):
1685         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1686         * NetworkProcess/NetworkResourceLoader.h:
1687         * Shared/WebPreferences.yaml:
1688         * UIProcess/API/C/WKPreferences.cpp:
1689         (WKPreferencesSetRestrictedHTTPResponseAccess):
1690         (WKPreferencesGetRestrictedHTTPResponseAccess):
1691         * UIProcess/API/C/WKPreferencesRef.h:
1692         * WebProcess/Network/WebLoaderStrategy.cpp:
1693         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1694         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1695         (WebKit::WebLoaderStrategy::startPingLoad):
1696         (WebKit::WebLoaderStrategy::preconnectTo):
1697
1698 2018-04-03  Youenn Fablet  <youenn@apple.com>
1699
1700         Make NetworkProcess get ContentBlocker information from UIProcess
1701         https://bugs.webkit.org/show_bug.cgi?id=184205
1702
1703         Reviewed by Alex Christensen.
1704
1705         Make NetworkProcess get content blockers from UIProcess directly.
1706         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
1707         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
1708
1709         This is both more efficient than passing them for each PingLoad and safer in the sense
1710         that a compromised WebProcess will not be able to bypass any of these.
1711         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
1712
1713         Covered by existing beacon+content blocker tests.
1714
1715         Did some refactoring to add a typed content blocker identifier.
1716         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
1717         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
1718
1719         * CMakeLists.txt:
1720         * DerivedSources.make:
1721         * NetworkProcess/NetworkLoadChecker.cpp:
1722         (WebKit::NetworkLoadChecker::checkRequest):
1723         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1724         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
1725         * NetworkProcess/NetworkLoadChecker.h:
1726         (WebKit::NetworkLoadChecker::setContentExtensionController):
1727         * NetworkProcess/NetworkProcess.cpp:
1728         (WebKit::NetworkProcess::didReceiveMessage):
1729         * NetworkProcess/NetworkProcess.h:
1730         (WebKit::NetworkProcess::networkUserContentController):
1731         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1732         (WebKit::NetworkResourceLoadParameters::encode const):
1733         (WebKit::NetworkResourceLoadParameters::decode):
1734         * NetworkProcess/NetworkResourceLoadParameters.h:
1735         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
1736         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
1737         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1738         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
1739         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
1740         (WebKit::NetworkContentRuleListManager::remove):
1741         * NetworkProcess/NetworkContentRuleListManager.h: Added.
1742         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
1743         * NetworkProcess/PingLoad.cpp:
1744         * Scripts/webkit/messages.py:
1745         * Shared/UserContentControllerIdentifier.h: Added.
1746         * Shared/WebPageCreationParameters.cpp:
1747         (WebKit::WebPageCreationParameters::decode):
1748         * Shared/WebPageCreationParameters.h:
1749         * Shared/WebPageGroupData.cpp:
1750         (WebKit::WebPageGroupData::decode):
1751         * Shared/WebPageGroupData.h:
1752         * UIProcess/Network/NetworkProcessProxy.cpp:
1753         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1754         (WebKit::NetworkProcessProxy::contentExtensionRules):
1755         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
1756         * UIProcess/Network/NetworkProcessProxy.h:
1757         * UIProcess/Network/NetworkProcessProxy.messages.in:
1758         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1759         (WebKit::WebUserContentControllerProxy::get):
1760         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
1761         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
1762         (WebKit::WebUserContentControllerProxy::addProcess):
1763         (WebKit::WebUserContentControllerProxy::removeProcess):
1764         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1765         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1766         (WebKit::WebUserContentControllerProxy::addUserScript):
1767         (WebKit::WebUserContentControllerProxy::removeUserScript):
1768         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1769         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1770         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1771         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1772         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
1773         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
1774         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
1775         (WebKit::WebUserContentControllerProxy::addContentRuleList):
1776         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
1777         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
1778         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1779         (WebKit::WebUserContentControllerProxy::create):
1780         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
1781         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
1782         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
1783         (WebKit::WebUserContentControllerProxy::identifier const):
1784         * WebKit.xcodeproj/project.pbxproj:
1785         * WebProcess/Network/WebLoaderStrategy.cpp:
1786         (WebKit::WebLoaderStrategy::startPingLoad):
1787         * WebProcess/UserContent/WebUserContentController.cpp:
1788         (WebKit::WebUserContentController::getOrCreate):
1789         (WebKit::WebUserContentController::WebUserContentController):
1790         (WebKit::WebUserContentController::~WebUserContentController):
1791         * WebProcess/UserContent/WebUserContentController.h:
1792         * WebProcess/WebPage/WebPage.h:
1793         (WebKit::WebPage::userContentControllerIdentifier const):
1794
1795 2018-04-03  Andy Estes  <aestes@apple.com>
1796
1797         [Mac] Prioritize file promises over filenames during drag and drop
1798         https://bugs.webkit.org/show_bug.cgi?id=184237
1799         <rdar://problem/38278076>
1800
1801         Reviewed by Wenson Hsieh.
1802
1803         * UIProcess/Cocoa/WebViewImpl.mm:
1804         (WebKit::WebViewImpl::performDragOperation):
1805
1806 2018-04-03  Brady Eidson  <beidson@apple.com>
1807
1808         Make SessionStorage work with process swapping.
1809         https://bugs.webkit.org/show_bug.cgi?id=184270
1810
1811         Reviewed by Andy Estes.
1812
1813         Due to a minor process accounting error, WebPageProxys weren't always being reconnected with their
1814         WebsiteDataStore's StorageManager when doing process swaps.
1815
1816         Fix that error, and SessionStorage "just works."
1817
1818         * UIProcess/WebPageProxy.cpp:
1819         (WebKit::WebPageProxy::webProcessWillShutDown):
1820         (WebKit::WebPageProxy::processDidTerminate): For NavigationSwap termination, make sure to tell the 
1821           process lifetime tracker that this page was removed.
1822
1823         * UIProcess/WebProcessLifetimeObserver.h:
1824         (WebKit::WebProcessLifetimeObserver::webPageWasInvalidated): Renamed from "webPageWasRemoved"
1825         (WebKit::WebProcessLifetimeObserver::webPageWasRemoved): Deleted.
1826
1827         * UIProcess/WebProcessLifetimeTracker.cpp:
1828         (WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess): Renamed from "webProcessWillShutDown"
1829         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
1830         (WebKit::WebProcessLifetimeTracker::webProcessWillShutDown): Deleted.
1831         * UIProcess/WebProcessLifetimeTracker.h:
1832
1833         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1834         (WebKit::WebsiteDataStore::webPageWasInvalidated):
1835         (WebKit::WebsiteDataStore::webPageWasRemoved): Deleted.
1836         * UIProcess/WebsiteData/WebsiteDataStore.h:
1837
1838 2018-04-03  Commit Queue  <commit-queue@webkit.org>
1839
1840         Unreviewed, rolling out r230210.
1841         https://bugs.webkit.org/show_bug.cgi?id=184277
1842
1843         it is breaking internal bots (Requested by youenn on #webkit).
1844
1845         Reverted changeset:
1846
1847         "Make NetworkProcess get ContentBlocker information from
1848         UIProcess"
1849         https://bugs.webkit.org/show_bug.cgi?id=184205
1850         https://trac.webkit.org/changeset/230210
1851
1852 2018-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1853
1854         [Extra zoom mode] Update time picker to use platform view controller
1855         https://bugs.webkit.org/show_bug.cgi?id=184252
1856         <rdar://problem/38804795>
1857
1858         Reviewed by Andy Estes.
1859
1860         Adjust for some small WKTimePickerViewController changes, and remove some files that we no longer need.
1861
1862         * UIProcess/ios/WKContentViewInteraction.mm:
1863         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1864         (-[WKContentView textInputController:didCommitText:]): Deleted.
1865         (-[WKContentView textInputController:didCommitText:withSuggestion:]): Deleted.
1866         (-[WKContentView textInputControllerDidRequestDismissal:]): Deleted.
1867         * UIProcess/ios/forms/WKTextFormControlViewController.h: Removed.
1868         * UIProcess/ios/forms/WKTextFormControlViewController.mm: Removed.
1869         * UIProcess/ios/forms/WKTextSuggestionButton.h: Removed.
1870         * UIProcess/ios/forms/WKTextSuggestionButton.mm: Removed.
1871         * WebKit.xcodeproj/project.pbxproj:
1872
1873 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
1874
1875         Xcode prepends line comments from WTF/Compiler.h to *.sb files
1876         https://bugs.webkit.org/show_bug.cgi?id=184166
1877
1878         Reviewed by Brent Fulgham.
1879
1880         * DerivedSources.make:
1881         Strip ;-comments from *.sb.in files before preprocessing so we can stop treating Platform.h/Compiler.h as C89.
1882
1883 2018-04-03  Chris Dumez  <cdumez@apple.com>
1884
1885         Drop MainFrame class
1886         https://bugs.webkit.org/show_bug.cgi?id=184191
1887
1888         Reviewed by Darin Adler.
1889
1890         Drop MainFrame class and move contents into Page / Frame since there is a 1:1
1891         relationship between the Page and the MainFrame.
1892
1893         This is ground work for introducing LocalFrame / RemoteFrame concepts.
1894
1895         * Shared/WebRenderLayer.cpp:
1896         * Shared/WebRenderObject.cpp:
1897         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1898         (WebKit::WebPaymentCoordinator::paymentCoordinator):
1899         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1900         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1901         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1902         (WKBundlePageInstallPageOverlay):
1903         (WKBundlePageUninstallPageOverlay):
1904         (WKBundlePageInstallPageOverlayWithAnimation):
1905         (WKBundlePageUninstallPageOverlayWithAnimation):
1906         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1907         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1908         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1909         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1910         * WebProcess/Plugins/PluginView.cpp:
1911         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1912         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1913         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
1914         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1915         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1916         (WebKit::WebInspectorClient::~WebInspectorClient):
1917         (WebKit::WebInspectorClient::highlight):
1918         (WebKit::WebInspectorClient::hideHighlight):
1919         (WebKit::WebInspectorClient::showPaintRect):
1920         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1921         * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
1922         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
1923         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1924         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1925         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1926         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1927         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1928         * WebProcess/WebPage/FindController.cpp:
1929         (WebKit::FindController::updateFindUIAfterPageScroll):
1930         (WebKit::FindController::hideFindUI):
1931         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1932         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1933         (WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
1934         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
1935         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1936         * WebProcess/WebPage/WebFrame.cpp:
1937         * WebProcess/WebPage/WebInspector.cpp:
1938         * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
1939         * WebProcess/WebPage/WebPage.cpp:
1940         (WebKit::WebPage::mainFrame const):
1941         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
1942         (WebKit::WebPage::plugInIntersectsSearchRect):
1943         * WebProcess/WebPage/WebPage.h:
1944         * WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp:
1945         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1946         * WebProcess/WebPage/ios/WebPageIOS.mm:
1947         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1948         (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
1949         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1950         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1951         (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
1952         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
1953         * WebProcess/WebPage/mac/WebPageMac.mm:
1954         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
1955         (WebKit::WebPage::dataDetectorsDidPresentUI):
1956         (WebKit::WebPage::dataDetectorsDidChangeUI):
1957         (WebKit::WebPage::dataDetectorsDidHideUI):
1958         * WebProcess/WebProcess.cpp:
1959         * WebProcess/WebStorage/StorageAreaMap.cpp:
1960
1961 2018-04-03  Youenn Fablet  <youenn@apple.com>
1962
1963         Make NetworkProcess get ContentBlocker information from UIProcess
1964         https://bugs.webkit.org/show_bug.cgi?id=184205
1965
1966         Reviewed by Alex Christensen.
1967
1968         Make NetworkProcess get content blockers from UIProcess directly.
1969         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
1970         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
1971
1972         This is both more efficient than passing them for each PingLoad and safer in the sense
1973         that a compromised WebProcess will not be able to bypass any of these.
1974         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
1975
1976         Covered by existing beacon+content blocker tests.
1977
1978         Did some refactoring to add a typed content blocker identifier.
1979         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
1980         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
1981
1982         * CMakeLists.txt:
1983         * DerivedSources.make:
1984         * NetworkProcess/NetworkLoadChecker.cpp:
1985         (WebKit::NetworkLoadChecker::checkRequest):
1986         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1987         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
1988         * NetworkProcess/NetworkLoadChecker.h:
1989         (WebKit::NetworkLoadChecker::setContentExtensionController):
1990         * NetworkProcess/NetworkProcess.cpp:
1991         (WebKit::NetworkProcess::didReceiveMessage):
1992         * NetworkProcess/NetworkProcess.h:
1993         (WebKit::NetworkProcess::networkUserContentController):
1994         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1995         (WebKit::NetworkResourceLoadParameters::encode const):
1996         (WebKit::NetworkResourceLoadParameters::decode):
1997         * NetworkProcess/NetworkResourceLoadParameters.h:
1998         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
1999         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
2000         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
2001         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
2002         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
2003         (WebKit::NetworkContentRuleListManager::remove):
2004         * NetworkProcess/NetworkContentRuleListManager.h: Added.
2005         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
2006         * NetworkProcess/PingLoad.cpp:
2007         * Scripts/webkit/messages.py:
2008         * Shared/UserContentControllerIdentifier.h: Added.
2009         * Shared/WebPageCreationParameters.cpp:
2010         (WebKit::WebPageCreationParameters::decode):
2011         * Shared/WebPageCreationParameters.h:
2012         * Shared/WebPageGroupData.cpp:
2013         (WebKit::WebPageGroupData::decode):
2014         * Shared/WebPageGroupData.h:
2015         * UIProcess/Network/NetworkProcessProxy.cpp:
2016         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2017         (WebKit::NetworkProcessProxy::contentExtensionRules):
2018         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
2019         * UIProcess/Network/NetworkProcessProxy.h:
2020         * UIProcess/Network/NetworkProcessProxy.messages.in:
2021         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2022         (WebKit::WebUserContentControllerProxy::get):
2023         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
2024         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
2025         (WebKit::WebUserContentControllerProxy::addProcess):
2026         (WebKit::WebUserContentControllerProxy::removeProcess):
2027         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2028         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2029         (WebKit::WebUserContentControllerProxy::addUserScript):
2030         (WebKit::WebUserContentControllerProxy::removeUserScript):
2031         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2032         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2033         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2034         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2035         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2036         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2037         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2038         (WebKit::WebUserContentControllerProxy::addContentRuleList):
2039         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
2040         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
2041         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2042         (WebKit::WebUserContentControllerProxy::create):
2043         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
2044         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
2045         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
2046         (WebKit::WebUserContentControllerProxy::identifier const):
2047         * WebKit.xcodeproj/project.pbxproj:
2048         * WebProcess/Network/WebLoaderStrategy.cpp:
2049         (WebKit::WebLoaderStrategy::startPingLoad):
2050         * WebProcess/UserContent/WebUserContentController.cpp:
2051         (WebKit::WebUserContentController::getOrCreate):
2052         (WebKit::WebUserContentController::WebUserContentController):
2053         (WebKit::WebUserContentController::~WebUserContentController):
2054         * WebProcess/UserContent/WebUserContentController.h:
2055         * WebProcess/WebPage/WebPage.h:
2056         (WebKit::WebPage::userContentControllerIdentifier const):
2057
2058 2018-04-02  Beth Dakin  <bdakin@apple.com>
2059
2060         Fix the managed configurations build
2061         https://bugs.webkit.org/show_bug.cgi?id=184253
2062         -and corresponding-
2063         rdar://problem/39078586
2064
2065         Reviewed by Dan Bernstein.
2066
2067         * UIProcess/ios/WKContentViewInteraction.mm:
2068         (-[WKContentView canPerformActionForWebView:withSender:]):
2069         (-[WKContentView _defineForWebView:]):
2070
2071 2018-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
2072
2073         [Enchant] Clean up TextCheckerEnchant
2074         https://bugs.webkit.org/show_bug.cgi?id=184233
2075
2076         Reviewed by Michael Catanzaro.
2077
2078         Use TextCheckerEnchant as a singleton now, instead of implementing the singleton here.
2079
2080         * UIProcess/gtk/TextCheckerGtk.cpp:
2081         (WebKit::TextChecker::checkSpellingOfString):
2082         (WebKit::TextChecker::getGuessesForWord):
2083         (WebKit::TextChecker::learnWord):
2084         (WebKit::TextChecker::ignoreWord):
2085         (WebKit::TextChecker::setSpellCheckingLanguages):
2086         (WebKit::TextChecker::loadedSpellCheckingLanguages):
2087         (WebKit::enchantTextChecker): Deleted.
2088
2089 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2090
2091         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
2092         https://bugs.webkit.org/show_bug.cgi?id=183346
2093
2094         Reviewed by Michael Catanzaro.
2095
2096         Pass the request cancellable to NetworkStorageSession::getCredentialFromPersistentStorage().
2097
2098         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2099         (WebKit::NetworkDataTaskSoup::authenticate):
2100
2101 2018-04-02  Brady Eidson  <beidson@apple.com>
2102
2103         Process swapping on navigation needs to handle server redirects.
2104         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
2105
2106         Reviewed by Alex Christensen.
2107
2108         The same rules we apply to process swapping for basic navigations need to apply
2109         to server redirects as well.
2110
2111         There's three interesting cases we need to support that are covered by new API tests:
2112         1 - The initial load in a WKWebView redirects cross-origin.
2113         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
2114         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
2115
2116         Supporting all 3 of these brought their own little challenges.
2117
2118         By teaching Navigation objects more about redirects I was able to support all 3 cases.
2119
2120         * UIProcess/API/APINavigation.cpp:
2121         (API::Navigation::Navigation):
2122         (API::Navigation::setCurrentRequest):
2123         (API::Navigation::appendRedirectionURL):
2124         (API::Navigation::loggingString const):
2125         (API::Navigation::loggingURL const): Deleted.
2126         * UIProcess/API/APINavigation.h:
2127         (API::Navigation::originalRequest const):
2128         (API::Navigation::currentRequest const):
2129         (API::Navigation::currentRequestProcessIdentifier const):
2130         (API::Navigation::setCurrentRequestIsRedirect):
2131         (API::Navigation::currentRequestIsRedirect const):
2132         (API::Navigation::request const): Deleted.
2133
2134         * UIProcess/API/Cocoa/WKNavigation.mm:
2135         (-[WKNavigation _request]):
2136
2137         * UIProcess/WebPageProxy.cpp:
2138         (WebKit::WebPageProxy::receivedPolicyDecision):
2139         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
2140           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
2141         (WebKit::WebPageProxy::didCreateMainFrame):
2142         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
2143           cross-origin redirect that is just starting back up in a new WebProcess.
2144         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2145         (WebKit::WebPageProxy::didCommitLoadForFrame):
2146         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2147         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
2148           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
2149         * UIProcess/WebPageProxy.h:
2150         * UIProcess/WebPageProxy.messages.in:
2151
2152         * UIProcess/WebProcessPool.cpp:
2153         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
2154           be used to continue a navigation.
2155         * UIProcess/WebProcessPool.h:
2156
2157         * UIProcess/WebProcessProxy.h:
2158         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
2159         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
2160
2161         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2162         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
2163         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2164
2165 2018-04-02  Eric Carlson  <eric.carlson@apple.com>
2166
2167         [Extra zoom mode] Replace video with a placeholder image during fullscreen transition
2168         https://bugs.webkit.org/show_bug.cgi?id=184188
2169         <rdar://problem/38940307>
2170
2171         Reviewed by Youenn Fablet.
2172
2173         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2174         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
2175         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2176         (WebKit::VideoFullscreenModelContext::willExitFullscreen):
2177         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
2178         (WebKit::VideoFullscreenManagerProxy::willExitFullscreen):
2179         * WebProcess/cocoa/VideoFullscreenManager.h:
2180         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
2181         * WebProcess/cocoa/VideoFullscreenManager.mm:
2182         (WebKit::VideoFullscreenManager::willExitFullscreen):
2183
2184 2018-04-02  Brian Burg  <bburg@apple.com>
2185
2186         [Cocoa] Fix some internal builds that consume WebDriver atoms
2187         https://bugs.webkit.org/show_bug.cgi?id=184197
2188
2189         Reviewed by Dan Bernstein.
2190
2191         * WebKit.xcodeproj/project.pbxproj:
2192         Use a Run Script phase to copy WebDriver atoms to WebKit.framework
2193         private headers during the installhdrs phase.
2194
2195 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
2196
2197         Unreviewed, rolling out r230174.
2198
2199         Caused LayoutTests to exit early with assertion failures.
2200
2201         Reverted changeset:
2202
2203         "Process swapping on navigation needs to handle server
2204         redirects."
2205         https://bugs.webkit.org/show_bug.cgi?id=184142
2206         https://trac.webkit.org/changeset/230174
2207
2208 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2209
2210         [Extra zoom mode] Update date picker UI to latest specifications
2211         https://bugs.webkit.org/show_bug.cgi?id=184234
2212         <rdar://problem/38804760>
2213
2214         Reviewed by Timothy Hatcher.
2215
2216         Rename WKTextFormControlListViewControllerDelegate to WKTextInputListViewControllerDelegate and adjust for the
2217         new initializer of WKDatePickerViewController.
2218
2219         * UIProcess/ios/WKContentViewInteraction.mm:
2220         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2221
2222 2018-04-02  Brady Eidson  <beidson@apple.com>
2223
2224         Process swapping on navigation needs to handle server redirects.
2225         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
2226
2227         Reviewed by Alex Christensen.
2228
2229         The same rules we apply to process swapping for basic navigations need to apply
2230         to server redirects as well.
2231
2232         There's three interesting cases we need to support that are covered by new API tests:
2233         1 - The initial load in a WKWebView redirects cross-origin.
2234         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
2235         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
2236
2237         Supporting all 3 of these brought their own little challenges.
2238
2239         By teaching Navigation objects more about redirects I was able to support all 3 cases.
2240
2241         * UIProcess/API/APINavigation.cpp:
2242         (API::Navigation::Navigation):
2243         (API::Navigation::setCurrentRequest):
2244         (API::Navigation::appendRedirectionURL):
2245         (API::Navigation::loggingString const):
2246         (API::Navigation::loggingURL const): Deleted.
2247         * UIProcess/API/APINavigation.h:
2248         (API::Navigation::originalRequest const):
2249         (API::Navigation::currentRequest const):
2250         (API::Navigation::currentRequestProcessIdentifier const):
2251         (API::Navigation::setCurrentRequestIsRedirect):
2252         (API::Navigation::currentRequestIsRedirect const):
2253         (API::Navigation::request const): Deleted.
2254
2255         * UIProcess/API/Cocoa/WKNavigation.mm:
2256         (-[WKNavigation _request]):
2257
2258         * UIProcess/WebPageProxy.cpp:
2259         (WebKit::WebPageProxy::receivedPolicyDecision):
2260         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
2261           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
2262         (WebKit::WebPageProxy::didCreateMainFrame):
2263         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
2264           cross-origin redirect that is just starting back up in a new WebProcess.
2265         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2266         (WebKit::WebPageProxy::didCommitLoadForFrame):
2267         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2268         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
2269           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
2270         * UIProcess/WebPageProxy.h:
2271         * UIProcess/WebPageProxy.messages.in:
2272
2273         * UIProcess/WebProcessPool.cpp:
2274         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
2275           be used to continue a navigation.
2276         * UIProcess/WebProcessPool.h:
2277
2278         * UIProcess/WebProcessProxy.h:
2279         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
2280         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
2281
2282         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2283         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
2284         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2285
2286 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2287
2288         [Extra zoom mode] Zoom level is sometimes excessive when zooming to focused form controls
2289         https://bugs.webkit.org/show_bug.cgi?id=184222
2290         <rdar://problem/39063886>
2291
2292         Reviewed by Timothy Hatcher.
2293
2294         Upon interactively focusing an element, we zoom and scroll to reveal that element. The heuristics introduced in
2295         <https://trac.webkit.org/r168744> work by computing a target scale, and then a point to zoom to given that
2296         scale. Currently, this scale is dependent on the computed font size of the form control, such that the form
2297         control would be scaled to have an effective font size of 16.
2298
2299         However, in extra zoom mode, applying these same heuristics (ironically) results in excessive zoom levels, since
2300         scaling the font up to 16 would cause most form controls to zoom so far in that we lose context of surrounding
2301         elements such as labels and other form controls; the fact that the element is highlighted by the focused form
2302         control overlay makes this even more confusing, since part of the focus overlay highlight rect often ends up
2303         outside the viewport.
2304
2305         To fix this, we make a couple of tweaks to focus rect zooming in extra zoom mode. (1) Instead of computing
2306         target zoom level based on font size, try to zoom such that the focused element rect fills up most of the
2307         viewport (similar to double-tap zooming). This ensures that the focused form control overlay's highlight rect
2308         makes sense in most cases, with few exceptions (e.g. the element frame is larger than the viewport). (2)
2309         Introduce a minimum legible font size of 11, and compute the minimium scale needed such that the form control
2310         font would appear to be at least this legible font size. Then, clamp the target scale chosen by (1) to this
2311         minimum scale.
2312
2313         One additional consideration for (1) is that naively scaling to fit the element rect to the viewport (with some
2314         fixed margins) would cause the viewport scale to always change when moving focus between form controls of
2315         different dimensions, even if the current scale is more or less appropriate for all the focusable elements. To
2316         address this, instead of computing a single target zoom scale for an element rect, compute a range of possible
2317         target zoom scales (where the minimum and maximum values depend on the margin we add around the element rect).
2318         If the current scale already falls within this target scale range, then we won't bother adjusting the scale at
2319         all (unless the font size is too small — see (2)). If the current scale falls outside the target scale range, we
2320         then make the minimal adjustment needed to ensure that the element rect fits well within the viewport without
2321         being too small.
2322
2323         * UIProcess/API/Cocoa/WKWebView.mm:
2324         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2325
2326         Move some logic around so that the target scale is computed after computing the visible size. Also renames some
2327         constants local to this function (WKWebViewStandardFontSize, kMinimumHeightToShowContentAboveKeyboard,
2328         UIWebFormAnimationDuration, CaretOffsetFromWindowEdge) such that they now share a consistent naming style.
2329
2330 2018-04-02  Jer Noble  <jer.noble@apple.com>
2331
2332         Enable Legacy EME for all WebKit & WebKitLegacy clients
2333         https://bugs.webkit.org/show_bug.cgi?id=184018
2334         <rdar://problem/34887387>
2335
2336         Reviewed by Eric Carlson.
2337
2338         * Shared/WebPreferences.yaml:
2339         * Shared/WebPreferencesDefaultValues.h:
2340
2341 2018-04-02  Jer Noble  <jer.noble@apple.com>
2342
2343         REGRESSION (229680): Fullscreen video does not work (youtube, netflix)
2344         https://bugs.webkit.org/show_bug.cgi?id=184235
2345
2346         Reviewed by Eric Carlson.
2347
2348         Enable the Fullscreen API by default.
2349
2350         * Shared/WebPreferences.yaml:
2351         * Shared/WebPreferencesDefaultValues.h:
2352
2353 2018-04-02  Fujii Hironori  <Hironori.Fujii@sony.com>
2354
2355         [Win] MSVC can't compile WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent
2356         https://bugs.webkit.org/show_bug.cgi?id=184120
2357
2358         Reviewed by Alex Christensen.
2359
2360         It seems that MSVC can't compile the code using `this` in a
2361         generalized lambda capture in another lambda.
2362
2363         In this case, there is no need to copy `protectedThis` for the
2364         inner lambda. Move `protectedThis` of the outer lambda to the
2365         inner as well as `callback`.
2366
2367         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2368         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2369         Moved `protectedThis` from the outer lambda to the inner.
2370
2371 2018-04-02  Dan Bernstein  <mitz@apple.com>
2372
2373         Build fix after r230121
2374
2375         * Configurations/WebKit.xcconfig: Disabled framework header postprocessing when building for
2376           iOS 11.*
2377         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Reverted r230159.
2378
2379 2018-04-02  Dan Bernstein  <mitz@apple.com>
2380
2381         Fixed the build when BOOL is not bool.
2382         <rdar://problem/39094484>
2383
2384         Reviewed by Jer Noble.
2385
2386         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2387         (-[WKFullScreenViewController videoControlsManagerDidChange]): Removed the write-only ivar
2388           _hasControlsManager, the assignment to which was causing the compiler error.
2389
2390 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
2391
2392         Unreviewed build fix.
2393
2394         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Update availability annotation.
2395
2396 2018-04-02  Michael Catanzaro  <mcatanzaro@igalia.com>
2397
2398         [GTK] DragAndDropHandler.cpp should include GUniquePtrGtk.h
2399         https://bugs.webkit.org/show_bug.cgi?id=184119
2400
2401         Reviewed by Daniel Bates.
2402
2403         * UIProcess/gtk/DragAndDropHandler.cpp:
2404
2405 2018-04-02  Frederic Wang  <fwang@igalia.com>
2406
2407         Fix warnings for unused lambda captures in Source/WebKit
2408         https://bugs.webkit.org/show_bug.cgi?id=173555
2409
2410         Reviewed by Konstantin Tokarev.
2411
2412         When release logs are disabled, several lambda captures are unused, causing compilation
2413         failures with -Wunused-lambda-capture. This patch marks the corresponding variables as unused
2414         in order to fix these warnings.
2415
2416         Based on initial patch by: Konstantin Tokarev  <annulen@yandex.ru>
2417
2418         * NetworkProcess/NetworkResourceLoader.cpp:
2419         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2420         * UIProcess/Network/NetworkProcessProxy.cpp:
2421         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2422         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2423         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2424         * UIProcess/WebProcessProxy.cpp:
2425         (WebKit::WebProcessProxy::fetchWebsiteData):
2426         (WebKit::WebProcessProxy::deleteWebsiteData):
2427         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2428         * UIProcess/ios/WKContentViewInteraction.mm:
2429         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2430
2431 2018-04-02  Alejandro G. Castro  <alex@igalia.com>
2432
2433         [GTK] Make libwebrtc backend buildable for GTK  port
2434         https://bugs.webkit.org/show_bug.cgi?id=178860
2435
2436         Reviewed by Youenn Fablet.
2437
2438         * CMakeLists.txt: Add RTC network classes to the compilation and
2439         the libwebrtc includes.
2440         * PlatformGTK.cmake: Add the libwebrtc directory.
2441         * SourcesGTK.txt: Add RTC files to the compilation.
2442
2443 2018-03-30  Chris Dumez  <cdumez@apple.com>
2444
2445         REGRESSION (r229828): Facebook login popup is blank
2446         https://bugs.webkit.org/show_bug.cgi?id=184206
2447         <rdar://problem/39057006>
2448
2449         Reviewed by Wenson Hsieh.
2450
2451         Add assertion to make sure we never try to do a policy check to
2452         a resource response while a policy check for a navigation is
2453         pending. This assertion was being hit by several of our redirection
2454         tests without my fix.
2455
2456         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2457         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2458
2459 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2460
2461         Unreviewed, rolling out r230125.
2462
2463         Build fix broke more builds.
2464
2465         Reverted changeset:
2466
2467         "Unreviewed build fix, remove unused lambda capture."
2468         https://trac.webkit.org/changeset/230125
2469
2470 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2471
2472         Unreviewed build fix, remove unused lambda capture.
2473
2474         * NetworkProcess/NetworkResourceLoader.cpp:
2475         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2476
2477 2018-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2478
2479         [Extra zoom mode] Adopt list view controller UI for numeric input types
2480         https://bugs.webkit.org/show_bug.cgi?id=184184
2481         <rdar://problem/37238916>
2482
2483         Reviewed by Timothy Hatcher.
2484
2485         Remove existing logic for presenting a number pad view controller, since number pads will now be handled as a
2486         special case of general text form controls in extra zoom mode.
2487
2488         * UIProcess/ios/WKContentViewInteraction.h:
2489         * UIProcess/ios/WKContentViewInteraction.mm:
2490         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2491         (-[WKContentView dismissAllInputViewControllers]):
2492         (-[WKContentView _wheelChangedWithEvent:]):
2493
2494 2018-03-30  Dan Bernstein  <mitz@apple.com>
2495
2496         Update availability annotations to match the macOS 10.13.4 and iOS 11.3 GM SDKs
2497         https://bugs.webkit.org/show_bug.cgi?id=184173
2498
2499         Reviewed by Alex Christensen.
2500
2501         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13.4 and 11.3, respectively, in all declarations that
2502         appear in the GM SDKs.
2503
2504         * Shared/API/Cocoa/_WKNSWindowExtras.h:
2505         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2506         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
2507         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
2508         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2509         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2510         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2511         * UIProcess/API/Cocoa/WKViewPrivate.h:
2512         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2513         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2514         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
2515         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2516         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
2517         * UIProcess/API/Cocoa/_WKAttachment.h:
2518         * UIProcess/API/Cocoa/_WKAutomationSession.h:
2519         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
2520         * UIProcess/API/Cocoa/_WKDownload.h:
2521         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
2522         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2523         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
2524         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2525         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
2526         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
2527         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2528         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2529         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
2530         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
2531
2532 2018-03-30  Youenn Fablet  <youenn@apple.com>
2533
2534         NetworkLoadChecker should upgrade redirects if needed
2535         https://bugs.webkit.org/show_bug.cgi?id=184098
2536
2537         Reviewed by Chris Dumez.
2538
2539         In case of redirections, upgrade URL according CSP.
2540
2541         * NetworkProcess/NetworkLoadChecker.cpp:
2542         (WebKit::NetworkLoadChecker::checkRequest):
2543         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
2544
2545 2018-03-30  JF Bastien  <jfbastien@apple.com>
2546
2547         Update messages.py codegen for String, fix tests
2548         https://bugs.webkit.org/show_bug.cgi?id=184179
2549         <rdar://problem/39041352>
2550
2551         Reviewed by Mark Lam.
2552
2553         I updated some of the code in
2554         https://trac.webkit.org/changeset/230097 and auto-magically used a
2555         script to update copyright headers... and that broke the tests
2556         which checked for a particular date. Update all of the headers.
2557
2558         Part of this change updates the code generated by messages.py
2559
2560         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2561         * Scripts/webkit/MessageReceiver-expected.cpp:
2562         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
2563         * Scripts/webkit/MessagesSuperclass-expected.h:
2564         * Scripts/webkit/messages.py:
2565         * Scripts/webkit/messages_unittest.py:
2566         (GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
2567         generate a better error message
2568
2569 2018-03-29  JF Bastien  <jfbastien@apple.com>
2570
2571         Use Forward.h instead of forward-declaring WTF::String
2572         https://bugs.webkit.org/show_bug.cgi?id=184172
2573         <rdar://problem/39026146>
2574
2575         Reviewed by Yusuke Suzuki.
2576
2577         As part of #184164 I'm changing WTF::String, and the forward
2578         declarations are just wrong because I'm making it templated. We
2579         should use Forward.h anyways, so do that instead.
2580
2581         * Scripts/webkit/LegacyMessages-expected.h:
2582         * Scripts/webkit/Messages-expected.h:
2583         * Scripts/webkit/MessagesSuperclass-expected.h:
2584         * UIProcess/WebOpenPanelResultListenerProxy.h:
2585
2586 2018-03-29  Brian Burg  <bburg@apple.com>
2587
2588         Web Automation: clipToViewport is ignored for element screenshots
2589         https://bugs.webkit.org/show_bug.cgi?id=184158
2590         <rdar://problem/39014307>
2591
2592         Reviewed by Timothy Hatcher.
2593
2594         In §19.2 Take Element Screenshot, step 5.2 says that we should clip
2595         the element screenshot rect with the visible viewport rect. We don't
2596         do that right now even though we pass over clipToViewport.
2597
2598         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2599         (WebKit::snapshotRectForScreenshot):
2600         Clip the rect to viewport if needed.
2601
2602         (WebKit::WebAutomationSessionProxy::takeScreenshot):
2603         This scrollIntoView is misplaced; by this point we have already done
2604         the math to figure out the screenshot rect. Move it before computing the rect.
2605
2606 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
2607
2608         REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection::initializeSendSource()
2609         https://bugs.webkit.org/show_bug.cgi?id=184122
2610         <rdar://problem/39003606>
2611
2612         Reviewed by Chris Dumez.
2613
2614         One of the new assertions added in r230035 begin firing while running tests locally. This was happening
2615         because the WebInspector was attempting to open a new connection to a web process that had already
2616         terminated its mach port connection (a dead port).
2617         
2618         We should avoid opening new connections when the port we were given is already dead.
2619
2620         * Platform/IPC/Connection.h:
2621         (IPC::Connection::identifierIsValid): Added.
2622         * Platform/IPC/mac/ConnectionMac.mm:
2623         (IPC::Connection::platformInitialize): Do not perform initialization on a dead (or null) port.
2624         (IPC::Connection::open): Add some assertions that ports are in a valid state.
2625         (IPC::Connection::sendOutgoingMessage): Assert that the send port is not dead.
2626         (IPC::Connection::receiveSourceEventHandler): Assert that the receive port is valid.
2627         * UIProcess/ChildProcessProxy.cpp:
2628         (WebKit::ChildProcessProxy::didFinishLaunching): Treat a dead port as a signal that the
2629         child process failed to launch.
2630         * UIProcess/Network/NetworkProcessProxy.cpp:
2631         (WebKit::NetworkProcessProxy::didFinishLaunching): Ditto.
2632         * UIProcess/Plugins/PluginProcessProxy.cpp:
2633         (WebKit::PluginProcessProxy::didFinishLaunching): Ditto.
2634         * UIProcess/Storage/StorageProcessProxy.cpp:
2635         (WebKit::StorageProcessProxy::didFinishLaunching): Ditto.
2636         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
2637         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Ditto.
2638         * WebProcess/WebPage/WebInspectorUI.cpp:
2639         (WebKit::WebInspectorUI::establishConnection): Ditto.
2640         * WebProcess/WebProcess.cpp:
2641         (WebKit::WebProcess::ensureNetworkProcessConnection): Ditto.
2642         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Ditto.
2643
2644 2018-03-29  Youenn Fablet  <youenn@apple.com>
2645
2646         Synchronize SecurityOrigin related scheme registries with NetworkProcess
2647         https://bugs.webkit.org/show_bug.cgi?id=184140
2648
2649         Reviewed by Chris Dumez.
2650
2651         Add syncing of scheme registries that are used by SecurityOrigin and ContentSecurityPolicy
2652         so that we can properly use them in NetworkProcess as we do in WebProcess.
2653         The registries that are not synced are:
2654         - URLSchemeAsEmptyDocument
2655         - URLSchemeDomainRelaxationForbidden
2656         - URLSchemeAsCachePartitioned
2657         - URLSchemeAsCanDisplayOnlyIfCanRequest
2658
2659         * NetworkProcess/NetworkProcess.cpp:
2660         (WebKit::NetworkProcess::initializeNetworkProcess):
2661         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
2662         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
2663         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
2664         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
2665         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
2666         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
2667         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
2668         * NetworkProcess/NetworkProcess.h:
2669         * NetworkProcess/NetworkProcess.messages.in:
2670         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2671         (WebKit::NetworkProcessCreationParameters::encode const):
2672         (WebKit::NetworkProcessCreationParameters::decode):
2673         * NetworkProcess/NetworkProcessCreationParameters.h:
2674         * UIProcess/WebProcessPool.cpp:
2675         (WebKit::WebProcessPool::ensureNetworkProcess):
2676         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
2677         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
2678         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
2679         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
2680         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
2681         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
2682         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
2683
2684 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
2685
2686         REGRESSION(r229480): ERROR: Unhandled web process message 'WebCookieManager:SetHTTPCookieAcceptPolicy'
2687         https://bugs.webkit.org/show_bug.cgi?id=184124
2688         <rdar://problem/38998971>
2689
2690         Reviewed by Chris Dumez.
2691
2692         Cookie accept policy messages were still being sent to the WebContent process after
2693         I removed cookie access in r229480. The WebContent process no longer recognizes these
2694         messages, and generates logging to that effect.
2695         
2696         This patch stops sending these unnecessary messages to the WebContent process. Only the
2697         Network process needs to receive this information.
2698
2699         * UIProcess/WebCookieManagerProxy.cpp:
2700         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2701
2702 2018-03-29  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
2703
2704         [WPE] Floating point exception in WebEventFactory::createWebWheelEvent
2705         https://bugs.webkit.org/show_bug.cgi?id=184037
2706
2707         Reviewed by Žan Doberšek.
2708
2709         * Shared/wpe/WebEventFactory.cpp:
2710         (WebKit::WebEventFactory::createWebWheelEvent): Use std::copysign() to avoid division by 0.
2711
2712 2018-03-28  Zalan Bujtas  <zalan@apple.com>
2713
2714         Make it possible to override the screen size
2715         https://bugs.webkit.org/show_bug.cgi?id=184111
2716         <rdar://problem/38972181>
2717
2718         Reviewed by Tim Horton.
2719
2720         * Shared/WebPageCreationParameters.cpp:
2721         (WebKit::WebPageCreationParameters::encode const):
2722         (WebKit::WebPageCreationParameters::decode):
2723         * Shared/WebPageCreationParameters.h:
2724         * UIProcess/WebPageProxy.cpp:
2725         (WebKit::WebPageProxy::creationParameters):
2726         * UIProcess/WebPageProxy.h:
2727         * UIProcess/ios/WebPageProxyIOS.mm:
2728         (WebKit::WebPageProxy::overrideScreenSize):
2729         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2730         (WebKit::WebChromeClient::overrideScreenSize const):
2731         * WebProcess/WebCoreSupport/WebChromeClient.h:
2732         * WebProcess/WebPage/WebPage.cpp:
2733         * WebProcess/WebPage/WebPage.h:
2734         * WebProcess/WebPage/ios/WebPageIOS.mm:
2735         (WebKit::WebPage::overrideScreenSize const):
2736
2737 2018-03-28  Chris Dumez  <cdumez@apple.com>
2738
2739         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
2740         https://bugs.webkit.org/show_bug.cgi?id=183962
2741         <rdar://problem/38817833>
2742
2743         Reviewed by Brady Eidson.
2744
2745         Swap WebProcess on for the initial navigation in a new Window that was opened
2746         via window.open(), when the new URL is cross-origin compared to the opener's
2747         origin. For now, we only swap process if 'noopener' property is set when calling
2748         window.open(). This is because we do not support the remote DOMWindows yet.
2749
2750         * Shared/NavigationActionData.cpp:
2751         (WebKit::NavigationActionData::encode const):
2752         (WebKit::NavigationActionData::decode):
2753         * Shared/NavigationActionData.h:
2754         * UIProcess/API/APINavigation.h:
2755         (API::Navigation::setIsCrossOriginWindowOpenNavigation):
2756         (API::Navigation::isCrossOriginWindowOpenNavigation const):
2757         (API::Navigation::setOpener):
2758         (API::Navigation::opener const):
2759         * UIProcess/WebPageProxy.cpp:
2760         (WebKit::WebPageProxy::receivedPolicyDecision):
2761         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2762         * UIProcess/WebProcessPool.cpp:
2763         (WebKit::WebProcessPool::processForNavigation):
2764         * UIProcess/WebProcessPool.h:
2765         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2766         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2767
2768 2018-03-28  Per Arne Vollan  <pvollan@apple.com>
2769
2770         Adopt WEBPROCESS_WINDOWSERVER_BLOCKING compiler guard in WebProcess.
2771         https://bugs.webkit.org/show_bug.cgi?id=183959
2772         <rdar://problem/38965719>
2773
2774         Reviewed by Brent Fulgham.
2775
2776         Use the compile guard to guard the call to CGSSetDenyWindowServerConnections.
2777
2778         * WebProcess/WebProcess.cpp:
2779         (WebKit::WebProcess::initializeProcess):
2780
2781 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2782
2783         Unreviewed build fix after r230045.
2784
2785         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Add missing include (breaks iOS).
2786
2787 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2788
2789         Protect against invalid mach ports returned by mach_port_request_notification
2790         https://bugs.webkit.org/show_bug.cgi?id=184106
2791         <rdar://problem/37865316>
2792
2793         Reviewed by Chris Dumez.
2794
2795         * Platform/IPC/Connection.h:
2796         (IPC::Connection::Identifier::Identifier): Use default initializer syntax.
2797         * Platform/IPC/mac/ConnectionMac.mm:
2798         (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging.
2799         (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification'
2800         and clean up if it experienced an error.
2801         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2802         (WebKit::ProcessLauncher::launchProcess): Ditto.
2803
2804 2018-03-28  Dean Jackson  <dino@apple.com>
2805
2806         WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
2807         https://bugs.webkit.org/show_bug.cgi?id=184107
2808         <rdar://problem/38967492>
2809
2810         Reviewed by Tim Horton.
2811
2812         There is no need for this class to be a UIScrollViewDelegate. Instead
2813         the protocol should have an optional method that is effectively
2814         scrollViewDidScroll.
2815
2816         * UIProcess/API/Cocoa/WKWebView.mm:
2817         (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
2818         if it exists.
2819         * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
2820         and add an optional web_scrollViewDidScroll.
2821         * UIProcess/ios/WKPDFView.mm:
2822         (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
2823         (-[WKPDFView scrollViewDidScroll:]): Deleted.
2824         * UIProcess/ios/WKSystemPreviewView.mm:
2825         (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
2826
2827 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2828
2829         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
2830         https://bugs.webkit.org/show_bug.cgi?id=184092
2831         <rdar://problem/38939917>
2832
2833         Reviewed by Tim Horton.
2834
2835         Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
2836         normal text autosizing values.
2837
2838         * Shared/WebPreferences.yaml:
2839         * UIProcess/API/Cocoa/WKPreferences.mm:
2840         (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
2841         (-[WKPreferences _shouldEnableTextAutosizingBoost]):
2842         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2843
2844 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2845
2846         Avoid uninitialized mach ports
2847         https://bugs.webkit.org/show_bug.cgi?id=184090
2848         <rdar://problem/37261129>
2849
2850         Reviewed by Chris Dumez.
2851
2852         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
2853         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
2854         there is a potential for us to try to use invalid ports.
2855
2856         We should always check return values, and ensure that the mach port variables we seek to initialize are
2857         kept in a valid state.
2858
2859         Reviewed by Chris Dumez.
2860
2861         * NetworkProcess/NetworkProcess.cpp:
2862         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): Initialize new port to a safe default and
2863         check the return state of the allocation function.
2864         * Platform/IPC/Connection.h:
2865         * Platform/IPC/mac/ConnectionMac.mm:
2866         (IPC::Connection::open): Ditto.
2867         (IPC::Connection::initializeSendSource): Ditto.
2868         (IPC::readFromMachPort): Ditto.
2869         (IPC::Connection::receiveSourceEventHandler): Ditto.
2870         * Platform/SharedMemory.h:
2871         * Platform/cocoa/SharedMemoryCocoa.cpp:
2872         (WebKit::makeMemoryEntry): Ditto.
2873         * Platform/mac/MachUtilities.cpp:
2874         (setMachPortQueueLength): Ditto.
2875         (setMachExceptionPort): Ditto.
2876         * PluginProcess/PluginProcess.cpp:
2877         (WebKit::PluginProcess::createWebProcessConnection): Ditto.
2878         * StorageProcess/StorageProcess.cpp:
2879         (WebKit::StorageProcess::createStorageToWebProcessConnection): Ditto.
2880         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2881         (WebKit::ProcessLauncher::launchProcess): Ditto.
2882         * WebProcess/WebPage/WebInspector.cpp:
2883         (WebKit::WebInspector::openFrontendConnection): Ditto.
2884
2885 2018-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2886
2887         Fails to build webkitgtk+ after git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2888         https://bugs.webkit.org/show_bug.cgi?id=184081
2889
2890         Unreviewed, switch to use UNUSED_PARAM()
2891
2892         * UIProcess/WebPageProxy.cpp:
2893         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2894
2895 2018-03-28  Tim Horton  <timothy_horton@apple.com>
2896
2897         Make use of HAVE(CORE_ANIMATION_RENDER_SERVER) in more places
2898         https://bugs.webkit.org/show_bug.cgi?id=184072
2899         <rdar://problem/38946530>
2900
2901         Reviewed by Dan Bernstein.
2902
2903         * Platform/mac/LayerHostingContext.mm:
2904         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2905         * UIProcess/mac/ViewSnapshotStore.h:
2906         * UIProcess/mac/ViewSnapshotStore.mm:
2907         (WebKit::ViewSnapshot::clearImage):
2908
2909 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2910
2911         Revert an unnecessary workaround when zooming focused form controls
2912         https://bugs.webkit.org/show_bug.cgi?id=184067
2913         <rdar://problem/38805254>
2914
2915         Reviewed by Tim Horton.
2916
2917         Reverts an unintended change introduced in r227984.
2918
2919         * UIProcess/ios/WKContentViewInteraction.mm:
2920         (-[WKContentView _displayFormNodeInputView]):
2921
2922 2018-03-28  Miguel Gomez  <magomez@igalia.com>
2923
2924         [GTK][WPE] Remove UpdateAtlas
2925         https://bugs.webkit.org/show_bug.cgi?id=184042
2926
2927         Reviewed by Žan Doberšek.
2928
2929         Remove all the code related to UpdateAtlas handling.
2930
2931         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2932         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
2933         (WebKit::CoordinatedGraphicsScene::commitSceneState):
2934         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
2935         (WebKit::CoordinatedGraphicsScene::syncUpdateAtlases): Deleted.
2936         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas): Deleted.
2937         (WebKit::CoordinatedGraphicsScene::removeUpdateAtlas): Deleted.
2938         (WebKit::CoordinatedGraphicsScene::releaseUpdateAtlases): Deleted.
2939         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2940         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2941         (WebKit::ThreadedCompositor::renderLayerTree):
2942         (WebKit::ThreadedCompositor::releaseUpdateAtlases): Deleted.
2943         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2944         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2945         (WebKit::WebChromeClient::delegatedScrollRequested):
2946         (WebKit::WebChromeClient::resetUpdateAtlasForTesting): Deleted.
2947         * WebProcess/WebCoreSupport/WebChromeClient.h:
2948         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2949         (WebKit::AcceleratedDrawingArea::resetUpdateAtlasForTesting): Deleted.
2950         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2951         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2952         (WebKit::CompositingCoordinator::CompositingCoordinator):
2953         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
2954         (WebKit::CompositingCoordinator::clearPendingStateChanges):
2955         (WebKit::CompositingCoordinator::renderNextFrame):
2956         (WebKit::CompositingCoordinator::purgeBackingStores):
2957         (WebKit::CompositingCoordinator::createUpdateAtlas): Deleted.
2958         (WebKit::CompositingCoordinator::removeUpdateAtlas): Deleted.
2959         (WebKit::CompositingCoordinator::getCoordinatedBuffer): Deleted.
2960         (): Deleted.
2961         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases): Deleted.
2962         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired): Deleted.
2963         (WebKit::CompositingCoordinator::releaseAtlases): Deleted.
2964         (WebKit::CompositingCoordinator::clearUpdateAtlases): Deleted.
2965         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2966         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2967         (WebKit::CoordinatedLayerTreeHost::clearUpdateAtlases): Deleted.
2968         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2969         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2970         (WebKit::ThreadedCoordinatedLayerTreeHost::releaseUpdateAtlases): Deleted.
2971         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2972         * WebProcess/WebPage/DrawingArea.h:
2973         * WebProcess/WebPage/LayerTreeHost.h:
2974         (WebKit::LayerTreeHost::setIsDiscardable):
2975
2976 2018-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2977
2978         REGRESSION(r229998): WebDriver: MiniBrowser is crashing in a lot of tests after r229998
2979         https://bugs.webkit.org/show_bug.cgi?id=184075
2980
2981         Reviewed by Žan Doberšek.
2982
2983         This is because we are using a value after it has been moved.
2984
2985         * UIProcess/Automation/WebAutomationSession.cpp:
2986         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): Save a reference to page in a local variable
2987         before using it when it's also going to be moved in the lambda capture.
2988
2989 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
2990
2991         Unreviewed, fix typo in variable name
2992
2993         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2994         (webkitWebViewBaseCrossingNotifyEvent):
2995
2996 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
2997
2998         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
2999         https://bugs.webkit.org/show_bug.cgi?id=183923
3000         <rdar://problem/38756869>
3001
3002         Reviewed by Brent Fulgham.
3003
3004         Send OpenGL display mask to the WebContent process when the display ID is changing.
3005
3006         * UIProcess/WebPageProxy.cpp:
3007         (WebKit::WebPageProxy::windowScreenDidChange):
3008         * WebProcess/WebPage/WebPage.h:
3009         * WebProcess/WebPage/WebPage.messages.in:
3010         * WebProcess/WebPage/mac/WebPageMac.mm:
3011         (WebKit::WebPage::openGLDisplayMaskChanged):
3012
3013 2018-03-27  Youenn Fablet  <youenn@apple.com>
3014
3015         Move request checking out of PingLoad for future reuse in NetworkLoad
3016         https://bugs.webkit.org/show_bug.cgi?id=183865
3017
3018         Reviewed by Chris Dumez.
3019
3020         Introduce NetworkLoadChecker as a way to validate requests before sending them in the network process.
3021         Validation encompasses: CORS checks, CSP and Content Extensions on both main request and redirected requests if any.
3022
3023         Make PingLoad use NetworkLoadChecker. Future patch should make NetworkLoad to use it as well whenever needed.
3024
3025         Make NetworkCORSPreflightChecker takes a CompletionHandler instead of a Function.
3026         Ensure this callback is called even if preflight is not completed by returning a Canceled error.
3027
3028         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3029         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
3030         (WebKit::NetworkCORSPreflightChecker::returnResult):
3031         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
3032         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
3033         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
3034         * NetworkProcess/NetworkCORSPreflightChecker.h:
3035         * NetworkProcess/NetworkLoadChecker.cpp: Added.
3036         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3037         (WebKit::NetworkLoadChecker::check):
3038         (WebKit::NetworkLoadChecker::checkRedirection):
3039         (WebKit::NetworkLoadChecker::returnError):
3040         (WebKit::NetworkLoadChecker::checkRequest):
3041         (WebKit::NetworkLoadChecker::checkCORSRequest):
3042         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
3043         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3044         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
3045         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
3046         (WebKit::NetworkLoadChecker::contentExtensionsBackend):
3047         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
3048         * NetworkProcess/NetworkLoadChecker.h: Added.
3049         (WebKit::NetworkLoadChecker::setCSPResponseHeaders):
3050         (WebKit::NetworkLoadChecker::setContentExtensionRuleLists):
3051         (WebKit::NetworkLoadChecker::url const):
3052         (WebKit::NetworkLoadChecker::storedCredentialsPolicy const):
3053         (WebKit::NetworkLoadChecker::isChecking const):
3054         (WebKit::NetworkLoadChecker::isRedirected const):
3055         * NetworkProcess/PingLoad.cpp:
3056         (WebKit::PingLoad::PingLoad):
3057         (WebKit::PingLoad::~PingLoad):
3058         (WebKit::PingLoad::willPerformHTTPRedirection):
3059         (WebKit::PingLoad::didReceiveChallenge):
3060         (WebKit::PingLoad::wasBlocked):
3061         (WebKit::PingLoad::cannotShowURL):
3062         (WebKit::PingLoad::timeoutTimerFired):
3063         (WebKit::PingLoad::currentURL const):
3064         * NetworkProcess/PingLoad.h:
3065         * WebKit.xcodeproj/project.pbxproj:
3066
3067 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
3068
3069         [WebAuthN] Implement authenticatorGetAssertion
3070         https://bugs.webkit.org/show_bug.cgi?id=183881
3071         <rdar://problem/37258628>
3072
3073         Reviewed by Brent Fulgham.
3074
3075         * Shared/WebPreferences.yaml:
3076         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
3077         (WebKit::WebCredentialsMessengerProxy::makeCredential):
3078         (WebKit::WebCredentialsMessengerProxy::getAssertion):
3079         (WebKit::WebCredentialsMessengerProxy::getAssertionReply):
3080         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
3081         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
3082         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
3083         (WebKit::WebCredentialsMessenger::getAssertion):
3084         (WebKit::WebCredentialsMessenger::getAssertionReply):
3085         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
3086
3087 2018-03-27  Chris Dumez  <cdumez@apple.com>
3088
3089         Avoid constructing SecurityOrigin objects from non-main threads
3090         https://bugs.webkit.org/show_bug.cgi?id=184024
3091
3092         Reviewed by Youenn Fablet.
3093
3094         Avoid constructing SecurityOrigin objects from non-main threads as much as possible.
3095
3096         * WebProcess/Storage/WebSWClientConnection.cpp:
3097         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
3098         (WebKit::WebSWClientConnection::matchRegistration):
3099         (WebKit::WebSWClientConnection::getRegistrations):
3100         * WebProcess/Storage/WebSWClientConnection.h:
3101         * WebProcess/Storage/WebSWOriginTable.cpp:
3102         (WebKit::WebSWOriginTable::contains const):
3103         * WebProcess/Storage/WebSWOriginTable.h:
3104
3105 2018-03-27  Chris Dumez  <cdumez@apple.com>
3106
3107         Move online state detection from the WebProcess to the NetworkProcess
3108         https://bugs.webkit.org/show_bug.cgi?id=183989
3109         <rdar://problem/37093299>
3110
3111         Reviewed by Youenn Fablet.
3112
3113         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
3114         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
3115         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
3116         its connected WebProcesses via IPC.
3117
3118         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3119         (WebKit::NetworkConnectionToWebProcess::setOnLineState):
3120         * NetworkProcess/NetworkConnectionToWebProcess.h:
3121         * NetworkProcess/NetworkProcess.cpp:
3122         (WebKit::NetworkProcess::NetworkProcess):
3123         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
3124         * WebProcess/Network/NetworkProcessConnection.cpp:
3125         (WebKit::NetworkProcessConnection::setOnLineState):
3126         * WebProcess/Network/NetworkProcessConnection.h:
3127         * WebProcess/Network/NetworkProcessConnection.messages.in:
3128         * WebProcess/Network/WebLoaderStrategy.cpp:
3129         (WebKit::WebLoaderStrategy::isOnLine const):
3130         (WebKit::WebLoaderStrategy::addOnlineStateChangeListener):
3131         (WebKit::WebLoaderStrategy::setOnLineState):
3132         * WebProcess/Network/WebLoaderStrategy.h:
3133
3134 2018-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3135
3136         [Extra zoom mode] Add support for new focused form control overlay behaviors
3137         https://bugs.webkit.org/show_bug.cgi?id=184043
3138         <rdar://problem/38758727>
3139
3140         Reviewed by Tim Horton.
3141
3142         See below for more details.
3143
3144         * UIProcess/ios/WKContentViewInteraction.mm:
3145         (-[WKContentView _willStartScrollingOrZooming]):
3146         (-[WKContentView _didEndScrollingOrZooming]):
3147
3148         Suppress focused form control navigation while the scroll view is undergoing a scroll or zoom animation (e.g.,
3149         when moving from one focused form control to another).
3150
3151         (-[WKContentView textInputController:didCommitText:withSuggestion:]):
3152
3153         When dismissing an input view controller, allow focused form control navigation only after updating assisted
3154         node information to ensure that focus rects aren't stale as the user begins to navigate between forms.
3155
3156         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]):
3157         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]):
3158         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]):
3159         (-[WKContentView scrollViewForFocusedFormControlController:]):
3160         (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
3161
3162         Implement some new focused form overlay delegate hooks to vend the scroll view, as well as the rects of next and
3163         previous focusable form controls.
3164
3165 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
3166
3167         Further refine cookie read/write logging
3168         https://bugs.webkit.org/show_bug.cgi?id=184044
3169         <rdar://problem/38915610>
3170
3171         Reviewed by Chris Dumez.
3172
3173         Cookie logging was passing the partition, rather than the first party, when logging, which
3174         prevented logging in cases where partitioning or blocking was active. This patch corrects
3175         these calls so that logging is generated in these cases, too.
3176
3177         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3178         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Call log routines if needed.
3179         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): Ditto.
3180         * NetworkProcess/NetworkResourceLoader.cpp:
3181         (WebKit::escapeIDForJSON): Make available to use in multiple functions.
3182         (WebKit::NetworkResourceLoader::logCookieInformation const): Revise to use shared
3183         convenience functions.
3184         (WebKit::logBlockedCookieInformation): Added.
3185         (WebKit::logCookieInformationInternal): Added.
3186         (WebKit::NetworkResourceLoader::logCookieInformation): Revise to use shared
3187         convenience functions.
3188         * NetworkProcess/NetworkResourceLoader.h:
3189
3190 2018-03-27  Brian Burg  <bburg@apple.com>
3191
3192         Web Automation: support enter/exit fullscreen and hide/restore window operations
3193         https://bugs.webkit.org/show_bug.cgi?id=182837
3194         <rdar://problem/37580732>
3195
3196         Reviewed by Tim Horton.
3197
3198         The W3C specification is more explicit about when to exit fullscreen and
3199         restore the window for a browsing context. So, WebKit needs to have support
3200         for performing these operations on behalf of a driver.
3201
3202         Based on prototyping, it is sufficient to use a JavaScript atom to enter
3203         fullscreen mode. This is included in the patch as EnterFullscreen.js and
3204         can be used to implement the §10.7.5 Fullscreen Window command.
3205
3206         Other window operations cannot be peformed from JavaScript, so we need to
3207         delegate these operations to the session client (i.e., Safari).
3208         This patch adds session client callouts for restoring, minimizing, and
3209         switching to a browsing context.
3210
3211         Exiting fullscreen happens implicitly (per specification) when setting a
3212         window frame without an actual frame, or when switching/restoring/minimizing a window.
3213         If needed, a driver can call Set Window Rect in this way to unfullscreen a context.
3214         Similarly, a driver can restore a minimized window using Set Window Rect.
3215
3216         * UIProcess/API/APIAutomationSessionClient.h:
3217         (API::AutomationSessionClient::requestHideWindowOfPage):
3218         (API::AutomationSessionClient::requestRestoreWindowOfPage):
3219         (API::AutomationSessionClient::requestSwitchToPage):
3220         Add new API client methods.
3221
3222         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3223         Add new Cocoa API delegate methods.
3224
3225         * UIProcess/Automation/Automation.json:
3226         Make the switch to browsing context command asynchronous, since this functionality
3227         is not always synchronous, and we prefer to use completion handlers in the delegates.
3228
3229         Add new protocol method for hiding the window of a browsing context.
3230         This is expected to minimize/miniaturize a window for desktop window managers.
3231
3232         * UIProcess/Automation/WebAutomationSession.h:
3233         * UIProcess/Automation/WebAutomationSession.cpp:
3234         (WebKit::WebAutomationSession::switchToBrowsingContext):
3235         Make this function asynchronous. Call out to the session client.
3236
3237         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
3238         Follow the steps in the specification to restore window and exit fullscreen.
3239
3240         (WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
3241         Exit fullscreen and call out to the session client.
3242
3243         (WebKit::WebAutomationSession::exitFullscreenWindowForPage):
3244         This is a little strange. Because there is no async API for exiting fullscreen
3245         from C++ code, we hook into willEnterFullScreen and didExitFullScreen and send
3246         out the response if the page exited fullscreen after we requested it to do so.
3247         Because the W3C specification mandates that drivers only process one command at
3248         a time, there will only ever be one callback installed by this method at a time.
3249
3250         (WebKit::WebAutomationSession::restoreWindowForPage):
3251         (WebKit::WebAutomationSession::hideWindowForPage):
3252         Call out to the session client.
3253
3254         (WebKit::WebAutomationSession::didEnterFullScreenForPage):
3255         (WebKit::WebAutomationSession::didExitFullScreenForPage):
3256         Add methods to be called by instrumentation hooks in WebFullScreenManagerProxy.
3257
3258         * UIProcess/Automation/atoms/EnterFullscreen.js: Added.
3259         (enterFullscreen):
3260
3261         * UIProcess/Cocoa/AutomationSessionClient.h:
3262         * UIProcess/Cocoa/AutomationSessionClient.mm:
3263         (WebKit::AutomationSessionClient::AutomationSessionClient):
3264         (WebKit::AutomationSessionClient::requestSwitchToPage):
3265         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
3266         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
3267         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
3268         Add boilerplate to convert C++ API client to Objective-C delegate methods.
3269
3270         * UIProcess/WebFullScreenManagerProxy.cpp:
3271         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
3272         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
3273         Notify the automation session if the page is under automation and
3274         enters or exits fullscreen.
3275
3276         * WebKit.xcodeproj/project.pbxproj:
3277         Add EnterFullscreen.js to the list of WebDriver atoms. These are copied
3278         as WebKit2 private headers and used by driver implementations.
3279
3280 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
3281
3282         Make AVFoundationEnabled preference available on iOS
3283         https://bugs.webkit.org/show_bug.cgi?id=183876
3284         <rdar://problem/38726459>
3285
3286         Reviewed by Youenn Fablet.
3287
3288         * Shared/WebPreferences.yaml: Set AVFoundationEnabled with DEFAULT_AVFOUNDATION_ENABLED.
3289         * Shared/WebPreferencesDefaultValues.h:
3290
3291         * UIProcess/API/Cocoa/WKPreferences.mm:
3292         (-[WKPreferences _setAVFoundationEnabled:]): Enable for iOS.
3293         (-[WKPreferences _avFoundationEnabled]): Ditto.
3294         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3295
3296 2018-03-26  Tim Horton  <timothy_horton@apple.com>
3297
3298         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebKit
3299         https://bugs.webkit.org/show_bug.cgi?id=184030
3300         <rdar://problem/38895281>
3301
3302         Reviewed by Dan Bernstein.
3303
3304         * Configurations/Base.xcconfig:
3305         * Configurations/BaseTarget.xcconfig:
3306         * Configurations/WebKit.xcconfig:
3307
3308 2018-03-26  Tim Horton  <timothy_horton@apple.com>
3309
3310         Add and adopt HAVE(CORE_ANIMATION_RENDER_SERVER)
3311         https://bugs.webkit.org/show_bug.cgi?id=184026
3312         <rdar://problem/38883321>
3313
3314         Reviewed by Sam Weinig.
3315
3316         * UIProcess/API/Cocoa/WKWebView.mm:
3317         (-[WKWebView _takeViewSnapshot]):
3318         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
3319
3320 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3321
3322         [Extra zoom mode] Refactor input view controller presentation and dismissal helpers
3323         https://bugs.webkit.org/show_bug.cgi?id=184020
3324         Work towards <rdar://problem/38758727>
3325
3326         Reviewed by Tim Horton.
3327
3328         We currently have separate presentation and dismissal helpers for each type of view controller corresponding to
3329         a focused element type. This is excessive, considering that all of these helpers are only invoked from one place
3330         (either -presentViewControllerForCurrentAssistedNode or -dismissAllInputViewControllers), with the exception of
3331         the focused form control overlay.
3332
3333         This refactoring allows us to then adjust the timing of first responder restoration logic, such that the focused
3334         form control view controller can receive forwarded events from the web view. See below for more detail.
3335
3336         * UIProcess/ios/WKContentViewInteraction.mm:
3337         (-[WKContentView presentFocusedFormControlViewController:]):
3338         (-[WKContentView dismissFocusedFormControlViewController:]):
3339
3340         Remove logic to restore the web view as first responder.
3341
3342         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3343         (-[WKContentView dismissAllInputViewControllers]):
3344
3345         Restore first responder after dismissing a view controller that was presented when focusing a form control, only
3346         if the web view was first responder before presentation.
3347
3348         (-[WKContentView presentDatePickerViewController:]): Deleted.
3349         (-[WKContentView dismissDatePickerViewController:]): Deleted.
3350         (-[WKContentView presentTimePickerViewController:]): Deleted.
3351         (-[WKContentView dismissTimePickerViewController:]): Deleted.
3352         (-[WKContentView presentSelectMenuViewController:]): Deleted.
3353         (-[WKContentView dismissSelectMenuViewController:]): Deleted.
3354         (-[WKContentView dismissNumberPadViewController:]): Deleted.
3355         (-[WKContentView presentNumberPadViewController:]): Deleted.
3356         (-[WKContentView presentTextInputViewController:]): Deleted.
3357         (-[WKContentView dismissTextInputViewController:]): Deleted.
3358
3359 2018-03-06  Brian Burg  <bburg@apple.com>
3360
3361         Web Automation: provide a way to ask clients for a new tab or window
3362         https://bugs.webkit.org/show_bug.cgi?id=183381
3363         <rdar://problem/38167301>
3364
3365         Reviewed by Timothy Hatcher.
3366
3367         Add support for specifying browsing context options when requesting
3368         a new browsing context from the automation session client/delegate.
3369         This is currently just used for specifying tab vs window, but could
3370         also be used for things like toggling certain browser chrome or features.
3371
3372         There is no guarantee that the client has a notion of tabs vs windows,
3373         so this option is purely advisory and should not cause the command to
3374         fail if it cannot be honored.
3375
3376         This behavior caused by specifying this option is client-specific, so no
3377         new tests are included in WebKit for this change.
3378
3379         * UIProcess/API/APIAutomationSessionClient.h:
3380         (API::AutomationSessionClient::didRequestNewPageWithOptions):
3381         (API::AutomationSessionClient::didRequestNewWindow): Deleted.
3382         Add options parameter.
3383
3384         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3385         Adjust to new signature. More work is needed to plumb this information
3386         to the public API for GTK/WPE and support it in WebKitGTK driver.
3387
3388         * UIProcess/Automation/Automation.json: Add new optional parameter.
3389
3390         * UIProcess/Automation/WebAutomationSession.h:
3391         * UIProcess/Automation/WebAutomationSession.cpp:
3392         (WebKit::WebAutomationSession::createBrowsingContext):
3393         Convert the protocol option to an API option.
3394
3395         * UIProcess/Cocoa/AutomationSessionClient.h:
3396         * UIProcess/Cocoa/AutomationSessionClient.mm:
3397         (WebKit::AutomationSessionClient::AutomationSessionClient):
3398         (WebKit::toAPI):
3399         (WebKit::AutomationSessionClient::didRequestNewPageWithOptions):
3400         (WebKit::AutomationSessionClient::didRequestNewWindow): Deleted.
3401         Convert the internal option to a Cocoa SPI option and pass it along.
3402
3403         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3404         Adjust delegate methods to include options. Clients need to adopt the new signature(s).
3405
3406 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3407
3408         [Extra zoom mode] Add plumbing for next and previous focusable element rects
3409         https://bugs.webkit.org/show_bug.cgi?id=184016
3410         Work towards <rdar://problem/38758727>
3411
3412         Reviewed by Tim Horton.
3413
3414         When building up AssistedNodeInformation, we currently compute the element rect of the current focused element,
3415         as well as flags indicating whether or not there are next or previous focusable elements. For
3416         <rdar://problem/38758727>, we additionally send the rects of the next or previous focusable elements as well.
3417
3418         * Shared/AssistedNodeInformation.cpp:
3419         (WebKit::AssistedNodeInformation::encode const):
3420         (WebKit::AssistedNodeInformation::decode):
3421
3422         IPC support for nextNodeRect and previousNodeRect.
3423
3424    &nbs