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