Implement Same-Site cookies
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-23  Daniel Bates  <dabates@apple.com>
2
3         Implement Same-Site cookies
4         https://bugs.webkit.org/show_bug.cgi?id=159464
5         <rdar://problem/27196358>
6
7         Reviewed by Brent Fulgham.
8
9         Pass the Same-Site info through the WebKit abstractions.
10
11         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
12         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
13         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
14         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
15         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
16         * NetworkProcess/NetworkConnectionToWebProcess.h:
17         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
18         * NetworkProcess/NetworkResourceLoader.cpp:
19         (WebKit::NetworkResourceLoader::logCookieInformation const):
20         (WebKit::logBlockedCookieInformation):
21         (logCookieInformationInternal):
22         (NetworkResourceLoader::logCookieInformation):
23         * NetworkProcess/NetworkResourceLoader.h:
24         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
25         (WebKit::NetworkCache::constructRevalidationRequest):
26         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
27         (WebKit::NetworkCache::SubresourceInfo::encode const):
28         (WebKit::NetworkCache::SubresourceInfo::decode):
29         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
30         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
31         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
32         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
33         a top-level navigation.
34         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
35         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
36         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
37         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
38         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
39         * UIProcess/WebProcessPool.cpp:
40         (WebKit::WebProcessPool::download):
41         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
42         (WebKit::WebPlatformStrategies::cookiesForDOM):
43         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
44         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
45         (WebKit::WebPlatformStrategies::getRawCookies):
46         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
47
48 2018-04-23  Chris Dumez  <cdumez@apple.com>
49
50         WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
51         https://bugs.webkit.org/show_bug.cgi?id=184889
52         <rdar://problem/38151530>
53
54         Reviewed by Brady Eidson.
55
56         In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
57         as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
58         for the same assertion state, which would cause duplicate logging but also some unnecessary work.
59
60         * UIProcess/ProcessThrottler.cpp:
61         (WebKit::ProcessThrottler::updateAssertionNow):
62
63 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
64
65         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
66         https://bugs.webkit.org/show_bug.cgi?id=184881
67
68         Reviewed by Michael Catanzaro.
69
70         The CompositingCoordinator::setVisibleContentsRect() method is always
71         called with a (0,0) FloatPoint value as the trajectory vector parameter,
72         which is already the default value in TiledBackingStore where this ends
73         up. Removing this call chain also enables removing some unnecessary and
74         odd code in the CoordinatedGraphicsLayer class.
75
76         This doesn't yet touch the trajectory logic in the TiledBackingStore
77         class since it's not yet a given this won't be used in the future. But
78         if that will be necessary, hope is to not use it this way.
79
80         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
81         (WebKit::CompositingCoordinator::setVisibleContentsRect):
82         (WebKit::CompositingCoordinator::mainContentsLayer): Deleted.
83         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
84         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
85         (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
86         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
87         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
88         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport):
89
90 2018-04-23  Fujii Hironori  <Hironori.Fujii@sony.com>
91
92         [Win][WK2] REGRESSION(r230834) 'getpid': identifier not found
93         https://bugs.webkit.org/show_bug.cgi?id=184877
94
95         Reviewed by Yusuke Suzuki.
96
97         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
98         (WebKit::WebBackForwardListProxy::addItem): Use WTF::getCurrentProcessID() instead of getpid().
99         * WebProcess/WebPage/WebPage.cpp:
100         (WebKit::WebPage::goToBackForwardItem): Ditto.
101
102 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
103
104         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
105         https://bugs.webkit.org/show_bug.cgi?id=184810
106
107         Reviewed by Carlos Garcia Campos.
108
109         CoordinatedBackingStore should inherit directly from RefCounted<> now
110         that TextureMapperBackingStore doesn't anymore.
111
112         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
113         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
114         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded):
115
116 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
117
118         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
119         https://bugs.webkit.org/show_bug.cgi?id=184811
120
121         Reviewed by Carlos Garcia Campos.
122
123         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
124         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Stop setting
125         the removed contentsSize and coveredRect attributes. These were only
126         ever set to the appropriate values, but were then never used anywhere.
127
128 2018-04-22  Matt Baker  <mattbaker@apple.com>
129
130         Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
131         https://bugs.webkit.org/show_bug.cgi?id=184865
132         <rdar://problem/37764960>
133
134         Reviewed by Brian Burg.
135
136         Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661,
137         so that WKWebInspectorProxyObjCAdapter and the view controller can be reused
138         when reopening the Inspector while the WebView is still alive.
139
140         * UIProcess/mac/WebInspectorProxyMac.mm:
141         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
142
143 2018-04-22  Paul Knight  <pknight@apple.com>
144
145         Add -[WKInputDelegate _webView:decidePolicyForFocusedElement:] so clients can request default focusing behavior
146         https://bugs.webkit.org/show_bug.cgi?id=184844
147
148         Reviewed by Dan Bernstein.
149
150         If a client doesn't implement -[_WKInputDelegate _webView:focusShouldStartInputSession:] the default
151         focus behavior only brings up the keyboard if it's already onscreen, the interaction is user driven,
152         and other factors that even depend on what feature flags are enabled.
153
154         If a client implements _webView:focusShouldStartInputSession:, they don't have a good way to specifiy
155         they'd like to fall back to the default behavior. This makes it difficult for a client to use the
156         default in most cases, but sometimes allow programmatic focus from the page, for example.
157
158         Add a new delegate method -_webView:decidePolicyForFocusedElement: that returns a new enum type
159         _WKFocusStartsInputSessionPolicy. Clients can return _WKFocusStartsInputSessionPolicyAuto to request
160         the default behavior, or _WKFocusStartsInputSessionPolicyAllow / Disallow to directly control whether
161         the keyboard appears to assist the focused node.
162
163         * UIProcess/API/Cocoa/_WKInputDelegate.h:
164         * UIProcess/ios/WKContentViewInteraction.mm:
165         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
166
167 2018-04-21  Jeremy Jones  <jeremyj@apple.com>
168
169         Disable backward and forward navigation swipes while in fullscreen.
170         https://bugs.webkit.org/show_bug.cgi?id=184656
171         rdar://problem/36057535
172
173         Reviewed by Tim Horton.
174
175         Disable navigation swipes while in fullscreen.
176
177         * UIProcess/Cocoa/ViewGestureController.cpp:
178         (WebKit::ViewGestureController::canSwipeInDirection const):
179
180 2018-04-21  Youenn Fablet  <youenn@apple.com>
181
182         Activate NetworkLoadChecker for media loads
183         https://bugs.webkit.org/show_bug.cgi?id=184841
184
185         Reviewed by Eric Carlson.
186
187         Instantiate a NetworkLoadChecker for NetworkResourceLoader for audio/video loads.
188
189         Move CORS checks for response after handling of 304 checks.
190         For 304 checks, we need to do the CORS checks on the validated cached response, not the 304 received response.
191
192         Updated ResourceError argument coder to explicitly pass the error type
193         as some errors created by NetworkLoadChecker would otherwise be received as General errors by WebProcess.
194         Updated platform data encoding of ResourceError accordingly.
195
196         All changes are covered by regular media loading layout tests.
197
198         * NetworkProcess/NetworkResourceLoader.cpp:
199         (WebKit::shouldUseNetworkLoadChecker):
200         (WebKit::NetworkResourceLoader::didReceiveResponse):
201         * Shared/WebCoreArgumentCoders.cpp:
202         (IPC::ArgumentCoder<ResourceError>::encode):
203         (IPC::ArgumentCoder<ResourceError>::decode):
204         * Shared/mac/WebCoreArgumentCodersMac.mm:
205         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
206         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
207         We need to set the type after decoding the NSError as ResourceError tries to guess the type from NSError data.
208         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
209         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
210         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
211
212 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
213
214         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
215         https://bugs.webkit.org/show_bug.cgi?id=184480
216
217         Reviewed by Michael Catanzaro.
218
219         Connect to GTlsConnection::accept-certificate signal instead of SoupMessage::notify::tls-errors to perform the
220         TLS errors check.
221
222         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
223         (WebKit::NetworkDataTaskSoup::createRequest): Do not connect to SoupMessage::notify::tls-errors.
224         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): Call tlsConnectionAcceptCertificate() is
225         the task is still ongoing.
226         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Check TLS errors here.
227         (WebKit::NetworkDataTaskSoup::networkEventCallback): Pass the stream to networkEvent.
228         (WebKit::NetworkDataTaskSoup::networkEvent): Connect to GTlsConnection::accept-certificate.
229         * NetworkProcess/soup/NetworkDataTaskSoup.h:
230
231 2018-04-20  Timothy Hatcher  <timothy@apple.com>
232
233         NULL dereference crash sometimes under [super initWithCoder:] in WebView
234
235         https://bugs.webkit.org/show_bug.cgi?id=184851
236         rdar://problem/39611236
237
238         Reviewed by Tim Horton.
239
240         * UIProcess/API/Cocoa/WKWebView.mm:
241         (-[WKWebView _initializeWithConfiguration:]):
242         (-[WKWebView effectiveAppearanceDidChange]):
243         Added a null check and call the code later in initialization.
244
245 2018-04-20  Tim Horton  <timothy_horton@apple.com>
246
247         Adjust geolocation feature flag
248         https://bugs.webkit.org/show_bug.cgi?id=184856
249
250         Reviewed by Wenson Hsieh.
251
252         * Configurations/FeatureDefines.xcconfig:
253
254 2018-04-20  Chris Dumez  <cdumez@apple.com>
255
256         Unreviewed attempt to fix GTK build after r230867.
257
258         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
259         (webkit_dom_dom_window_get_self):
260         (webkit_dom_dom_window_get_window):
261         (webkit_dom_dom_window_get_frames):
262         (webkit_dom_dom_window_get_opener):
263         (webkit_dom_dom_window_get_parent):
264         (webkit_dom_dom_window_get_top):
265
266 2018-04-20  Commit Queue  <commit-queue@webkit.org>
267
268         Unreviewed, rolling out r230873.
269         https://bugs.webkit.org/show_bug.cgi?id=184857
270
271         Broke the iOS build (Requested by cdumez on #webkit).
272
273         Reverted changeset:
274
275         "Disable backward and forward navigation swipes while in
276         fullscreen."
277         https://bugs.webkit.org/show_bug.cgi?id=184656
278         https://trac.webkit.org/changeset/230873
279
280 2018-04-20  Chris Dumez  <cdumez@apple.com>
281
282         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
283         https://bugs.webkit.org/show_bug.cgi?id=184210
284         <rdar://problem/39072354>
285
286         Reviewed by Wenson Hsieh.
287
288         r229828 tried to have some API tests happy on iOS by freezing the layer tree
289         during the navigation policy decision. However, this is observable by the client
290         application and a regression from when the policy delegate was synchronous.
291
292         To address the issue, this patch reverts r229828 and instead updates the iOS
293         API tests to wait for the next presentation update after navigating
294         before interacting with the view.
295
296         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
297         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
298         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
299         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
300         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
301         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
302         * WebProcess/WebPage/WebPage.cpp:
303         * WebProcess/WebPage/WebPage.h:
304
305 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
306
307         Limit cookie header access to Network process
308         https://bugs.webkit.org/show_bug.cgi?id=184764
309         <rdar://problem/36785285>
310
311         Reviewed by Youenn Fablet.
312
313         Revise the handling of cookie request headers so that we don't interact with them in the
314         WebContent process. They are only needed for interaction with the server and the network
315         process, so we should limit their scope to just the Network process.
316
317         Instead, we should handle a token that represents the cookie headers in the WebContent
318         process, which can be converted to the relevant cookie data in the network process when
319         needed.
320
321         * NetworkProcess/NetworkSocketStream.cpp:
322         (WebKit::NetworkSocketStream::sendHandshake):
323         * NetworkProcess/NetworkSocketStream.h:
324         * NetworkProcess/NetworkSocketStream.messages.in:
325         * WebProcess/Network/WebSocketStream.cpp:
326         (WebKit::WebSocketStream::networkProcessCrashed):
327         (WebKit::WebSocketStream::platformSendHandshake):
328         (WebKit::WebSocketStream::didSendHandshake):
329         * WebProcess/Network/WebSocketStream.h:
330         * WebProcess/Network/WebSocketStream.messages.in:
331
332 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
333
334         Disable backward and forward navigation swipes while in fullscreen.
335         https://bugs.webkit.org/show_bug.cgi?id=184656
336         rdar://problem/36057535
337
338         Reviewed by Tim Horton.
339
340         Disable navigation swipes while in fullscreen.
341
342         * UIProcess/Cocoa/ViewGestureController.cpp:
343         (WebKit::ViewGestureController::canSwipeInDirection const):
344
345 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
346
347         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
348         https://bugs.webkit.org/show_bug.cgi?id=184826
349         rdar://problem/39600825
350
351         Reviewed by Tim Horton.
352
353         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
354
355         * UIProcess/API/Cocoa/WKWebView.mm:
356         (-[WKWebView _fullScreenPlaceholderView]):
357         (-[WKWebView closeFullScreenWindowController]):
358         (-[WKWebView fullScreenPlaceholderView]): Deleted.
359         * UIProcess/API/Cocoa/WKWebViewInternal.h:
360         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
361         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
362         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
363         (-[WKFullScreenWindowController webViewPlaceholder]):
364
365 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
366
367         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
368         https://bugs.webkit.org/show_bug.cgi?id=184822
369         <rdar://problem/38807319>
370
371         Reviewed by Tim Horton.
372
373         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
374         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
375         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
376
377         * UIProcess/API/Cocoa/WKWebView.mm:
378         (-[WKWebView _simulateTextEntered:]):
379         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
380
381         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
382         SPI added in 2017 to help test drag and drop for iOS 11.
383
384         * UIProcess/ios/WKContentViewInteraction.h:
385         * UIProcess/ios/WKContentViewInteraction.mm:
386         (-[WKContentView _simulateTextEntered:]):
387         * WebProcess/WebPage/WebPage.cpp:
388         (WebKit::WebPage::setTextAsync):
389
390 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
391
392         EnterFullscreen must update the minimum and maximum layout sizes.
393         https://bugs.webkit.org/show_bug.cgi?id=184828
394         rdar://problem/38435829
395
396         Reviewed by Jon Lee.
397
398         Without this, the WKWebView won't layout to the full size in fullscreen mode.
399
400         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
401         (-[WKFullScreenWindowController enterFullScreen]):
402
403 2018-04-18  Jer Noble  <jer.noble@apple.com>
404
405         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
406         https://bugs.webkit.org/show_bug.cgi?id=184762
407
408         Reviewed by Dan Bernstein.
409
410         * Configurations/BaseTarget.xcconfig:
411
412 2018-04-20  Youenn Fablet  <youenn@apple.com>
413
414         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
415         https://bugs.webkit.org/show_bug.cgi?id=184755
416
417         Reviewed by Chris Dumez.
418
419         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
420         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
421
422         Since we call didFail asynchronously to make sync/async handling more consistent,
423         We need to keep track of whether we will do clean-up twice.
424         A boolean is added for that purpose in NetworkResourceLoader.
425
426         There is a small change of behavior in the way we return an error.
427         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
428         This allows getting some more error logging in the JS console.
429
430         * NetworkProcess/NetworkResourceLoader.cpp:
431         (WebKit::NetworkResourceLoader::didReceiveResponse):
432         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
433         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
434         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
435         * NetworkProcess/NetworkResourceLoader.h:
436
437 2018-04-20  Timothy Hatcher  <timothy@apple.com>
438
439         Include missing files in WKContentViewInteraction.{mm,h}
440
441         https://bugs.webkit.org/show_bug.cgi?id=184832
442         rdar://problem/35377120
443
444         Reviewed by Wenson Hsieh.
445
446         Some WebDriver files were missing and should be included.
447
448         * UIProcess/ios/WKContentViewInteraction.h:
449         * UIProcess/ios/WKContentViewInteraction.mm:
450         (-[WKContentView setupInteraction]):
451         (-[WKContentView cleanupInteraction]):
452         (-[WKContentView _removeDefaultGestureRecognizers]):
453         (-[WKContentView _addDefaultGestureRecognizers]):
454
455 2018-04-20  Youenn Fablet  <youenn@apple.com>
456
457         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
458         https://bugs.webkit.org/show_bug.cgi?id=184369
459
460         Reviewed by Chris Dumez.
461
462         Use API to check for plugin availability for response at navigation time.
463
464         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
465         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
466         * WebProcess/WebPage/WebPage.cpp:
467         (WebKit::WebPage::canShowResponse const):
468         (WebKit::WebPage::canShowMIMEType const):
469         * WebProcess/WebPage/WebPage.h:
470
471 2018-04-20  Daniel Bates  <dabates@apple.com>
472
473         Remove Strong Password decoration when text field type changes
474         https://bugs.webkit.org/show_bug.cgi?id=184795
475         <rdar://problem/38325108>
476
477         Reviewed by Antti Koivisto.
478
479         Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
480         Strong Password appearance of an HTML input element is resigned.
481
482         We add C SPI for Safari on Mac.
483
484         * UIProcess/API/APIUIClient.h:
485         (API::UIClient::didResignInputElementStrongPasswordAppearance):
486         * UIProcess/API/C/WKPage.cpp:
487         (WKPageSetPageUIClient):
488         * UIProcess/API/C/WKPageUIClient.h:
489         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
490         * UIProcess/Cocoa/UIDelegate.h:
491         * UIProcess/Cocoa/UIDelegate.mm:
492         (WebKit::UIDelegate::setDelegate):
493         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
494         * UIProcess/WebPageProxy.cpp:
495         (WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
496         * UIProcess/WebPageProxy.h:
497         * UIProcess/WebPageProxy.messages.in:
498         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
499         (API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
500         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
501         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
502         (WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
503         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
504         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
505         (WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
506         * WebProcess/WebCoreSupport/WebChromeClient.h:
507
508 2018-04-20  Megan Gardner  <megan_gardner@apple.com>
509
510         Fixes for failing tests associated with switching Text Selection Assistants
511         https://bugs.webkit.org/show_bug.cgi?id=184806
512         <rdar://problem/39367905>
513
514         Reviewed by Beth Dakin and Wenson Hsieh.
515         
516         The major fix is the disabling the double tap noneditable text selection gesture.
517         The other fixes are small tweaks that shouldn't even be run into with the fix to 
518         the double tap gesture, but they are incorrect, so I am taking the opportunity to 
519         fix them now, in case we run into them again.
520
521         * UIProcess/ios/WKContentViewInteraction.mm:
522         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
523         We should not be allowing a double tap text gestures in non-editable web content.
524         We didn't have one with the old assistant. Fortunately, this is easily disabled.
525         (-[WKContentView canPerformActionForWebView:withSender:]):
526         We should not allow the lookup action if we do not actually have a selection.
527         It is meaningless without one.
528         (-[WKContentView selectedTextRange]):
529         We should not return a selection to UIKit if all we have is caret selection
530         in non-editable content. We have this for selections on Mac, but UIKit does
531         not know how to properly handle this, and will have incorrect behavior if we 
532         return a valid selection.
533
534 2018-04-20  Timothy Hatcher  <timothy@apple.com>
535
536         WebEvent fails to convert synthetic WebMouseEvent for automation
537
538         https://bugs.webkit.org/show_bug.cgi?id=184824
539         rdar://problem/35377120
540
541         Reviewed by Brian Burg.
542
543         Add WebEvent conversions that existed in PlatformEventFactoryIOS for legacy WebKit,
544         but never got added in WebIOSEventFactory and NativeWebMouseEvent for modern WebKit.
545         This affected WebDriver, and some events not being deliverd to the page.
546
547         * Shared/NativeWebMouseEvent.h:
548         (WebKit::NativeWebMouseEvent::nativeEvent const):
549         * Shared/ios/NativeWebMouseEventIOS.mm: Added.
550         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
551         * Shared/ios/WebIOSEventFactory.h:
552         * Shared/ios/WebIOSEventFactory.mm:
553         (WebIOSEventFactory::createWebMouseEvent):
554         * WebKit.xcodeproj/project.pbxproj:
555
556 2018-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
557
558         Unreviewed, fix -Wformat warning
559
560         * UIProcess/WebPageProxy.cpp:
561         (WebKit::WebPageProxy::didFinishLoadForFrame):
562
563 2018-04-20  Youenn Fablet  <youenn@apple.com>
564
565         Make PluginData cache its web visible plugins
566         https://bugs.webkit.org/show_bug.cgi?id=184421
567
568         Reviewed by Chris Dumez.
569
570         Rename methods.
571         Pass an URL instead of relying on Page URL as the page URL
572         might not always be the URL we want to check against plugins.
573         In particular when navigation is on-going, we want to check the
574         plugins against the being navigated URL.
575
576         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
577         (WebKit::WebPluginInfoProvider::pluginInfo):
578         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
579         * WebProcess/Plugins/WebPluginInfoProvider.h:
580
581 2018-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
582
583         Unreviewed. Fix GTK+ build after r230830.
584
585         Add SimulatedInputDispatcher.cpp to the build.
586
587         * CMakeLists.txt:
588
589 2018-04-19  Brady Eidson  <beidson@apple.com>
590
591         Make back forward cache work with process swapping.
592         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
593
594         Reviewed by Chris Dumez.
595
596         We previously saved old processes in "SuspendedPageProxy" objects.
597         Now we reuse them when going back or forward.
598
599         * Platform/Logging.h:
600
601         * Shared/WebBackForwardListItem.cpp:
602         (WebKit::WebBackForwardListItem::setSuspendedPage):
603         (WebKit::WebBackForwardListItem::loggingString):
604         * Shared/WebBackForwardListItem.h:
605         (WebKit::WebBackForwardListItem::suspendedPage const):
606
607         Teach Navigation objects their source WebBackForwardListItems:
608         * UIProcess/API/APINavigation.cpp:
609         (API::Navigation::Navigation):
610         (API::Navigation::loggingString const):
611         * UIProcess/API/APINavigation.h:
612         (API::Navigation::create):
613         (API::Navigation::targetItem const):
614         (API::Navigation::fromItem const):
615         (API::Navigation::backForwardListItem): Deleted.
616
617         * UIProcess/Cocoa/NavigationState.mm:
618         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
619
620         * UIProcess/SuspendedPageProxy.cpp:
621         (WebKit::messageNamesToIgnoreWhileSuspended):
622         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
623         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
624         (WebKit::SuspendedPageProxy::webProcessDidClose):
625         (WebKit::SuspendedPageProxy::didReceiveMessage):
626         (WebKit::SuspendedPageProxy::loggingString const):
627         * UIProcess/SuspendedPageProxy.h:
628         (WebKit::SuspendedPageProxy::origin const):
629
630         * UIProcess/WebBackForwardList.cpp:
631         (WebKit::WebBackForwardList::WebBackForwardList):
632         (WebKit::WebBackForwardList::~WebBackForwardList):
633         (WebKit::WebBackForwardList::pageClosed):
634         (WebKit::WebBackForwardList::addItem):
635         (WebKit::WebBackForwardList::goToItem):
636         (WebKit::WebBackForwardList::removeAllItems):
637         (WebKit::WebBackForwardList::clear):
638         (WebKit::WebBackForwardList::restoreFromState):
639         (WebKit::WebBackForwardList::filteredItemStates const):
640         (WebKit::WebBackForwardList::itemStates const):
641         (WebKit::WebBackForwardList::loggingString):
642         * UIProcess/WebBackForwardList.h:
643
644         * UIProcess/WebNavigationState.cpp:
645         (WebKit::WebNavigationState::createLoadRequestNavigation):
646         (WebKit::WebNavigationState::createBackForwardNavigation):
647         * UIProcess/WebNavigationState.h:
648
649         * UIProcess/WebPageProxy.cpp:
650         (WebKit::WebPageProxy::reattachToWebProcess):
651         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
652         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
653         (WebKit::WebPageProxy::loadRequest):
654         (WebKit::WebPageProxy::loadFile):
655         (WebKit::WebPageProxy::goToBackForwardItem):
656         (WebKit::WebPageProxy::receivedPolicyDecision):
657         (WebKit::WebPageProxy::continueNavigationInNewProcess):
658         (WebKit::WebPageProxy::didCreateMainFrame):
659         (WebKit::WebPageProxy::didCreateSubframe):
660         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
661         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
662         (WebKit::WebPageProxy::didCommitLoadForFrame):
663         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
664         (WebKit::WebPageProxy::connectionWillOpen):
665         (WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
666         * UIProcess/WebPageProxy.h:
667
668         * UIProcess/WebProcessLifetimeTracker.cpp:
669         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
670         (WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
671         * UIProcess/WebProcessLifetimeTracker.h:
672
673         * UIProcess/WebProcessPool.cpp:
674         (WebKit::WebProcessPool::processForNavigation):
675         (WebKit::WebProcessPool::registerSuspendedPageProxy):
676         (WebKit::WebProcessPool::unregisterSuspendedPageProxy):
677         * UIProcess/WebProcessPool.h:
678
679         * UIProcess/WebProcessProxy.cpp:
680         (WebKit::WebProcessProxy::suspendWebPageProxy):
681         (WebKit::WebProcessProxy::updateBackForwardItem):
682         (WebKit::WebProcessProxy::frameCreated):
683         * UIProcess/WebProcessProxy.h:
684
685         * WebProcess/WebPage/DrawingArea.h:
686         (WebKit::DrawingArea::attachDrawingArea):
687
688         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
689         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
690         (WebKit::WebBackForwardListProxy::addItem):
691         * WebProcess/WebPage/WebBackForwardListProxy.h:
692
693         * WebProcess/WebPage/WebPage.cpp:
694         (WebKit::m_credentialsMessenger):
695         (WebKit::WebPage::reinitializeWebPage):
696         (WebKit::WebPage::goToBackForwardItem):
697         (WebKit::WebPage::restoreSessionInternal):
698         (WebKit::WebPage::restoreSession):
699         (WebKit::WebPage::updateBackForwardListForReattach):
700         * WebProcess/WebPage/WebPage.h:
701         * WebProcess/WebPage/WebPage.messages.in:
702
703         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
704         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
705         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
706         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
707           area from a resumed WebProcess to the UIProcess (to make the page cache work)
708
709 2018-04-19  Brian Burg  <bburg@apple.com>
710
711         Web Automation: add support for mouse/keyboard interaction sequences
712         https://bugs.webkit.org/show_bug.cgi?id=184603
713         <rdar://problem/39421839>
714
715         Reviewed by Timothy Hatcher.
716
717         Add new protocol methods and WebKit support for implementing the W3C Actions API.
718         This is a generic command for sending low-level mouse, key, and touch events to
719         test page behavior when performing drag-and-drop, gestures, or specific keydown/keyups.
720
721         To implement this functionality, this patch adds SimulatedInputDispatcher, a class
722         for dispatching input events asynchronously. Similar to the WebDriver specification,
723         this is designed as a keyframing API. Callers set up several "input sources" such
724         as keyboard or mouse, and then specify the states of that input source over time. The
725         dispatcher calculates diffs between the previous and current keyframes and generates
726         the appropriate events that would happen if a user caused the state transition.
727
728         For example, if a mouse input source's state changes, the dispatcher sends synthetic mousemove,
729         mousedown, or mouseup events depending on the pre- and post-state. This is uninteresting
730         and overcomplicated for simple key and mouse presses, but it's really designed with an
731         eye towards supporting mousemove interpolation and touch event interpolation in later patches.
732
733         The strategy for dispatching events depends on the input source type; right now, these
734         map directly to the existing platformSimulate{Mouse, Keyboard}Interaction methods. In
735         the future, the dispatch strategy may be elaborated for interpolated mousemove events.
736
737         This patch depends on support added in bug 184462.
738
739         No tests yet. When this command is hooked up to a driver, the code will be exercised by
740         W3C actions test suite, which is fairly complex at this point relative to end-user code.
741
742         * UIProcess/Automation/Automation.json: Add new types and commands.
743
744         * UIProcess/Automation/SimulatedInputDispatcher.h: Added.
745         (WebKit::SimulatedInputSourceState::emptyState):
746         (WebKit::SimulatedInputSource::create):
747         (WebKit::SimulatedInputSource::SimulatedInputSource):
748         (WebKit::SimulatedInputDispatcher::Client::~Client):
749         Add structs for input source, source state, and keyframe.
750         The dispatcher's client interface is implemented by WebAutomationSession.
751
752         (WebKit::SimulatedInputDispatcher::create):
753         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Added.
754         (WebKit::SimulatedInputKeyFrame::SimulatedInputKeyFrame):
755         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
756         (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources):
757         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
758         (WebKit::SimulatedInputDispatcher::SimulatedInputDispatcher):
759         (WebKit::SimulatedInputDispatcher::~SimulatedInputDispatcher):
760         (WebKit::SimulatedInputDispatcher::isActive const):
761         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
762         (WebKit::SimulatedInputDispatcher::isKeyFrameTransitionComplete const):
763         (WebKit::SimulatedInputDispatcher::transitionToNextKeyFrame):
764         (WebKit::SimulatedInputDispatcher::transitionToNextInputSourceState):
765         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
766         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
767         (WebKit::SimulatedInputDispatcher::run):
768         (WebKit::SimulatedInputDispatcher::cancel):
769         (WebKit::SimulatedInputDispatcher::finishDispatching):
770         The dispatcher handles one interaction at a time. The interaction is described
771         by an array of keyframes, and each keyframe has an array of states. The dispatcher
772         transitions between keyframes by sequentially and asynchronously emitting events
773         that cause each input source state to transition as desired. Keyframe transitions
774         are additionally gated by a "maximum duration" timer. Each step that the dispatcher
775         executes is asynchronous, so the dispatcher keeps most state in members and uses
776         error argument lambdas as completion handlers for various async things.
777
778         * UIProcess/Automation/WebAutomationSession.h:
779         * UIProcess/Automation/WebAutomationSession.cpp:
780         (WebKit::WebAutomationSession::WebAutomationSession):
781         (WebKit::WebAutomationSession::inputDispatcherForPage):
782         (WebKit::WebAutomationSession::inputSourceForType const):
783         Add canonical input sources that are used to keep track of state across
784         interaction sequences.
785
786         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
787         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
788         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
789         Remove m_simulatingUserInteraction since it can be computed based on other members.
790
791         (WebKit::WebAutomationSession::willClosePage):
792         If the page is being torn down, stop the dispatcher if needed and cancel any
793         callbacks waiting for mouse/key events to be retired.
794
795         (WebKit::WebAutomationSession::simulateMouseInteraction):
796         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
797         Add easy-to-use async methods for simulating mouse and key events. These are
798         hooked up to SimulatedInputDispatcher using async completion handlers.
799
800         (WebKit::protocolMouseButtonToWebMouseEventButton):
801         (WebKit::WebAutomationSession::performMouseInteraction):
802         (WebKit::WebAutomationSession::performKeyboardInteractions):
803         Adjust some naming.
804
805         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
806         (WebKit::WebAutomationSession::performInteractionSequence):
807         (WebKit::WebAutomationSession::cancelInteractionSequence):
808         Add command handlers for the new action commands in Automation protocol.
809
810         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
811         (WebKit::mouseButtonToGdkButton):
812         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
813         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
814         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
815         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
816         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
817         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
818         Rename the keyboard platform method to match the naming of the mouse platform method.
819         Take advantage of the 'using' alias to make the tedious switches easier to read.
820
821         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
822         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
823         (WebKit::virtualKeyHasStickyModifier):
824         (WebKit::keyCodeForVirtualKey):
825         (WebKit::eventModifierFlagsForVirtualKey):
826         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
827         (WebKit::WebAutomationSession::platformSimulateKeySequence):
828         (WebKit::keyHasStickyModifier): Deleted.
829         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
830         Allow the keyboard simulation method to take a virtual key and unichar to better
831         match how this is used by the Perform Actions command and its machinery.
832
833         * WebKit.xcodeproj/project.pbxproj:
834
835 2018-04-19  Jiewen Tan  <jiewen_tan@apple.com>
836
837         Remove access to keychain from the WebContent process
838         https://bugs.webkit.org/show_bug.cgi?id=184428
839         <rdar://problem/13150903>
840
841         Reviewed by Brent Fulgham.
842
843         Part 1.
844
845         Remove com.apple.identities from WebContent-iOS.entitlements, which is needed to encode/decode NSError’s userInfo[NSErrorClientCertificateChainKey]
846         when the corresponding NSErorr is relayed through WebContent Process from Networking Process to UI Process after a HTTPS client certificate
847         authentication is rejected becuase of bad certificates. This patch implements corresponding workarounds as well. The workaround works for mac, too.
848
849         Sadly, this change can only be tested manually at this moment. Please refer to the radar for testing steps.
850
851         * Configurations/WebContent-iOS.entitlements:
852         * Shared/mac/WebCoreArgumentCodersMac.mm:
853         (IPC::encodeNSError):
854         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
855         (WebKit::WebProcessPool::platformInitialize):
856
857 2018-04-19  David Kilzer  <ddkilzer@apple.com>
858
859         Enable Objective-C weak references
860         <https://webkit.org/b/184789>
861         <rdar://problem/39571716>
862
863         Reviewed by Dan Bernstein.
864
865         * Configurations/Base.xcconfig:
866         (CLANG_ENABLE_OBJC_WEAK): Enable.
867
868 2018-04-19  Youenn Fablet  <youenn@apple.com>
869
870         Web Inspector backend should get headers & cookies from network process separately from resource requests
871         https://bugs.webkit.org/show_bug.cgi?id=184396
872         <rdar://problem/38877384>
873
874         Reviewed by Brian Burg.
875
876         Add support for storing response and network metrics for every resource load.
877         This is made conditional on inspector being activated.
878         NetworkConnectionToWebProcess keeps a response and network metrics for every load.
879         This is cleared when inspector is going away or when a web process requests
880         the data.
881
882         WebLoaderStrategy gets this data through synchronous IPC.
883         Synchronous IPC is a temporary implementation until Inspector code gets refactored.
884
885         Updated WebLoaderStrategy to pass the sourceOrigin for every NetworkResourceLoader.
886         This activates additional sanitization based on cross origin status.
887
888         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
889         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
890         * NetworkProcess/NetworkConnectionToWebProcess.h:
891         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationResponse):
892         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
893         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationResponse):
894         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
895         (WebKit::NetworkConnectionToWebProcess::removeNetworkLoadInformation):
896         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
897         * NetworkProcess/NetworkResourceLoader.cpp:
898         (WebKit::NetworkResourceLoader::didReceiveResponse):
899         (WebKit::NetworkResourceLoader::didFinishLoading):
900         (WebKit::NetworkResourceLoader::didFailLoading):
901         * WebProcess/Network/WebLoaderStrategy.cpp:
902         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
903         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
904         * WebProcess/Network/WebLoaderStrategy.h:
905         * WebProcess/Network/WebResourceLoader.cpp:
906         (WebKit::WebResourceLoader::didReceiveResponse):
907
908 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
909
910         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
911         https://bugs.webkit.org/show_bug.cgi?id=184782
912         <rdar://problem/38346712>
913
914         Reviewed by Tim Horton.
915
916         In extra zoom mode, at initial scale, fixed position elements may take up a large portion of the viewport. This
917         leaves little room for non-fixed-position elements; to improve this experience, we introduce a mechanism to
918         extend the height of the layout viewport. By default, the layout viewport size is determined by the FrameView's
919         baseLayoutViewportSize, and passed into FrameView::computeUpdatedLayoutViewportRect in the client layer; in
920         extra zoom mode, if the layout viewport is shorter than the document width, we try to double the height of the
921         layout viewport and clamp to the document height if necessary.
922
923         * Shared/WebPreferences.yaml:
924
925         Add a new preference to determine the factor by which we should expand the height of the layout viewport. By
926         default, this is 0 (no increase in layout viewport height); in extra zoom mode, this is 1, which means we'll
927         increase the layout viewport's height by 1x the default height.
928
929         * Shared/WebPreferencesDefaultValues.h:
930         * UIProcess/API/Cocoa/WKWebView.mm:
931         (-[WKWebView activeMinimumLayoutSizes:]):
932
933         Fixes a bug when computing the active minimum layout size. If a minimum allowed layout width is specified, we
934         clamp the active layout width (normally the view size) so that it is no less than the minimum allowed layout
935         width. However, the height is currently unaffected, which causes FrameView::baseLayoutViewportSize to return a
936         bogus size, where the width is scaled to 320px but the height isn't. Instead, we should scale the layout height
937         to match the new width here.
938
939         * UIProcess/ios/WebPageProxyIOS.mm:
940         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
941
942         Expand the base viewport layout size if necessary, given the expansion factor in WebPreferences.
943
944         * WebProcess/WebPage/WebPage.cpp:
945         (WebKit::WebPage::updatePreferences):
946         * WebProcess/WebPage/ios/WebPageIOS.mm:
947         (WebKit::WebPage::dynamicViewportSizeUpdate):
948
949         Expand the base viewport layout size if necessary, given the expansion factor in Settings.
950
951 2018-04-19  Brian Burg  <bburg@apple.com>
952
953         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
954         https://bugs.webkit.org/show_bug.cgi?id=184462
955         <rdar://problem/39323336>
956
957         Reviewed by Carlos Garcia Campos and Tim Horton.
958
959         Covered by existing layout tests and actions endpoints in WebDriver test suite.
960
961         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
962         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
963         to dispatch more simulated events.
964
965         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
966         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
967         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
968         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
969         also be more than one mouse event waiting to be handled by WebProcess.
970
971         In the past, these queued mouse events were tracked with several member variables as different
972         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
973         checking the queue length.
974
975         * Platform/Logging.h: Add logging channel for mouse events.
976         * UIProcess/Automation/WebAutomationSession.cpp:
977         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
978         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
979         the convenience constructors and .toProtocolString() method.
980
981         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
982         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
983         prior to returning from the command, we need to abort any key event callbacks that are pending if an
984         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
985         be handled when the alert is dismissed and the nested run loop exits.
986
987         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
988         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
989         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
990         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
991
992         (WebKit::WebAutomationSession::performMouseInteraction):
993         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
994         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
995         so we also need to handle the case where there is nothing to be waited on because hit testing did
996         not return a target to deliver the event to.
997
998         (WebKit::WebAutomationSession::performKeyboardInteractions):
999         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
1000         event waiting/handling code. Now it matches the types used for the mouse event case.
1001
1002         * UIProcess/Automation/WebAutomationSession.h:
1003         (WebKit::AutomationCommandError::AutomationCommandError):
1004         Add a helper struct to hold an enumerated error name and an optional free-form error message.
1005
1006         * UIProcess/WebPageProxy.h:
1007         * UIProcess/WebPageProxy.cpp:
1008         (WebKit::webMouseEventTypeString):
1009         (WebKit::webKeyboardEventTypeString):
1010         (WebKit::WebPageProxy::handleMouseEvent):
1011         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1012         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
1013         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
1014         if there are more mouse events to be sent to WebProcess.
1015
1016         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
1017         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
1018         (WebKit::WebPageProxy::didReceiveEvent):
1019         Unify the code paths for different mouse event types to all use the deque. They also will
1020         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
1021
1022         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
1023
1024 2018-04-19  Andy Estes  <aestes@apple.com>
1025
1026         [iOS] Implement find-in-page in the new WKPDFView
1027         https://bugs.webkit.org/show_bug.cgi?id=184654
1028         <rdar://problem/39331654>
1029
1030         Reviewed by Tim Horton.
1031
1032         This is theoretically covered by existing WKPDFView API tests, but that's currently blocked
1033         by <rdar://problem/39475542>.
1034
1035         * UIProcess/ios/WKPDFView.mm:
1036         (stringCompareOptions):
1037
1038         Mapped _WKFindOptions to NSStringCompareOptions.
1039
1040         (-[WKPDFView _resetFind]):
1041
1042         Cancelled an in-progress search and reset the search state.
1043
1044         (-[WKPDFView _findString:withOptions:maxCount:completion:]):
1045
1046         Stored the completion block, find string, and max count, then called
1047         -[PDFHostViewController findString:withOptions:].
1048
1049         (-[WKPDFView web_countStringMatches:options:maxCount:]):
1050
1051         Called -_findString:withOptions:maxCount:completion: with a completion block that calls
1052         FindClient::didCountStringMatches() with _findStringCount.
1053
1054         (-[WKPDFView _computeFocusedSearchResultIndexWithOptions:didWrapAround:]):
1055
1056         Computed the focused search result index, taking _findStringCount and wrap-around into
1057         account. There are two interesting cases to mention here:
1058
1059         1. We can't change focus while a search is in progress, because we can't properly handle
1060         wrap-around without a _findStringCount. If a search is in progress, store the requested
1061         focus change in _focusedSearchResultPendingOffset, which will be applied once the search
1062         finishes.
1063
1064         2. If wrap-around is about to happen but the find options do not allow it, we need to call
1065         FindClient::didFailToFindString(). Handle this by returning NO, which will tell
1066         -_focusOnSearchResultWithOptions: to call didFailToFindString() if a search is not in
1067         progress.
1068
1069         (-[WKPDFView _focusOnSearchResultWithOptions:]):
1070
1071         If -_computeFocusedSearchResultIndexWithOptions:didWrapAround: failed while a search is in
1072         progress, just return early. Otherwise, call FindClient::didFailToFindString(). If
1073         computing the index did not fail, call -[PDFHostViewController focusOnSearchResultAtIndex:]
1074         to change focus and then call FindClient::didFindString() to inform the client.
1075
1076         (-[WKPDFView web_findString:options:maxCount:]):
1077
1078         If the find string is equal to _findString, change focus. Otherwise, start a new search.
1079
1080         (-[WKPDFView web_hideFindUI]):
1081
1082         Called -_resetFind.
1083
1084         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
1085
1086         Stored the count in _findStringCount and called _findCompletion once the search is done.
1087
1088 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
1089
1090         The InternalFunction hierarchy should be in IsoSubspaces
1091         https://bugs.webkit.org/show_bug.cgi?id=184721
1092
1093         Reviewed by Saam Barati.
1094
1095         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
1096         (WebKit::JSNPMethod::subspaceForImpl):
1097         * WebProcess/Plugins/Netscape/JSNPMethod.h:
1098         (WebKit::JSNPMethod::create): Deleted.
1099         (WebKit::JSNPMethod::npIdentifier const): Deleted.
1100         (WebKit::JSNPMethod::createStructure): Deleted.
1101         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
1102         (WebKit::JSNPObject::subspaceForImpl):
1103         * WebProcess/Plugins/Netscape/JSNPObject.h:
1104         (WebKit::JSNPObject::create): Deleted.
1105         (WebKit::JSNPObject::npObject const): Deleted.
1106         (WebKit::JSNPObject::createStructure): Deleted.
1107
1108 2018-04-19  Brady Eidson  <beidson@apple.com>
1109
1110         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
1111         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
1112
1113         Reviewed by Ryosuke Niwa.
1114
1115         With process swapping, the assumption that "back/forward items belong to a process" is invalid.
1116
1117         All HistoryItem/WebBackForwardListItems now need to be uniquely identified across all processes,
1118         no matter which process they originated from, so there will never be a collision in the UIProcess.
1119
1120         This allows us to:
1121         - Have the UIProcess to keep a single process-wide map of all WebBackForwardListItems
1122         - Get rid of the per-WebProcess WebBackForwardListItem map
1123         - Simplify a lot of WebBackForwardList(Proxy) code that no longer needs to keep that per-process
1124           map in sync
1125         - Get rid of a lot of other ancillary code
1126
1127         * Shared/SessionState.cpp:
1128         (WebKit::BackForwardListItemState::decode):
1129         * Shared/SessionState.h:
1130
1131         * Shared/WebBackForwardListItem.cpp:
1132         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
1133         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
1134         (WebKit::WebBackForwardListItem::itemForID):
1135         (WebKit::WebBackForwardListItem::highestUsedItemID): Deleted.
1136         * Shared/WebBackForwardListItem.h:
1137         (WebKit::WebBackForwardListItem::itemID const):
1138
1139         * Shared/WebPageCreationParameters.cpp:
1140         (WebKit::WebPageCreationParameters::encode const):
1141         (WebKit::WebPageCreationParameters::decode):
1142         * Shared/WebPageCreationParameters.h:
1143
1144         * UIProcess/WebBackForwardList.cpp:
1145         (WebKit::WebBackForwardList::itemForID):
1146         (WebKit::WebBackForwardList::pageClosed):
1147         (WebKit::WebBackForwardList::addItem):
1148         (WebKit::WebBackForwardList::restoreFromState):
1149         (WebKit::generateWebBackForwardItemID): Deleted.
1150         * UIProcess/WebBackForwardList.h:
1151
1152         * UIProcess/WebPageProxy.cpp:
1153         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
1154         (WebKit::WebPageProxy::initializeWebPage):
1155         (WebKit::WebPageProxy::willGoToBackForwardListItem):
1156         (WebKit::WebPageProxy::restoreFromSessionState):
1157         (WebKit::WebPageProxy::backForwardAddItem):
1158         (WebKit::WebPageProxy::backForwardGoToItem):
1159         (WebKit::WebPageProxy::backForwardItemAtIndex):
1160         (WebKit::WebPageProxy::creationParameters):
1161         (WebKit::WebPageProxy::backForwardRemovedItem):
1162         * UIProcess/WebPageProxy.h:
1163         * UIProcess/WebPageProxy.messages.in:
1164  
1165         * UIProcess/WebProcessPool.cpp: Explicitly set the UIProcess Process::Identifier so it starts
1166           at "1" and then the first child process starts at "2", etc etc.
1167
1168         * UIProcess/WebProcessProxy.cpp:
1169         (WebKit::WebProcessProxy::removeWebPage):
1170         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
1171         (WebKit::WebProcessProxy::updateBackForwardItem):
1172         (WebKit::WebProcessProxy::webBackForwardItem const): Deleted.
1173         (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Deleted.
1174         (WebKit::WebProcessProxy::removeBackForwardItem): Deleted.
1175         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Deleted.
1176         * UIProcess/WebProcessProxy.h:
1177         * UIProcess/WebProcessProxy.messages.in:
1178
1179         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1180         (WebKit::toBackForwardListItemState):
1181         (WebKit::applyFrameState):
1182         (WebKit::toHistoryItem):
1183         (WebKit::toPageState): Deleted.
1184         * WebProcess/WebCoreSupport/SessionStateConversion.h:
1185
1186         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1187         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
1188
1189         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1190         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
1191         (WebKit::WK2NotifyHistoryItemChanged):
1192         (WebKit::WebBackForwardListProxy::itemForID):
1193         (WebKit::WebBackForwardListProxy::removeItem):
1194         (WebKit::WebBackForwardListProxy::addItem): Previously this was a two-step process of adding an item
1195           to the process and then associating it with the page. Now it's just directly adding it to the page,
1196           so we don't need to call updateBackForwardItem first.
1197         (WebKit::WebBackForwardListProxy::goToItem):
1198         (WebKit::WebBackForwardListProxy::itemAtIndex):
1199         (WebKit::WebBackForwardListProxy::close):
1200         (WebKit::historyItemToIDMap): Deleted.
1201         (WebKit::generateHistoryItemID): Deleted.
1202         (WebKit::WebBackForwardListProxy::setHighestItemIDFromUIProcess): Deleted.
1203         (WebKit::updateBackForwardItem): Deleted.
1204         (WebKit::WebBackForwardListProxy::idForItem): Deleted.
1205         * WebProcess/WebPage/WebBackForwardListProxy.h:
1206
1207         * WebProcess/WebPage/WebPage.cpp:
1208         (WebKit::m_credentialsMessenger):
1209         (WebKit::WebPage::goToBackForwardItem):
1210         (WebKit::WebPage::restoreSessionInternal):
1211         (WebKit::WebPage::didRemoveBackForwardItem):
1212         * WebProcess/WebPage/WebPage.h:
1213         * WebProcess/WebPage/WebPage.messages.in:
1214
1215 2018-04-19  Youenn Fablet  <youenn@apple.com>
1216
1217         NetworkProcess should use CSP/content blockers for sync XHR
1218         https://bugs.webkit.org/show_bug.cgi?id=184760
1219
1220         Reviewed by Chris Dumez.
1221
1222         Setting CSP/ContentBlockers parameters for sync XHR loads.
1223         * NetworkProcess/NetworkResourceLoader.cpp:
1224
1225 2018-04-19  Nan Wang  <n_wang@apple.com>
1226
1227         AX: AOM: respect the accessibility setting for dispatching the accessible events
1228         https://bugs.webkit.org/show_bug.cgi?id=184619
1229
1230         Reviewed by Ryosuke Niwa.
1231
1232         Linked libAccessibility on iOS and macOS to use the platform accessibility settings
1233         for allowing dispatching the accessibility events.
1234
1235         * Configurations/WebKit.xcconfig:
1236         * UIProcess/API/Cocoa/WKWebView.mm:
1237         (-[WKWebView _initializeWithConfiguration:]):
1238         (accessibilityEventsEnabledChangedCallback):
1239         (-[WKWebView _updateAccessibilityEventsEnabled]):
1240         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1241         * UIProcess/WebPageProxy.cpp:
1242         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
1243         * UIProcess/WebPageProxy.h:
1244         * WebProcess/WebPage/WebPage.cpp:
1245         (WebKit::WebPage::updateAccessibilityEventsEnabled):
1246         * WebProcess/WebPage/WebPage.h:
1247         * WebProcess/WebPage/WebPage.messages.in:
1248
1249 2018-04-18  Chris Dumez  <cdumez@apple.com>
1250
1251         Rename WindowProxyController to WindowProxy
1252         https://bugs.webkit.org/show_bug.cgi?id=184756
1253
1254         Reviewed by Sam Weinig.
1255
1256         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
1257         needed use WindowProxyController type, which was a bit confusing.
1258
1259         * WebProcess/Plugins/PluginView.cpp:
1260         (WebKit::PluginView::windowScriptNPObject):
1261         * WebProcess/WebPage/WebPage.cpp:
1262         (WebKit::WebPage::frameBecameRemote):
1263
1264 2018-04-18  Youenn Fablet  <youenn@apple.com>
1265
1266         Allow SameOrigin credentials handling for synchronous XHR
1267         https://bugs.webkit.org/show_bug.cgi?id=184723
1268
1269         Reviewed by Alex Christensen.
1270
1271         In case of SameOrigin credentials, we need to stop the current load
1272         in case of cross origin redirection to restart a load with a different session.
1273         Covered by updated WK2 tests.
1274         Rebased WK1 tests since this is Wk1 only.
1275
1276         * NetworkProcess/NetworkResourceLoader.cpp:
1277         (WebKit::NetworkResourceLoader::startNetworkLoad):
1278         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1279         * NetworkProcess/NetworkResourceLoader.h:
1280
1281 2018-04-18  Chris Dumez  <cdumez@apple.com>
1282
1283         Set RemoteDOMWindow's initial opener
1284         https://bugs.webkit.org/show_bug.cgi?id=184716
1285
1286         Reviewed by Sam Weinig.
1287
1288         When a frame becomes remote, transfer the frame opener from the old
1289         frame to the new remote one.
1290
1291         * WebProcess/WebPage/WebPage.cpp:
1292         (WebKit::WebPage::frameBecameRemote):
1293
1294 2018-04-18  Youenn Fablet  <youenn@apple.com>
1295
1296         NetworkResourceLoader should not clean itself inside didReceiveResponse
1297         https://bugs.webkit.org/show_bug.cgi?id=184754
1298
1299         Reviewed by Chris Dumez.
1300
1301         Delay the cleanup to after the didReceiveResponse call so that NetworkLoad can terminate its work.
1302         Covered by XHR sync tests no longer crashing on GuardMalloc bots.
1303
1304         * NetworkProcess/NetworkResourceLoader.cpp:
1305         (WebKit::NetworkResourceLoader::didReceiveResponse):
1306
1307 2018-04-18  Jer Noble  <jer.noble@apple.com>
1308
1309         Fix rendering of WKRemoteView layers in the simulator
1310         https://bugs.webkit.org/show_bug.cgi?id=184752
1311
1312         Reviewed by Tim Horton.
1313
1314         * Platform/mac/LayerHostingContext.mm:
1315         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1316
1317 2018-04-18  Jer Noble  <jer.noble@apple.com>
1318
1319         Fix entitlements and sandboxing for iphoneminimalsimulator
1320         https://bugs.webkit.org/show_bug.cgi?id=184692
1321
1322         Reviewed by Tim Horton.
1323
1324         Use the correct implementations for ChildProcess and NetworkProcess
1325         when building for iphoneminimalsimulator. Stub out imlementations
1326         which rely on methods not available in the iphoneminimalsimulator SDK.
1327
1328         * Configurations/Network-OSX.entitlements: Added.
1329         * Configurations/NetworkService.xcconfig:
1330         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1331         (WebKit::NetworkProcess::sourceApplicationAuditData const):
1332         * NetworkProcess/ios/NetworkProcessIOS.mm:
1333         * NetworkProcess/mac/NetworkProcessMac.mm:
1334         (WebKit::NetworkProcess::initializeProcessName):
1335         (WebKit::overrideSystemProxies):
1336         * Shared/ios/ChildProcessIOS.mm:
1337         (WebKit::ChildProcess::initializeSandbox):
1338         * Shared/mac/ChildProcessMac.mm:
1339         (WebKit::ChildProcess::setApplicationIsDaemon):
1340         (WebKit::enableSandboxStyleFileQuarantine):
1341         (WebKit::ChildProcess::initializeSandbox):
1342         (WebKit::ChildProcess::platformStopRunLoop):
1343         * Shared/mac/CodeSigning.mm:
1344         * WebKit.xcodeproj/project.pbxproj:
1345         * WebProcess/cocoa/WebProcessCocoa.mm:
1346         (WebKit::WebProcess::initializeSandbox):
1347
1348 2018-04-18  Commit Queue  <commit-queue@webkit.org>
1349
1350         Unreviewed, rolling out r230743.
1351         https://bugs.webkit.org/show_bug.cgi?id=184747
1352
1353         causes mouse clicks to not work on some platforms (Requested
1354         by brrian on #webkit).
1355
1356         Reverted changeset:
1357
1358         "Web Automation: simulated mouse interactions should not be
1359         done until associated DOM events have been dispatched"
1360         https://bugs.webkit.org/show_bug.cgi?id=184462
1361         https://trac.webkit.org/changeset/230743
1362
1363 2018-04-18  Brent Fulgham  <bfulgham@apple.com>
1364
1365         Avoid crash if ITP Debug mode is on, but ResourceLoadStatistics are not being used
1366         https://bugs.webkit.org/show_bug.cgi?id=184739
1367         <rdar://problem/39287964>
1368
1369         Reviewed by David Kilzer.
1370
1371         If a user has the ResourceLoadStatistics logic turned off, but has the ITP Debug experimental
1372         flag turned on, you can cause a crash.
1373
1374         This is because the WebsiteDataStore for the process doesn't bother creating a ResourceLoadStatisticsStore
1375         if the statistics machinery is not running. The ITP debug flag was being blindly set without checking
1376         if the statistics store exists or not, which can cause a crash.
1377
1378         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1379         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): Check if the statistics store exists
1380         before calling functions on it.
1381
1382 2018-04-18  Paul Knight  <pknight@apple.com>
1383
1384         Add -[_WKInputDelegateDelegate willStartInputSession:] for clients that want to configure input session before assisting form node
1385         https://bugs.webkit.org/show_bug.cgi?id=184662
1386
1387         Reviewed by Beth Dakin.
1388
1389         Clients may wish to configure a WKInputSession before we start assisting
1390         a node. Add a -[_WKInputDelegateDelegate _webView:willStartInputSession:]
1391         callback.
1392
1393         For example, clients that wish to present a custom input view will want
1394         to configure the WKFormInputSession's customInputView before the
1395         keyboard is presented. Otherwise the standard keyboard will begin to
1396         animate and then the custom input view will swap in later.
1397
1398         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1399         * UIProcess/ios/WKContentViewInteraction.mm:
1400         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1401             Call -_webView:willStartInputSession: before assisting the node.
1402             Only create the form session if the delegate implements either
1403             the willStart or didStartInputSession callbacks.
1404
1405 2018-04-18  Chris Dumez  <cdumez@apple.com>
1406
1407         Add support for converting a local window to a remote window
1408         https://bugs.webkit.org/show_bug.cgi?id=184515
1409         <rdar://problem/39011318>
1410
1411         Reviewed by Ryosuke Niwa.
1412
1413         Add initial support for process-swapping when navigating cross-origin as a result
1414         of a window.open(). The window object returned by window.open() is initially same
1415         origin and is for about:blank. The navigation cross-origin then happens and the
1416         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
1417         hosted in another WebProcess).
1418
1419         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
1420         exceptions due to our incomplete implementation (e.g. w.location returns null) and
1421         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
1422         in a follow-up by relying on IPC.
1423
1424         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1425         (API::ProcessPoolConfiguration::copy):
1426         * UIProcess/API/APIProcessPoolConfiguration.h:
1427         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1428         (WKContextConfigurationProcessSwapsOnWindowOpenWithOpener):
1429         (WKContextConfigurationSetProcessSwapsOnWindowOpenWithOpener):
1430         * UIProcess/API/C/WKContextConfigurationRef.h:
1431         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1432         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1433         (-[_WKProcessPoolConfiguration setProcessSwapsOnWindowOpenWithOpener:]):
1434         (-[_WKProcessPoolConfiguration processSwapsOnWindowOpenWithOpener]):
1435         Add ProcessPool configuration flag to turn on processSwap on window.open(), even
1436         if there is an opener.
1437
1438         * UIProcess/WebPageProxy.cpp:
1439         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1440         If the navigation was triggered via window.open(), then set up on handler for when
1441         a DOMWindow is constructed for the main frame in the new process.
1442
1443         (WebKit::WebPageProxy::didCreateWindow):
1444         When a Window is constructed for the main frame in a new process on process swap,
1445         notify the old process that its representation of the window should become remote
1446         and provide it with the Frame / Window identifiers it needs.
1447
1448         * UIProcess/WebPageProxy.h:
1449         * UIProcess/WebPageProxy.messages.in:
1450
1451         * UIProcess/WebProcessPool.cpp:
1452         (WebKit::WebProcessPool::processForNavigation):
1453         Do process swapping on cross-origin window.open() if the corresponding setting is
1454         enabled.
1455
1456         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1457         (WebKit::WebFrameLoaderClient::didCreateWindow):
1458         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1459
1460         * WebProcess/WebPage/WebPage.cpp:
1461         (WebKit::WebPage::frameBecameRemote):
1462         This is called when process swapping has happened due to a window.open() navigation
1463         cross-origin, when a Frame / Window has been constructed in the new process. We do
1464         the following:
1465         - Construct a RemoteFrame / RemoteWindow using the provided global identifiers to
1466           represent the Frame / Window in the new process.
1467         - We transfer the WindowProxies from the old Frame's WindowProxyController to the
1468           new RemoteFrame's WindowProxyController.
1469         - We update the window proxied by those WindowProxies to be the new RemoteWindow.
1470         - We detach the old Frame as it is now remote and represented by the new RemoteFrame
1471           object we constructed.
1472         - If the old frame was the main frame (always the case currently), we close the page
1473           as it is no longer needed. The new RemoteFrame is currently owned by the RemoteWindow
1474           which is kept alive by its JS wrappers.
1475
1476         * WebProcess/WebPage/WebPage.h:
1477         * WebProcess/WebPage/WebPage.messages.in:
1478
1479 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1480
1481         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.1 release.
1482
1483         * gtk/NEWS: Add release notes for 2.21.1.
1484
1485 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1486
1487         Unreviewed. Remove symbols from webkitglib-symbols.map.
1488
1489         Remove symbols not present in WebKit.
1490
1491         * webkitglib-symbols.map:
1492
1493 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1494
1495         Unreviewed. Add missing symbols to webkitglib-symbols.map.
1496
1497         Add symbols global in JSC and present in WebKit.
1498
1499         * webkitglib-symbols.map:
1500
1501 2018-04-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1502
1503         [Win][WebKit] Implement InjectedBundleWin.cpp
1504         https://bugs.webkit.org/show_bug.cgi?id=184525
1505
1506         Reviewed by Konstantin Tokarev.
1507
1508         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
1509         (WebKit::InjectedBundle::initialize):
1510
1511 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1512
1513         [Extra zoom mode] Programmatically changing focus when an element already has focus is a confusing experience
1514         https://bugs.webkit.org/show_bug.cgi?id=184635
1515         <rdar://problem/39440642>
1516
1517         Reviewed by Tim Horton.
1518
1519         Currently on iOS, we allow element focus to present UI if the keyboard is already shown. In extra zoom mode,
1520         this would lead to a confusing experience when the focus form control overlay is disabled, since fullscreen
1521         input view controllers are swapped out from underneath the user. Currently, this also puts the UI process into a
1522         bad state where the focused form control overlay is active, but still hidden. This patch makes some tweaks to
1523         input view controller handling in the UI process to address these issues, and also adds WebKitTestRunner support
1524         for simulating interactions with select menus in extra zoom mode. See comments below for more detail.
1525
1526         Test: fast/events/extrazoom/change-focus-during-change-event.html
1527
1528         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1529
1530         Add new SPI delegate hooks to notify the UI delegate when view controllers are presented or dismissed in extra
1531         zoom mode. See -presentViewControllerForCurrentAssistedNode and -dismissAllInputViewControllers.
1532
1533         * UIProcess/WebProcessProxy.cpp:
1534         (WebKit::WebProcessProxy::takeBackgroundActivityTokenForFullscreenInput):
1535         (WebKit::WebProcessProxy::releaseBackgroundActivityTokenForFullscreenInput):
1536
1537         See the comment below -dismissAllInputViewControllers.
1538
1539         * UIProcess/WebProcessProxy.h:
1540         * UIProcess/ios/WKContentViewInteraction.mm:
1541         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1542
1543         In extra zoom mode, when changing focus from one assisted node to another, only allow the second node to be
1544         assisted if the focused form control overlay is being shown. Otherwise, (i.e. when a fullscreen input view
1545         controller is being presented), don't allow focus to start an input session.
1546
1547         Additionally, make a minor tweak to allow the previous node to blur, even if we are not showing the keyboard for
1548         the new focused element. Without this adjustment, in the case where the page has programmatically focused
1549         another element while a fullscreen input view controller is presented, we'll show the old view controller for
1550         the new focused element.
1551
1552         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1553         (-[WKContentView dismissAllInputViewControllers:]):
1554
1555         Currently, when a fullscreen input view controller is presented, the web process gets backgrounded. This
1556         prevents event handlers from executing, which leads to strange behaviors in many cases (for instance: if we
1557         have a multiple select, and the "change" event handler blurs the select, the user may check or uncheck multiple
1558         items, but only the first change will actually take effect).
1559
1560         To fix this, we maintain a background activity token while presenting an input view controller.
1561
1562         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
1563
1564         Start hiding the focused form overlay when re-presenting an input view controller. This allows us to bail from
1565         showing fullscreen input UI for another focused element if focus programmatically changes while the current
1566         fullscreen input view controller is presented, due to the -isHidden check in -_startAssistingNode:.
1567
1568         (-[WKContentView selectFormAccessoryPickerRow:]):
1569
1570         Simulate tapping a given row in select menu UI in extra zoom mode.
1571
1572 2018-04-17  Conrad Shultz  <conrad_shultz@apple.com>
1573
1574         WebKit::DisplayLink maintains a strong reference to WebPageProxy, creating a reference cycle
1575         https://bugs.webkit.org/show_bug.cgi?id=184718
1576
1577         Reviewed by Tim Horton.
1578
1579         It turns out that the m_webPageProxy back-reference in DisplayLink, which was creating a
1580         reference cycle, wasn't ever read, so we can just remove it.
1581
1582         * UIProcess/mac/DisplayLink.cpp:
1583         (WebKit::DisplayLink::DisplayLink):
1584         * UIProcess/mac/DisplayLink.h:
1585
1586 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1587
1588         [Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode
1589         https://bugs.webkit.org/show_bug.cgi?id=184631
1590         <rdar://problem/39303706>
1591
1592         Reviewed by Tim Horton.
1593
1594         Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up
1595         to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally
1596         represents a character.
1597
1598         The first and second text legibility zoom scales are then computed based on the zoom scales needed to
1599         make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the
1600         text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the
1601         first and second text legibility scales may end up being close to one another, or even the same (in the case
1602         where there is only a single font size in the entire document). In this case, we just snap the first scale to
1603         the second, so that double tapping will only toggle between two zoom scales. In another case where the document
1604         has no text (e.g. an image document), we just fall back to a zoom scale of 1.
1605
1606         Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html
1607
1608         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1609         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
1610
1611 2018-04-17  Megan Gardner  <megan_gardner@apple.com>
1612
1613         Don't activate selection on become first responder
1614         https://bugs.webkit.org/show_bug.cgi?id=184719
1615
1616         Reviewed by Tim Horton.
1617         
1618         If we activate the selection immediately on becoming first responder, we cause the selection view to delete itself
1619         since it is not guaranteed to have selection rects immediately due to async/two process architecture. The selection
1620         is activated already when the selection rects change, so there is no reason to activate it now. This has likely worked
1621         in the past because this selection assistant was only for editable text, which would immediately set a caret, which 
1622         is a selection. Now that this is for non-editable text as well, activating the selection is problematic.
1623
1624         * UIProcess/ios/WKContentViewInteraction.mm:
1625         (-[WKContentView becomeFirstResponderForWebView]):
1626
1627 2018-04-11  Brian Burg  <bburg@apple.com>
1628
1629         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
1630         https://bugs.webkit.org/show_bug.cgi?id=184462
1631         <rdar://problem/39323336>
1632
1633         Reviewed by Carlos Garcia Campos and Tim Horton.
1634
1635         Covered by existing layout tests and actions endpoints in WebDriver test suite.
1636
1637         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
1638         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
1639         to dispatch more simulated events.
1640
1641         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
1642         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
1643         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
1644         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
1645         also be more than one mouse event waiting to be handled by WebProcess.
1646
1647         In the past, these queued mouse events were tracked with several member variables as different
1648         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
1649         checking the queue length.
1650
1651         * Platform/Logging.h: Add logging channel for mouse events.
1652         * UIProcess/Automation/WebAutomationSession.cpp:
1653         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
1654         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
1655         the convenience constructors and .toProtocolString() method.
1656
1657         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1658         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
1659         prior to returning from the command, we need to abort any key event callbacks that are pending if an
1660         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
1661         be handled when the alert is dismissed and the nested run loop exits.
1662
1663         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
1664         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
1665         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
1666         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
1667
1668         (WebKit::WebAutomationSession::performMouseInteraction):
1669         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
1670         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
1671         so we also need to handle the case where there is nothing to be waited on because hit testing did
1672         not return a target to deliver the event to.
1673
1674         (WebKit::WebAutomationSession::performKeyboardInteractions):
1675         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
1676         event waiting/handling code. Now it matches the types used for the mouse event case.
1677
1678         * UIProcess/Automation/WebAutomationSession.h:
1679         (WebKit::AutomationCommandError::AutomationCommandError):
1680         Add a helper struct to hold an enumerated error name and an optional free-form error message.
1681
1682         * UIProcess/WebPageProxy.h:
1683         * UIProcess/WebPageProxy.cpp:
1684         (WebKit::webMouseEventTypeString):
1685         (WebKit::webKeyboardEventTypeString):
1686         (WebKit::WebPageProxy::handleMouseEvent):
1687         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1688         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
1689         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
1690         if there are more mouse events to be sent to WebProcess.
1691
1692         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
1693         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
1694         (WebKit::WebPageProxy::didReceiveEvent):
1695         Unify the code paths for different mouse event types to all use the deque. They also will
1696         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
1697
1698         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
1699
1700 2018-04-17  Adrian Perez de Castro  <aperez@igalia.com>
1701
1702         [GTK][WPE] Build failure due to presence of Avahi's <dns_sd.h> header
1703         https://bugs.webkit.org/show_bug.cgi?id=184711
1704
1705         Unreviewed build fix.
1706
1707         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Set ENABLE_MDNS only for PLATFORM(COCOA).
1708
1709 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
1710
1711         Unreviewed rollout of r230632. Regression in memory usage.
1712
1713         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
1714
1715         * Shared/WebPreferences.yaml:
1716
1717 2018-04-17  Timothy Hatcher  <timothy@apple.com>
1718
1719         Always use LayerContentsType::IOSurface in minimal simulator mode
1720         https://bugs.webkit.org/show_bug.cgi?id=184710
1721
1722         Reviewed by Simon Fraser.
1723
1724         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1725         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1726
1727 2018-04-17  Ryosuke Niwa  <rniwa@webkit.org>
1728
1729         Release assert in InjectedBundle::postSynchronousMessage
1730         https://bugs.webkit.org/show_bug.cgi?id=184683
1731
1732         Reviewed by Wenson Hsieh.
1733
1734         Some injected bundles sends sync message when it's not safe to execute scripts.
1735
1736         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply option in InjectedBundle::postSynchronousMessage
1737         to avoid processing incoming sync IPC messages so that we don't execute arbitrary scripts in those cases.
1738
1739         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1740         (WebKit::InjectedBundle::postSynchronousMessage):
1741
1742 2018-04-17  Chris Dumez  <cdumez@apple.com>
1743
1744         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
1745         https://bugs.webkit.org/show_bug.cgi?id=184678
1746         <rdar://problem/39422122>
1747
1748         Reviewed by Alex Christensen.
1749
1750         Re-introduce synchronous code path which existed pre-r229831 and use it for fragment navigations.
1751
1752         * UIProcess/WebPageProxy.cpp:
1753         (WebKit::WebPageProxy::receivedPolicyDecision):
1754         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1755         * UIProcess/WebPageProxy.h:
1756         * UIProcess/WebPageProxy.messages.in:
1757         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1758         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1759         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1760
1761 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1762
1763         [WPE][GTK] GObject introspection annotation fixes: BackForwardList, NetworkProxySettings
1764         https://bugs.webkit.org/show_bug.cgi?id=184658
1765
1766         Reviewed by Carlos Garcia Campos.
1767
1768         Thanks to Dylan Simon for recommending these annotation fixes.
1769
1770         * UIProcess/API/glib/WebKitBackForwardList.cpp:
1771         * UIProcess/API/glib/WebKitNetworkProxySettings.cpp:
1772
1773 2018-04-17  Brent Fulgham  <bfulgham@apple.com>
1774
1775         [macOS] Don't establish unneeded Dock connections (Follow-up)
1776         https://bugs.webkit.org/show_bug.cgi?id=184664
1777         <rdar://problem/16863698>
1778
1779         Reviewed by Per Arne Vollan.
1780
1781         Because the Plugin process is driven by NSApplication's run loop, we aren't
1782         setting the 'don't connect to the dock' setting early enough.
1783
1784         This patch sets the flag in XPCServiceMain for those services that
1785         are linked to AppKit.
1786
1787         * PluginProcess/mac/PluginProcessMac.mm:
1788         (WebKit::PluginProcess::platformInitializeProcess): Remove unneeded code.
1789         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1790         (main):
1791         * WebProcess/cocoa/WebProcessCocoa.mm:
1792         (WebKit::WebProcess::platformInitializeWebProcess): Remove unneeded code.
1793
1794 2018-04-17  Saam Barati  <sbarati@apple.com>
1795
1796         Add system trace points for process launch and for initializeWebProcess
1797         https://bugs.webkit.org/show_bug.cgi?id=184669
1798
1799         Reviewed by Simon Fraser.
1800
1801         * UIProcess/Launcher/ProcessLauncher.cpp:
1802         (WebKit::ProcessLauncher::ProcessLauncher):
1803         (WebKit::ProcessLauncher::didFinishLaunchingProcess):
1804         * WebProcess/WebProcess.cpp:
1805         (WebKit::WebProcess::initializeWebProcess):
1806
1807 2018-04-16  Timothy Hatcher  <timothy@apple.com>
1808
1809         Unreviewed 32-bit build fix for r230673.
1810
1811         https://bugs.webkit.org/show_bug.cgi?id=184657
1812         rdar://problem/39463307
1813
1814         * Configurations/PluginProcessShim.xcconfig: Use the correct names.
1815
1816 2018-04-16  Andy Estes  <aestes@apple.com>
1817
1818         [iOS] Enable WKPDFView by default
1819         https://bugs.webkit.org/show_bug.cgi?id=184675
1820         <rdar://problem/27885452>
1821
1822         Reviewed by Darin Adler.
1823
1824         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1825         (-[WKWebViewContentProviderRegistry init]):
1826
1827 2018-04-16  Brent Fulgham  <bfulgham@apple.com>
1828
1829         [macOS] Don't establish unneeded Dock connections
1830         https://bugs.webkit.org/show_bug.cgi?id=184664
1831         <rdar://problem/16863698>
1832
1833         Reviewed by Simon Fraser.
1834
1835         There is no reason for the WebContent or Plugin processes to interact with
1836         the Dock. We should tell AppKit that we don't want this connection, and to
1837         avoid creating such connections.
1838
1839         * PluginProcess/mac/PluginProcessMac.mm:
1840         (WebKit::PluginProcess::platformInitializeProcess): Tell NSApplication to
1841         not create a Dock connection.
1842         * WebProcess/cocoa/WebProcessCocoa.mm:
1843         (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
1844
1845 2018-04-16  Megan Gardner  <megan_gardner@apple.com>
1846
1847         Switch to UIWKTextInteractionAssistant for non-editable text
1848         https://bugs.webkit.org/show_bug.cgi?id=182834
1849
1850         Reviewed by Beth Dakin.
1851         
1852         Switch to only using one assistant for text selection.
1853
1854         * UIProcess/ios/WKContentViewInteraction.mm:
1855         (-[WKContentView useSelectionAssistantWithGranularity:]):
1856
1857 2018-04-16  Youenn Fablet  <youenn@apple.com>
1858
1859         Use NetworkLoadChecker to handle synchronous HTTP loads
1860         https://bugs.webkit.org/show_bug.cgi?id=184240
1861
1862         Reviewed by Chris Dumez.
1863
1864         For every NetworkResourceLoader synchronous load, we create a NetworkLoadChecker.
1865         NetworkLoadChecker handles all security checks in that case.
1866         This allows supporting cross-origin loads for synchronous XHR.
1867
1868         Updated NetworkCORSPreflightChecker to return the result as a ResourceError.
1869         This is used to convey any error message from NetworkProcess to the JS console.
1870         Ensure NetworkCORSPreflightChecker computes correctly Access-Control-Request-Headers value
1871         by providing the headers set by the application plus Referrer/Origin.
1872
1873         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1874         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
1875         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
1876         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
1877         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
1878         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
1879         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
1880         * NetworkProcess/NetworkLoadChecker.cpp:
1881         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1882         * NetworkProcess/NetworkResourceLoader.cpp:
1883         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1884         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1885         (WebKit::NetworkResourceLoader::didReceiveResponse):
1886         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1887         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1888         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1889         (WebKit::NetworkResourceLoader::validateCacheEntry):
1890         * NetworkProcess/NetworkResourceLoader.h:
1891         * WebProcess/Network/WebLoaderStrategy.cpp:
1892         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1893         * WebProcess/Network/WebLoaderStrategy.h:
1894
1895 2018-04-16  Brian Burg  <bburg@apple.com>
1896
1897         [Cocoa] Web Automation: add SPI to terminate automation session and disconnect the remote end
1898         https://bugs.webkit.org/show_bug.cgi?id=184523
1899         <rdar://problem/39368599>
1900
1901         Reviewed by Simon Fraser.
1902
1903         When a user breaks the automation glass pane and chooses "Stop Session", there is no way
1904         for Safari to actually disconnect the remote connection using automation-related ObjC SPI.
1905         This can lead to sessions getting stuck and safaridriver is unable to request a new session.
1906
1907         Expose the -terminate method as SPI. This disconnects the remote connection and then notifies
1908         the session delegate that the remote disconnected. At that point, Safari can uninstall
1909         the session from the process pool and tear down other session state.
1910
1911         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1912         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1913         (-[_WKAutomationSession terminate]):
1914
1915 2018-04-16  Timothy Hatcher  <timothy@apple.com>
1916
1917         Clean up OTHER_LDFLAGS for WebKit processes
1918         https://bugs.webkit.org/show_bug.cgi?id=184657
1919
1920         Reviewed by Jer Noble.
1921
1922         * Configurations/PluginProcessShim.xcconfig:
1923         * Configurations/PluginService.32.xcconfig:
1924         * Configurations/PluginService.64.xcconfig:
1925         * Configurations/WebContentService.xcconfig:
1926
1927 2018-04-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1928
1929         [WPE] Install files needed for WebKitWebExtensions
1930         https://bugs.webkit.org/show_bug.cgi?id=179915
1931
1932         Reviewed by Žan Doberšek.
1933
1934         * PlatformWPE.cmake: Install pkg-config file, injected bundle, and API headers.
1935         * UIProcess/API/glib/WebKitWebContext.cpp: Load the injected bundle when installed.
1936         * wpe/wpe-web-extension.pc.in: Added.
1937
1938 2018-04-14  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1939
1940         [GTK][WPE] Build is broken after r230640
1941         https://bugs.webkit.org/show_bug.cgi?id=184623
1942
1943         Reviewed by Žan Doberšek.
1944
1945         UIProcess/SuspendedPageProxy.cpp was not included to CMake build in r230640.
1946
1947         * CMakeLists.txt: Added UIProcess/SuspendedPageProxy.cpp to WebKit_SOURCES.
1948
1949 2018-04-13  Ryan Haddad  <ryanhaddad@apple.com>
1950
1951         Unreviewed, rolling out r230447.
1952
1953         Caused flaky selection test failures on iOS
1954
1955         Reverted changeset:
1956
1957         "Switch to UIWKTextInteractionAssistant for non-editable text"
1958         https://bugs.webkit.org/show_bug.cgi?id=182834
1959         https://trac.webkit.org/changeset/230447
1960
1961 2018-04-13  Chris Dumez  <cdumez@apple.com>
1962
1963         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
1964         https://bugs.webkit.org/show_bug.cgi?id=184591
1965
1966         Reviewed by Sam Weinig.
1967
1968         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
1969         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
1970         This is work towards fixing Bug 184515.
1971
1972         * WebProcess/Plugins/PluginView.cpp:
1973         (WebKit::PluginView::windowScriptNPObject):
1974
1975 2018-04-13  Brady Eidson  <beidson@apple.com>
1976
1977         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
1978         https://bugs.webkit.org/show_bug.cgi?id=184559
1979
1980         Reviewed by Alex Christensen.
1981
1982         Before this patch, when a WebPageProxy navigates and is swapped to a new process, the old process almost always goes away.
1983
1984         This is not desirable for a few reasons:
1985         1 - We can't keep the PageCache working for back/forward scenarios
1986         2 - We throw away a "foo.com" web process, meaning the next time we need to host a "foo.com" web page we have to launch
1987             and initialize a new web process.
1988
1989         This patch adds a SuspendedPageProxy object to keep around the old web process and to manage communication with it.
1990
1991         For now, a WebPageProxy keeps exactly one "suspended page" representing the most recently visited page and its process.
1992         Additionally, that process is never reused.
1993
1994         So no benefit is achieved with this patch, but it enables future benefits.
1995
1996         * Platform/Logging.h:
1997
1998         * Shared/WebBackForwardListItem.cpp:
1999         (WebKit::WebBackForwardListItem::setSuspendedPage):
2000         * Shared/WebBackForwardListItem.h:
2001
2002         New object to represent the state of a WebPageProxy in an old web process that is not currently hosting the view.
2003         * UIProcess/SuspendedPageProxy.cpp: Added.
2004         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2005         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2006         (WebKit::SuspendedPageProxy::webProcessDidClose):
2007         (WebKit::SuspendedPageProxy::didFinishLoad):
2008         (WebKit::SuspendedPageProxy::didReceiveMessage):
2009         (WebKit::SuspendedPageProxy::loggingString const):
2010         * UIProcess/SuspendedPageProxy.h: Copied from Source/WebKit/Platform/Logging.h.
2011         (WebKit::SuspendedPageProxy::create):
2012         (WebKit::SuspendedPageProxy::page const):
2013         (WebKit::SuspendedPageProxy::process const):
2014         (WebKit::SuspendedPageProxy::item const):
2015         (WebKit::SuspendedPageProxy::finishedSuspending const):
2016
2017         * UIProcess/WebPageProxy.cpp:
2018         (WebKit::WebPageProxy::reattachToWebProcess):
2019         (WebKit::WebPageProxy::attachToProcessForNavigation):
2020         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
2021         (WebKit::WebPageProxy::suspendedPageProcessClosed):
2022         (WebKit::WebPageProxy::receivedPolicyDecision):
2023         (WebKit::WebPageProxy::didFinishLoadForFrame):
2024         * UIProcess/WebPageProxy.h:
2025
2026         * UIProcess/WebProcessProxy.cpp:
2027         (WebKit::WebProcessProxy::suspendWebPageProxy):
2028         (WebKit::WebProcessProxy::suspendedPageWasDestroyed):
2029         (WebKit::WebProcessProxy::removeWebPage):
2030         (WebKit::WebProcessProxy::didReceiveMessage): Optionally pass WebPageProxy messages along to SuspendedPageProxy objects.
2031         (WebKit::WebProcessProxy::didClose):
2032         (WebKit::WebProcessProxy::maybeShutDown):
2033         (WebKit::WebProcessProxy::canTerminateChildProcess): Don't terminate child processes if they still have suspended pages.
2034         * UIProcess/WebProcessProxy.h:
2035
2036         * WebKit.xcodeproj/project.pbxproj:
2037
2038         * WebProcess/WebPage/WebPage.cpp:
2039         (WebKit::WebPage::setIsSuspended):
2040         * WebProcess/WebPage/WebPage.h:
2041         (WebKit::WebPage::isSuspended const): For now, used only by WebProcess::updateActivePages. Will have more uses soon.
2042         * WebProcess/WebPage/WebPage.messages.in:
2043
2044         * WebProcess/WebProcess.messages.in:
2045         * WebProcess/cocoa/WebProcessCocoa.mm:
2046         (WebKit::WebProcess::updateActivePages): Allow the UIProcess to request an update of the web processes user visible name.
2047
2048 2018-04-13  Daniel Bates  <dabates@apple.com>
2049
2050         Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
2051         https://bugs.webkit.org/show_bug.cgi?id=184593
2052
2053         Reviewed by Alex Christensen.
2054
2055         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
2056         is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
2057         implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
2058         and the cognitive load to follow such a function call when reading the code.
2059
2060         No functionality changed. So, no new tests.
2061
2062         * NetworkProcess/NetworkLoad.cpp:
2063         (WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
2064         into this function.
2065         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
2066         into NetworkLoad::willPerformHTTPRedirection().
2067         * NetworkProcess/NetworkLoad.h:
2068
2069 2018-04-13  Daniel Bates  <dabates@apple.com>
2070
2071         Inline NetworkLoad::sharedDidReceiveResponse() into NetworkLoad::notifyDidReceiveResponse()
2072         https://bugs.webkit.org/show_bug.cgi?id=184592
2073
2074         Reviewed by Alex Christensen.
2075
2076         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedDidReceiveResponse()
2077         is only referenced from NetworkLoad::notifyDidReceiveResponse(). We should inline its
2078         implementation into the NetworkLoad::notifyDidReceiveResponse(), remove a function
2079         call, and the cognitive load to follow such a function call when reading the code.
2080
2081         No functionality changed. So, no new tests.
2082
2083         * NetworkProcess/NetworkLoad.cpp:
2084         (WebKit::NetworkLoad::notifyDidReceiveResponse): Moved the implementation of NetworkLoad::sharedDidReceiveResponse()
2085         into this function.
2086         (WebKit::NetworkLoad::sharedDidReceiveResponse): Deleted. Moved its implementation into
2087         NetworkLoad::notifyDidReceiveResponse().
2088         * NetworkProcess/NetworkLoad.h:
2089
2090 2018-04-13  Brent Fulgham  <bfulgham@apple.com>
2091
2092         REGRESSION(r230468): Improper assertion firing under STP
2093         <rdar://problem/39411676>
2094
2095         Unreviewed, rolling out an improper assertion.
2096
2097         I added an assertion in Bug 184322 that should not have been added. I did not notice that this
2098         call stack was always used in builds where NSApp is still active. Builds where we stop relying
2099         on AppKit runloops uses a different code path to shut down.
2100
2101         * Shared/mac/ChildProcessMac.mm:
2102         (WebKit::ChildProcess::stopNSAppRunLoop):
2103
2104 2018-04-12  Antoine Quint  <graouts@apple.com>
2105
2106         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
2107         https://bugs.webkit.org/show_bug.cgi?id=184569
2108         <rdar://problem/38671301>
2109
2110         Reviewed by Jon Lee.
2111
2112         * Shared/WebPreferences.yaml:
2113
2114 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2115
2116         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
2117         https://bugs.webkit.org/show_bug.cgi?id=184533
2118
2119         Reviewed by Philippe Normand.
2120
2121         Renamed GStreamerUtilities* files into GStreamerCommon* and
2122         modified files including them accordingly. Include
2123         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
2124         to avoid problems destroying objects when those files are
2125         forgotten to be included.
2126
2127         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2128         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2129         * WebProcess/soup/WebProcessSoup.cpp:
2130
2131 2018-04-12  Beth Dakin  <bdakin@apple.com>
2132
2133         Fix the MOBILE_WIFI build
2134         https://bugs.webkit.org/show_bug.cgi?id=184571
2135         -and corresponding-
2136         <rdar://problem/39398181>
2137
2138         Reviewed by Jer Noble.
2139
2140         * config.h:
2141
2142 2018-04-12  Beth Dakin  <bdakin@apple.com>
2143
2144         Use -iframework to ensure that frameworks from user paths and system paths are 
2145         ordered appropriately
2146         https://bugs.webkit.org/show_bug.cgi?id=184557
2147         -and corresponding-
2148         rdar://problem/39386359
2149
2150         Reviewed by Dean Jackson.
2151
2152         * Configurations/WebKit.xcconfig:
2153
2154 2018-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2155
2156         [Extra zoom mode] Suppress UI for inputs of type file in extra zoom mode
2157         https://bugs.webkit.org/show_bug.cgi?id=184556
2158         <rdar://problem/39062239>
2159
2160         Reviewed by Andy Estes.
2161
2162         When running in this mode, we don't have the facilities to present document picker UI. For now, just make this
2163         feature fail gracefully.
2164
2165         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2166         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
2167         (-[WKFileUploadPanel platformSupportsPickerViewController]):
2168
2169 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
2170
2171         Remove block selection code
2172         https://bugs.webkit.org/show_bug.cgi?id=184470
2173
2174         Reviewed by Timothy Hatcher.
2175         
2176         Remove block selection code that isn't run and is currently not even used.
2177         Had to put this back in for a bug in the mid-year release, but we're past that
2178         so it's time for this to go away.
2179
2180         * Platform/spi/ios/UIKitSPI.h:
2181         * UIProcess/PageClient.h:
2182         * UIProcess/WebPageProxy.h:
2183         * UIProcess/WebPageProxy.messages.in:
2184         * UIProcess/ios/PageClientImplIOS.h:
2185         * UIProcess/ios/PageClientImplIOS.mm:
2186         (WebKit::PageClientImpl::stopAssistingNode):
2187         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
2188         * UIProcess/ios/WKContentViewInteraction.h:
2189         * UIProcess/ios/WKContentViewInteraction.mm:
2190         (toSelectionHandlePosition): Deleted.
2191         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
2192         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
2193         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
2194         * UIProcess/ios/WebPageProxyIOS.mm:
2195         (WebKit::WebPageProxy::saveImageToLibrary):
2196         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
2197         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
2198         * WebProcess/WebPage/WebPage.h:
2199         * WebProcess/WebPage/WebPage.messages.in:
2200         * WebProcess/WebPage/ios/WebPageIOS.mm:
2201         (WebKit::rangeAtWordBoundaryForPosition):
2202         (WebKit::distanceBetweenRectsForPosition): Deleted.
2203         (WebKit::rectsEssentiallyTheSame): Deleted.
2204         (WebKit::unionDOMRanges): Deleted.
2205         (WebKit::computeEdgeCenter): Deleted.
2206         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
2207         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
2208         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
2209         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
2210         (WebKit::shouldExpand): Deleted.
2211         (WebKit::WebPage::changeBlockSelection): Deleted.
2212         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
2213         
2214 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
2215
2216         Don't have selections get stuck in editable elements
2217         https://bugs.webkit.org/show_bug.cgi?id=184483
2218
2219         Reviewed by Timothy Hatcher.
2220         
2221         When selecting in editable elements, if the keyboard does not come up, which is not required,
2222         then the selections are stuck in that element. If you try and select something in web content,
2223         it will only select in the editable element. By clearing the assisted node when clearing a selection,
2224         it no longer sticks. Also, textSelectionAssistant should not be used as if we are currently editing. 
2225         Change it to the function we created for that purpose in a pervious patch.
2226
2227         * UIProcess/ios/WKContentViewInteraction.mm:
2228         (-[WKContentView clearSelection]):
2229         (-[WKContentView _isInteractingWithAssistedNode]):
2230
2231 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2232
2233         [WPE] Move libWPEWebInspectorResources.so to pkglibdir
2234         https://bugs.webkit.org/show_bug.cgi?id=184379
2235
2236         Reviewed by Žan Doberšek.
2237
2238         This is important to allow parallel installation.
2239
2240         * PlatformWPE.cmake:
2241
2242 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2243
2244         [WPE] Improve include hierarchy
2245         https://bugs.webkit.org/show_bug.cgi?id=184376
2246
2247         Reviewed by Žan Doberšek.
2248
2249         Install our headers under /usr/include/wpe-webkit-0.1/wpe instead of
2250         /usr/include/wpe-0.1/WPE/wpe. Too much WPE, not enough WebKit!
2251
2252         * PlatformWPE.cmake:
2253         * wpe/wpe-webkit.pc.in:
2254
2255 2018-04-11  Andy Estes  <aestes@apple.com>
2256
2257         [iOS] Add a mechanism for holding Wi-Fi assertions
2258         https://bugs.webkit.org/show_bug.cgi?id=184520
2259         <rdar://problem/39025726>
2260
2261         Reviewed by Sam Weinig.
2262
2263         Add plumbing for holding a Wi-Fi assertion on iOS as long as there are active
2264         network data tasks. This functionality is turned off by default right now.
2265
2266         * Configurations/Network-iOS.entitlements:
2267         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2268         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2269         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2270         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp: Added.
2271         (WebKit::ensureWiFiManagerClient): Create a global WiFiManagerClient when needed.
2272         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder): If this is the first active
2273         Wi-Fi assertion holder, set the client's type to kWiFiClientTypeBackground.
2274         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder): If the last active Wi-Fi
2275         assertion holder is being destroyed, set the client's type back to
2276         kWiFiClientTypeNormal.
2277         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Added.
2278         * Platform/Logging.h: Added a logging channel for Wi-Fi assertions.
2279         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2280         * WebKit.xcodeproj/project.pbxproj:
2281
2282 2018-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2283
2284         [GTK] Switch to use always complex text code path
2285         https://bugs.webkit.org/show_bug.cgi?id=183285
2286
2287         Reviewed by Michael Catanzaro.
2288
2289         Now that we have branched for 2.20, it's a good time to try using complex text path always. We can simply force
2290         it for GTK+ port and see how it works for the whole release cycle and if we don't notice any issues or
2291         performance regressions we release 2.22 with complex text path forced. A debug env variable is added to switch
2292         back to auto without having to recompile. After 2.22 is released we can make a final decision and remove the env
2293         variable.
2294
2295         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2296         (WebKit::WebProcessPool::platformInitializeWebProcess): Force complex text code path unless
2297         WEBKIT_FORCE_COMPLEX_TEXT is present and set to 0.
2298
2299 2018-04-11  Zan Dobersek  <zdobersek@igalia.com>
2300
2301         [WPE] Make WebKitWebViewBackend object mandatory for webkit_web_view_new*() constructors
2302         https://bugs.webkit.org/show_bug.cgi?id=184513
2303
2304         Reviewed by Michael Catanzaro.
2305
2306         webkit_web_view_new*() constructors should always expect a non-null
2307         WebKitWebViewBackend object, forcing the user to specify how the
2308         wpe_view_backend object is managed for the WebKitWebView that's being
2309         created.
2310
2311         webkitWebViewBackendCreateDefault() and the default
2312         _WebKitWebViewBackend() constructor are removed. WPE-specific
2313         webkit_web_view_new*() entrypoints are updated to bail if the passed-in
2314         WebKitWebViewBackend object is null. Documentation is updated
2315         accordingly.
2316
2317         * UIProcess/API/glib/WebKitWebView.cpp:
2318         (webkitWebViewConstructed):
2319         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
2320         (webkitWebViewBackendCreateDefault): Deleted.
2321         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
2322         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2323         (webkit_web_view_new):
2324         (webkit_web_view_new_with_context):
2325         (webkit_web_view_new_with_related_view):
2326         (webkit_web_view_new_with_settings):
2327         (webkit_web_view_new_with_user_content_manager):
2328
2329 2018-04-11  Fujii Hironori  <Hironori.Fujii@sony.com>
2330
2331         [curl][WebKit] Implement NetworkDataTaskCurl
2332         https://bugs.webkit.org/show_bug.cgi?id=184488
2333
2334         Reviewed by Alex Christensen.
2335
2336         * NetworkProcess/NetworkDataTask.cpp:
2337         (WebKit::NetworkDataTask::create):
2338         * NetworkProcess/curl/NetworkDataTaskCurl.cpp: Added.
2339         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
2340         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
2341         (WebKit::NetworkDataTaskCurl::resume):
2342         (WebKit::NetworkDataTaskCurl::suspend):
2343         (WebKit::NetworkDataTaskCurl::cancel):
2344         (WebKit::NetworkDataTaskCurl::invalidateAndCancel):
2345         (WebKit::NetworkDataTaskCurl::state const):
2346         (WebKit::NetworkDataTaskCurl::createCurlRequest):
2347         (WebKit::NetworkDataTaskCurl::curlDidSendData):
2348         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
2349         (WebKit::NetworkDataTaskCurl::curlDidReceiveBuffer):
2350         (WebKit::NetworkDataTaskCurl::curlDidComplete):
2351         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
2352         (WebKit::NetworkDataTaskCurl::shouldRedirectAsGET):
2353         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
2354         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
2355         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2356         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
2357         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
2358         * NetworkProcess/curl/NetworkDataTaskCurl.h: Added.
2359         * PlatformWin.cmake:
2360
2361 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2362
2363         [Extra zoom mode] Support pushing input view controllers onto the navigation stack
2364         https://bugs.webkit.org/show_bug.cgi?id=184397
2365         <rdar://problem/39265294>
2366
2367         Reviewed by Timothy Hatcher.
2368
2369         Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
2370         the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
2371         and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
2372         within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
2373         presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
2374         approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
2375         UINavigationController to hook into this behavior, with modal presentation as a fallback.
2376
2377         At a high level, this patch makes the following tweaks to implement this behavior:
2378
2379         1. Store the currently presented view controller using a single member variable
2380            (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
2381            which view controller to present or dismiss much more straightforward.
2382
2383         2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
2384            pushing an input view controller onto the navigation stack after presenting the focused form control view
2385            controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
2386
2387         3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
2388            navigation stack rather than presenting them modally means that we end up in a state where neither the
2389            WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
2390            Instead, have the WKTimePickerViewController actually become first responder when presenting.
2391
2392         4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
2393            -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
2394            presentation.
2395
2396         * UIProcess/ios/WKContentViewInteraction.h:
2397
2398         Remove the separate member variables for each type of input view controller, and instead have one to keep track
2399         of the current (and only) presented input view controller.
2400
2401         * UIProcess/ios/WKContentViewInteraction.mm:
2402         (-[WKContentView _willStartScrollingOrZooming]):
2403         (-[WKContentView _didEndScrollingOrZooming]):
2404         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2405         (-[WKContentView _stopAssistingNode]):
2406
2407         Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
2408
2409         (-[WKContentView reloadContextViewForPresentedListViewController]):
2410
2411         Adjust for consolidation of the different input view controller member variables to a single member (see changes
2412         in WKContentViewInteraction.h).
2413
2414         (-[WKContentView addFocusedFormControlOverlay]):
2415         (-[WKContentView removeFocusedFormControlOverlay]):
2416         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2417         (-[WKContentView dismissAllInputViewControllers:]):
2418
2419         Add an `animated` argument. In the case where a different view controller was presented after presenting the
2420         input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
2421         the web view or focus overlay underneath.
2422
2423         (-[WKContentView focusedFormControlViewDidSubmit:]):
2424         (-[WKContentView focusedFormControlViewDidCancel:]):
2425         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
2426         (-[WKContentView rectForFocusedFormControlView:]):
2427         (-[WKContentView nextRectForFocusedFormControlView:]):
2428         (-[WKContentView previousRectForFocusedFormControlView:]):
2429         (-[WKContentView scrollViewForFocusedFormControlView:]):
2430         (-[WKContentView actionNameForFocusedFormControlView:]):
2431         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
2432         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
2433         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
2434         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
2435         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2436
2437         Boilerplate renaming of focus overlay delegate methods.
2438
2439         (-[WKContentView _wheelChangedWithEvent:]):
2440
2441         Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
2442
2443         (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
2444         (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
2445
2446         Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
2447
2448         (-[WKContentView dismissAllInputViewControllers]): Deleted.
2449         (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
2450         (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
2451         (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
2452         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2453         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2454         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2455         (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
2456         (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
2457         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
2458         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
2459         (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
2460         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
2461         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
2462         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
2463
2464         Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
2465         the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
2466         present the focused form overlay as a separate view controller using the UINavigationController, and then
2467         immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
2468         updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
2469         this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
2470         overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
2471         the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
2472
2473         * WebKit.xcodeproj/project.pbxproj:
2474
2475 2018-04-11  Youenn Fablet  <youenn@apple.com>
2476
2477         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
2478         https://bugs.webkit.org/show_bug.cgi?id=184374
2479
2480         Reviewed by Chris Dumez.
2481
2482         Pass full FetchOptions parameters as part of NetworkResourceLoadParameters.
2483         This will allow handling redirection mode as well as credentials in case of cross origin redirections.
2484         In case of SameOrigin credentials and there is a redirection from same-origin to cross-origin,
2485         we will be able to stop using credentials without going to WebProcess.
2486
2487         To handle properly cross-origin checks, we have to be able to use SecurityOrigin as in WebProcess.
2488         We make WebProcess sends Origin Access White list information to NetworkProcess.
2489         This allows supporting the white list when doing loading in NetworkProcess.
2490         This only works consistently if all WebProcesses share the same whitelist.
2491
2492         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2493         (WebKit::NetworkConnectionToWebProcess::loadPing):
2494         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
2495         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
2496         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
2497         * NetworkProcess/NetworkConnectionToWebProcess.h:
2498         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2499         * NetworkProcess/NetworkLoadChecker.cpp:
2500         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2501         (WebKit::NetworkLoadChecker::checkRedirection):
2502         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2503         (WebKit::NetworkLoadChecker::checkCORSRequest):
2504         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
2505         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2506         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2507         * NetworkProcess/NetworkLoadChecker.h:
2508         (WebKit::NetworkLoadChecker::create):
2509         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2510         (WebKit::NetworkResourceLoadParameters::encode const):
2511         (WebKit::NetworkResourceLoadParameters::decode):
2512         * NetworkProcess/NetworkResourceLoadParameters.h:
2513         * NetworkProcess/PingLoad.cpp:
2514         (WebKit::PingLoad::PingLoad):
2515         (WebKit::PingLoad::willPerformHTTPRedirection):
2516         * NetworkProcess/PingLoad.h:
2517         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2518         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
2519         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
2520         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
2521         * WebProcess/Network/WebLoaderStrategy.cpp:
2522         (WebKit::WebLoaderStrategy::startPingLoad):
2523
2524 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2525
2526         [GTK] WaylandCompositorDisplay leaks its wl_display
2527         https://bugs.webkit.org/show_bug.cgi?id=184406
2528
2529         Reviewed by Carlos Garcia Campos.
2530
2531         Since we allocate our own wl_display here, need to chain up to the parent constructor
2532         passing NativeDisplayOwned::Yes, or it won't ever be released. Move the initialize call to
2533         the create function to ensure it's called after the constructor completes.
2534
2535         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
2536         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
2537         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
2538
2539 2018-04-11  Youenn Fablet  <youenn@apple.com>
2540
2541         Use more r-values in NetworkResourceLoader
2542         https://bugs.webkit.org/show_bug.cgi?id=184478
2543
2544         Reviewed by Chris Dumez.
2545
2546         Pass load parameters as r-values to remove some unneeded copies.
2547         Ditto for ResourceRequest inside NetworkResourceLoader.
2548
2549         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2550         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2551         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
2552         * NetworkProcess/NetworkConnectionToWebProcess.h:
2553         * NetworkProcess/NetworkResourceLoader.cpp:
2554         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2555         (WebKit::NetworkResourceLoader::start):
2556         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2557         (WebKit::NetworkResourceLoader::startNetworkLoad):
2558         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2559         (WebKit::NetworkResourceLoader::validateCacheEntry):
2560         * NetworkProcess/NetworkResourceLoader.h:
2561
2562 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2563
2564         [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
2565         https://bugs.webkit.org/show_bug.cgi?id=184352
2566         <rdar://problem/39237683>
2567
2568         Reviewed by Andy Estes.
2569
2570         Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
2571         any information requested in the UI process that is dependent on the `title` of the focused element is broken
2572         in the case of select elements. An existing example of this is the title of the table view controller used to
2573         present select menus on iPad.
2574
2575         To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
2576         HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
2577         zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
2578         controller's title.
2579
2580         Test: fast/forms/ios/ipad/select-with-title.html
2581
2582         * UIProcess/API/Cocoa/WKWebView.mm:
2583         (-[WKWebView selectFormPopoverTitle]):
2584         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2585
2586         Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
2587         element.
2588
2589         * UIProcess/ios/WKContentViewInteraction.h:
2590         * UIProcess/ios/WKContentViewInteraction.mm:
2591         (-[WKContentView selectFormPopoverTitle]):
2592         * UIProcess/ios/forms/WKFormSelectControl.h:
2593         * UIProcess/ios/forms/WKFormSelectControl.mm:
2594         (-[WKFormSelectControl selectFormPopoverTitle]):
2595         * UIProcess/ios/forms/WKFormSelectPopover.h:
2596         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2597         (-[WKSelectPopover initWithView:hasGroups:]):
2598         (-[WKSelectPopover tableViewController]):
2599         * WebProcess/WebPage/ios/WebPageIOS.mm:
2600
2601         Always send the title across if the focused node is an HTMLElement.
2602
2603         (WebKit::WebPage::getAssistedNodeInformation):
2604
2605 2018-04-11  Ryan Haddad  <ryanhaddad@apple.com>
2606
2607         Unreviewed, rolling out r230508.
2608
2609         Breaks internal builds.
2610
2611         Reverted changeset:
2612
2613         "Remove block selection code"
2614         https://bugs.webkit.org/show_bug.cgi?id=184470
2615         https://trac.webkit.org/changeset/230508
2616
2617 2018-04-11  Antoine Quint  <graouts@apple.com>
2618
2619         [Web Animations] Turn Web Animations on by default
2620         https://bugs.webkit.org/show_bug.cgi?id=184491
2621
2622         Reviewed by Simon Fraser.
2623
2624         * Shared/WebPreferences.yaml:
2625
2626 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2627
2628         Unreviewed test fix after r230468
2629
2630         Roll out an assertion added in r230468 that should not be present
2631         until https://bugs.webkit.org/show_bug.cgi?id=184451 is landed.
2632
2633         * Shared/mac/HangDetectionDisablerMac.mm:
2634         (WebKit::setClientsMayIgnoreEvents):
2635
2636 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2637
2638         Unreviewed follow-up to r230468.
2639
2640         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
2641
2642         * UIProcess/mac/PageClientImplMac.mm:
2643         (WebKit::PageClientImpl::isViewWindowActive):
2644         (WebKit::PageClientImpl::setCursor):
2645
2646 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2647
2648         [Win] Add UserAgentWin.cpp
2649         https://bugs.webkit.org/show_bug.cgi?id=184438
2650
2651         Reviewed by Michael Catanzaro.
2652
2653         * WebProcess/WebPage/win/WebPageWin.cpp:
2654         (WebKit::WebPage::platformUserAgent const):
2655         Use WebCore::standardUserAgentForURL.
2656
2657 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
2658
2659         Remove block selection code
2660         https://bugs.webkit.org/show_bug.cgi?id=184470
2661
2662         Reviewed by Timothy Hatcher.
2663         
2664         Remove block selection code that isn't run and is currently not even used.
2665         Had to put this back in for a bug in the mid-year release, but we're past that
2666         so it's time for this to go away.
2667
2668         * Platform/spi/ios/UIKitSPI.h:
2669         * UIProcess/PageClient.h:
2670         * UIProcess/WebPageProxy.h:
2671         * UIProcess/WebPageProxy.messages.in:
2672         * UIProcess/ios/PageClientImplIOS.h:
2673         * UIProcess/ios/PageClientImplIOS.mm:
2674         (WebKit::PageClientImpl::stopAssistingNode):
2675         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
2676         * UIProcess/ios/WKContentViewInteraction.h:
2677         * UIProcess/ios/WKContentViewInteraction.mm:
2678         (toSelectionHandlePosition): Deleted.
2679         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
2680         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
2681         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
2682         * UIProcess/ios/WebPageProxyIOS.mm:
2683         (WebKit::WebPageProxy::saveImageToLibrary):
2684         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
2685         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
2686         * WebProcess/WebPage/WebPage.h:
2687         * WebProcess/WebPage/WebPage.messages.in:
2688         * WebProcess/WebPage/ios/WebPageIOS.mm:
2689         (WebKit::rangeAtWordBoundaryForPosition):
2690         (WebKit::distanceBetweenRectsForPosition): Deleted.
2691         (WebKit::rectsEssentiallyTheSame): Deleted.
2692         (WebKit::unionDOMRanges): Deleted.
2693         (WebKit::computeEdgeCenter): Deleted.
2694         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
2695         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
2696         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
2697         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
2698         (WebKit::shouldExpand): Deleted.
2699         (WebKit::WebPage::changeBlockSelection): Deleted.
2700         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
2701
2702 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2703
2704         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
2705         https://bugs.webkit.org/show_bug.cgi?id=184435
2706         <rdar://problem/38726260>
2707
2708         Reviewed by Dean Jackson.
2709
2710         Adds support for an alternate codepath when computing a zoom rect when double tapping that doesn't take the hit-
2711         tested node into account, and instead cycles the zoom scale between 2 fixed values (in addition to the initial
2712         scale). In the next patch, these fixed scales will be determined by computing zoom scales needed to make most of
2713         the text on the page legible (i.e. the first text legibility zoom scale), and another to make all of the text on
2714         the page legible, with the exception of outliers (this is the second text legibility zoom scale).
2715
2716         See comments below for more detail.
2717
2718         * UIProcess/Cocoa/ViewGestureController.h:
2719         * UIProcess/Cocoa/ViewGestureController.messages.in:
2720         * UIProcess/ios/SmartMagnificationController.h:
2721         * UIProcess/ios/SmartMagnificationController.messages.in:
2722         * UIProcess/ios/SmartMagnificationController.mm:
2723         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
2724         * UIProcess/mac/ViewGestureControllerMac.mm:
2725         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
2726         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2727         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
2728
2729         Rename the boolean `isReplacedElement` argument to `fitEntireRect` instead. The UI process only uses this on iOS
2730         to determine whether or not to fit the entire element rect to the viewport and add padding. This patch renames
2731         this variable because we are not zooming to a replaced element in the case where text legibility on the page
2732         (rather than element geometry) is being used to figure out the zoom scale, but we still want to fit the entire
2733         target rect to the viewport.
2734
2735         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
2736
2737         If text legiblity zoom scaling is preferred, then compute first and second-level text legibility zoom scales to
2738         zoom to upon double tap (where the second zoom scale is greater than the first). To choose a target zoom
2739         scale, choose the lowest target zoom scale that is at least a small amount less than the current scale. If
2740         neither of the two scales fulfill this description, then zoom back out to the initial scale. This has the effect
2741         of consistently cycling between all three zoom scales as the user double taps.
2742
2743         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
2744
2745         Introduce a new helper method that computes and caches target scales to zoom to when double tapping to zoom. If
2746         a cached pair of target scales is already present, it skips this computation and immediately returns it.
2747
2748         (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
2749         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
2750
2751         Factor out logic to compute min and max zoom scales into a separate helper, and call it from both
2752         computeZoomInformationForNode and computeTextLegibilityScales.
2753
2754         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
2755
2756         Invalidate cached text legibility scales when layout is triggered.
2757
2758         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
2759         * WebProcess/WebPage/WebPage.cpp:
2760         (WebKit::WebPage::mainFrameDidLayout):
2761         * WebProcess/WebPage/WebPage.h:
2762         (WebKit::WebPage::viewportConfiguration const):
2763
2764         Expose WebPage's ViewportConfiguration as a const reference.
2765
2766         * WebProcess/WebPage/ios/WebPageIOS.mm:
2767         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
2768
2769         Adds a platform hook for opting into text-legibility-based zoom scaling instead of regular hit-testing-based
2770         zoom scaling heuristics.
2771
2772 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2773
2774         Fix availability annotations for _WKAttachment SPI
2775         https://bugs.webkit.org/show_bug.cgi?id=184473
2776         <rdar://problem/39319732>
2777
2778         Reviewed by Dan Bernstein.
2779
2780         _WKAttachmentInfo is available in WK_MAC_TBA and WK_IOS_TBA, but the SPI method -[_WKAttachment requestInfo:]
2781         is currently available in macOS 10.13.4 and iOS 11.3. Instead, the availability of this SPI should match the
2782         availability of the SPI object it depends on.
2783
2784         * UIProcess/API/Cocoa/_WKAttachment.h:
2785
2786 2018-04-10  Chris Dumez  <cdumez@apple.com>
2787
2788         Avoid constructing a service worker RegistrationStore for private sessions
2789         https://bugs.webkit.org/show_bug.cgi?id=184463
2790         <rdar://problem/36613948>
2791
2792         Reviewed by Youenn Fablet.
2793
2794         Avoid constructing a service worker RegistrationStore for private sessions since there
2795         is no need for persistence and the registrationDatabaseDirectory is the empty string in
2796         such cases.
2797
2798         * StorageProcess/StorageProcess.cpp:
2799         (WebKit::StorageProcess::initializeWebsiteDataStore):
2800
2801 2018-04-10  Andy Estes  <aestes@apple.com>
2802
2803         [iOS] Navigate to URL and page number annotations in WKPDFView
2804         https://bugs.webkit.org/show_bug.cgi?id=184410
2805
2806         Reviewed by Timothy Hatcher.
2807
2808         Implemented navigation to URL and page number (same-document) link annotations in PDFs.
2809
2810         * UIProcess/ios/WKPDFView.mm:
2811         (-[WKPDFView _scrollToURLFragment:]):
2812         (-[WKPDFView web_didSameDocumentNavigation:]):
2813         (-[WKPDFView pdfHostViewController:updatePageCount:]):
2814         (-[WKPDFView pdfHostViewController:goToURL:]):
2815         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
2816
2817 2018-04-10  Andy Estes  <aestes@apple.com>
2818
2819         [iOS] WKPDFView should conform to _WKWebViewPrintProvider
2820         https://bugs.webkit.org/show_bug.cgi?id=184471
2821
2822         Reviewed by Dan Bernstein.
2823
2824         * UIProcess/API/Cocoa/WKWebView.mm:
2825         (-[WKWebView _printProvider]):
2826
2827         The print provider will always be either _contentView or _customContentView, but
2828         might not be _currentContentView.
2829
2830         * UIProcess/ios/WKPDFView.mm:
2831         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
2832
2833         Asked _hostViewController for the page count, clamped to 1 if
2834         -[_WKWebViewPrintFormatter snapshotFirstPage] is YES.
2835
2836         (-[WKPDFView _wk_printedDocument]):
2837
2838         Created a CGPDFDocumentRef from _data and returned it.
2839
2840 2018-04-10  Youenn Fablet  <youenn@apple.com>
2841
2842         Beacon redirect responses should be CORS validated
2843         https://bugs.webkit.org/show_bug.cgi?id=184378
2844
2845         Reviewed by Chris Dumez.
2846
2847         Add CORS checks to any redirection response if mode is CORS.
2848         Update response tainting and redirected accordingly.
2849
2850         * NetworkProcess/NetworkLoadChecker.cpp:
2851         (WebKit::NetworkLoadChecker::checkRedirection):
2852         (WebKit::NetworkLoadChecker::validateResponse):
2853         * NetworkProcess/NetworkLoadChecker.h:
2854         * NetworkProcess/PingLoad.cpp:
2855         (WebKit::PingLoad::willPerformHTTPRedirection):
2856
2857 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
2858
2859         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
2860         https://bugs.webkit.org/show_bug.cgi?id=184268
2861         <rdar://problem/39144446>
2862
2863         Reviewed by Chris Dumez.
2864
2865         Webpage for multipart stream responses failed to refresh because content policy was set to 
2866         be ignore when provisonalDocumentLoader was null and navigation ID could not be retrieved. 
2867         As loading should not stop in this case, we set navigation ID 0 and still ask for content 
2868         policy.
2869
2870         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2871         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2872
2873 2018-04-10  Andy Estes  <aestes@apple.com>
2874
2875         [iOS] Use PDFKit to render PDFs in WKWebView
2876         https://bugs.webkit.org/show_bug.cgi?id=184387
2877
2878         Reviewed by Beth Dakin.
2879
2880         Adopted PDFHostViewController for rendering PDFs in WKWebView.
2881
2882         This patch implements rendering the PDF document and page number indicator. Link
2883         navigation, find-in-page, and printing will be implemented in follow-up patches.
2884
2885         WKLegacyPDFView is still the default PDF view.
2886
2887         * Configurations/WebKit.xcconfig:
2888
2889         Linked WebKit with PDFKit on iOS.
2890
2891         * UIProcess/API/Cocoa/WKWebView.mm:
2892         (-[WKWebView _currentContentView]):
2893         (-[WKWebView viewForZoomingInScrollView:]):
2894
2895         When WKPDFView loads a PDF document, it replaces itself with a view vended by
2896         PDFHostViewController as the WKScrollView's content view. Abstracted WKWebView's
2897         concept of the "current content view" to be either the WKContentView or a view of
2898         the custom content view's choosing (-web_contentView).
2899
2900         (-[WKWebView scrollViewWillBeginZooming:withView:]):
2901         (-[WKWebView scrollViewDidZoom:]):
2902         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
2903
2904         Forwarded these calls to _customContentView if it responds to the equivalent
2905         WKWebViewContentProvider selectors.
2906
2907         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2908
2909         Defined new protocol selectors.
2910
2911         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2912         (-[WKWebViewContentProviderRegistry init]):
2913         * UIProcess/ios/WKLegacyPDFView.h:
2914         * UIProcess/ios/WKLegacyPDFView.mm:
2915
2916         Changed ENABLE(WKPDFVIEW) to ENABLE(WKLEGACYPDFVIEW).
2917
2918         (-[WKLegacyPDFView web_contentView]):
2919
2920         Added. Returns self as the content view.
2921
2922         * UIProcess/ios/WKPDFView.h: Added.
2923         * UIProcess/ios/WKPDFView.mm: Added.
2924         (-[WKPDFView dealloc]):
2925
2926         Removed the host view and page number indicator from their superviews.
2927
2928         (-[WKPDFView gestureRecognizerShouldBegin:]):
2929
2930         Forwarded to _hostViewController.
2931
2932         (-[WKPDFView web_initWithFrame:webView:]):
2933
2934         Set ours and the scroll view's background color to UIColor.grayColor to match
2935         WKLegacyPDFView.
2936
2937         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2938
2939         Created a PDFHostViewController and set its root view as the scroll view's content
2940         view after removing the WKPDFView itself. This allows WKPDFView to act as a
2941         placeholder content view until the PDF is loaded. Added the host view controller's
2942         page number indicator to the fixed overlay view. Finally, loaded the PDF document
2943         by calling -[PDFHostViewController setDocumentData:withScrollView:].
2944
2945         (-[WKPDFView _offsetForPageNumberIndicator]):
2946
2947         Computed an offset for the page number indicator like WKLegacyPDFView did, taking
2948         into account the overlaid accessory views inset, computed unobscured safe area
2949         inset, and computed obscured inset.
2950
2951         (-[WKPDFView _movePageNumberIndicatorToPoint:animated:]):
2952
2953         Moved the page number indicator using the margin and animation duration from
2954         WKLegacyPDFView.
2955
2956         (-[WKPDFView _updateLayoutAnimated:]):
2957
2958         Added a convenience method to update the PDF view layout and position the page
2959         number indicator.
2960
2961         (-[WKPDFView web_setMinimumSize:]):
2962
2963         Updated our own frame in case we are still the placeholder content view.
2964         Called -_updateLayoutAnimated:.
2965
2966         (-[WKPDFView web_setOverlaidAccessoryViewsInset:]):
2967
2968         Stored the inset and called -_updateLayoutAnimated:.
2969
2970         (-[WKPDFView web_computedContentInsetDidChange]):
2971
2972         Called -_updateLayoutAnimated:.
2973
2974         (-[WKPDFView web_setFixedOverlayView:]):
2975
2976         Stored the fixed overlay view.
2977
2978         (-[WKPDFView web_didSameDocumentNavigation:]):
2979         (-[WKPDFView web_countStringMatches:options:maxCount:]):
2980         (-[WKPDFView web_findString:options:maxCount:]):
2981         (-[WKPDFView web_hideFindUI]):
2982
2983         Added FIXMEs.
2984
2985         (-[WKPDFView web_contentView]):
2986
2987         If there is a host view controller, return its root view. Otherwise, return self.
2988
2989         (-[WKPDFView web_scrollViewDidScroll:]):
2990         (-[WKPDFView web_scrollViewWillBeginZooming:withView:]):
2991         (-[WKPDFView web_scrollViewDidEndZooming:withView:atScale:]):
2992         (-[WKPDFView web_scrollViewDidZoom:]):
2993
2994         Called -[PDFHostViewController updatePDFViewLayout].
2995
2996         (-[WKPDFView web_dataRepresentation]):
2997
2998         Returned _data.
2999
3000         (-[WKPDFView web_suggestedFilename]):
3001
3002         Returned _suggestedFilename.
3003
3004         (-[WKPDFView web_isBackground]):
3005
3006         Returned self.isBackground.
3007
3008         * UIProcess/ios/WKSystemPreviewView.mm:
3009         (-[WKSystemPreviewView web_contentView]):
3010
3011         Added. Returns self as the content view.
3012
3013         * WebKit.xcodeproj/project.pbxproj:
3014
3015 2018-04-10  Miguel Gomez  <magomez@igalia.com>
3016
3017         [GTK][WPE] Race condition when destroying webprocesses
3018         https://bugs.webkit.org/show_bug.cgi?id=184445
3019
3020         Reviewed by Carlos Garcia Campos.
3021
3022         Ensure that the WebProcess is properly closing its pages when it's exiting because
3023         the UIProcess has invalidated the IPC connection.
3024
3025         * WebProcess/WebProcess.cpp:
3026         (WebKit::WebProcess::didClose):
3027
3028 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3029
3030         Add missing availability macros after r230462
3031         https://bugs.webkit.org/show_bug.cgi?id=184426
3032
3033         Reviewed by Timothy Hatcher.
3034
3035         Annotate new SPI added in r230462 with the appropriate availability macros.
3036
3037         * UIProcess/API/Cocoa/WKViewPrivate.h:
3038         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3039
3040 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
3041
3042         Add ProcessPrivilege assertions to places that access NSApp
3043         https://bugs.webkit.org/show_bug.cgi?id=184322
3044         <rdar://problem/39194560>
3045
3046         Reviewed by Per Arne Vollan.
3047
3048         Add ProcessPrivilege assertions to places where we interact with NSApp so
3049         that we can prevent accidentally using them in the WebContent process.
3050
3051         * Shared/mac/ChildProcessMac.mm:
3052         (WebKit::ChildProcess::stopNSAppRunLoop):
3053         * Shared/mac/HangDetectionDisablerMac.mm:
3054         (WebKit::setClientsMayIgnoreEvents):
3055         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3056         (WebKit::WebProcessPool::platformInitializeWebProcess):
3057         * UIProcess/Cocoa/WebViewImpl.mm:
3058         (WebKit::WebViewImpl::WebViewImpl):
3059         (WebKit::WebViewImpl::becomeFirstResponder):
3060         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
3061         (WebKit::WebViewImpl::validateUserInterfaceItem):
3062         (WebKit::WebViewImpl::startSpeaking):
3063         (WebKit::WebViewImpl::stopSpeaking):
3064         (WebKit::applicationFlagsForDrag):
3065         (WebKit::WebViewImpl::doneWithKeyEvent):
3066         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
3067         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
3068         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
3069         (WebKit::PluginProcessProxy::enterFullscreen):
3070         (WebKit::PluginProcessProxy::beginModal):
3071         (WebKit::PluginProcessProxy::endModal):
3072         * UIProcess/mac/DisplayLink.cpp:
3073         (WebKit::DisplayLink::DisplayLink):
3074         (WebKit::DisplayLink::~DisplayLink):
3075         * UIProcess/mac/PageClientImplMac.mm:
3076         (WebKit::PageClientImpl::isViewWindowActive):
3077         (WebKit::PageClientImpl::setCursor):
3078         * UIProcess/mac/WebPageProxyMac.mm:
3079         (WebKit::WebPageProxy::getIsSpeaking):
3080         (WebKit::WebPageProxy::speak):
3081         (WebKit::WebPageProxy::stopSpeaking):
3082         (WebKit::WebPageProxy::startDisplayLink):
3083         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3084         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
3085
3086 2018-04-09  John Wilander  <wilander@apple.com>
3087
3088         Refactor Ignore HSTS code
3089         https://bugs.webkit.org/show_bug.cgi?id=184433
3090         <rdar://problem/39298238>
3091
3092         Reviewed by Darin Adler.
3093
3094         This patch refactors our ignore HSTS code. The convenience functions are moved
3095         out of CFNetwork SPI in PAL, and into where they are used. It also switches
3096         from performSelector: calls to straight function calls, after checking that
3097         there is a responder.
3098
3099         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3100         (schemeWasUpgradedDueToDynamicHSTS):
3101         (setIgnoreHSTS):
3102         (ignoreHSTS):
3103             Add convenience functions here since they were moved out of
3104             CFNetworkSPI.h.
3105
3106 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3107
3108         Rename UNUSED to BUNUSED
3109         https://bugs.webkit.org/show_bug.cgi?id=184093
3110
3111         Reviewed by Yusuke Suzuki.
3112
3113         * UIProcess/API/Cocoa/WKWebView.mm:
3114         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
3115
3116 2018-04-09  Timothy Hatcher  <timothy@apple.com>
3117
3118         Add support for setting a background color on WKWebView and WKView
3119         https://bugs.webkit.org/show_bug.cgi?id=184426
3120
3121         Reviewed by Wenson Hsieh.
3122
3123         * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property.
3124         * UIProcess/API/Cocoa/WKWebView.mm:
3125         (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl.
3126         (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl.
3127         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property.
3128         * UIProcess/API/mac/WKView.mm:
3129         (-[WKView _backgroundColor]): Added. Call through to WebViewImpl.
3130         (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl.
3131         * UIProcess/Cocoa/WebViewImpl.h:
3132         * UIProcess/Cocoa/WebViewImpl.mm:
3133         (WebKit::WebViewImpl::setBackgroundColor): Added.
3134         (WebKit::WebViewImpl::backgroundColor const): Added.
3135         (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set.
3136
3137 2018-04-09  Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
3138
3139         [WinCairo] Add WebKit Shared/win event files for wincairo webkit
3140         https://bugs.webkit.org/show_bug.cgi?id=183043
3141
3142         Reviewed by Brent Fulgham.
3143
3144         * Shared/NativeWebKeyboardEvent.h:
3145         (WebKit::NativeWebKeyboardEvent::nativeEvent const):
3146         * Shared/NativeWebMouseEvent.h:
3147         (WebKit::NativeWebMouseEvent::nativeEvent const):
3148         * Shared/NativeWebTouchEvent.h:
3149         * Shared/NativeWebWheelEvent.h:
3150         (WebKit::NativeWebWheelEvent::nativeEvent const):
3151         * Shared/win/NativeWebKeyboardEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
3152         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
3153         * Shared/win/NativeWebMouseEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
3154         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
3155         * Shared/win/NativeWebTouchEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebTouchEvent.h.
3156         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
3157         * Shared/win/NativeWebWheelEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
3158         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
3159         * Shared/win/WebEventFactory.cpp: Added.
3160         (WebKit::relativeCursorPosition):
3161         (WebKit::point):
3162         (WebKit::horizontalScrollChars):
3163         (WebKit::verticalScrollLines):
3164         (WebKit::clickCount):
3165         (WebKit::IsKeyInDownState):
3166         (WebKit::modifiersForEvent):
3167         (WebKit::modifiersForCurrentKeyState):
3168         (WebKit::keyboardEventTypeForEvent):
3169         (WebKit::isSystemKeyEvent):
3170         (WebKit::isKeypadEvent):
3171         (WebKit::textFromEvent):
3172         (WebKit::unmodifiedTextFromEvent):
3173         (WebKit::keyIdentifierFromEvent):
3174         (WebKit::WebEventFactory::createWebMouseEvent):
3175         (WebKit::WebEventFactory::createWebWheelEvent):
3176         (WebKit::WebEventFactory::createWebKeyboardEvent):
3177         (WebKit::WebEventFactory::createWebTouchEvent):
3178         * Shared/win/WebEventFactory.h: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
3179         (WebKit::createNativeEvent):
3180
3181 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
3182
3183         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
3184         https://bugs.webkit.org/show_bug.cgi?id=184344
3185         <rdar://problem/39224969>
3186
3187         Reviewed by Per Arne Vollan.
3188
3189         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
3190         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
3191         we do not want to allow in the WebContent process.
3192
3193         Instead, we should just use the cached screen information the WebContent process already possesses.
3194
3195         This patch makes the following changes:
3196         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
3197            the WindowServer directly.
3198         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
3199            the user space version of the coordinates. A nil Window just means we want to get coordinates in
3200            terms of the primary display.
3201         3. Keep track of the primary display so we can refer to it later.
3202         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
3203         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
3204            than whichever screen happened to hash to the lowest value.
3205
3206         Reviewed by Per Arne Vollan.
3207
3208         * UIProcess/WebProcessPool.cpp:
3209         (WebKit::displayReconfigurationCallBack): Update for new getScreenProperties implementation.
3210         (WebKit::WebProcessPool::initializeNewWebProcess): Ditto.
3211         * WebProcess/WebProcess.cpp:
3212         (WebKit::WebProcess::setScreenProperties): Ditto.
3213         * WebProcess/WebProcess.h:
3214         * WebProcess/WebProcess.messages.in: Ditto.
3215
3216 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3217
3218         [WPE] Add API version to library soname and pkg-config files
3219         https://bugs.webkit.org/show_bug.cgi?id=180608
3220
3221         Reviewed by Žan Doberšek.
3222
3223         * PlatformWPE.cmake:
3224         * wpe/wpe-webkit.pc.in:
3225
3226 2018-04-09  Jer Noble  <jer.noble@apple.com>
3227
3228         Fix the selection assistant selectionView build
3229         https://bugs.webkit.org/show_bug.cgi?id=184423
3230         <rdar://problem/39288235>
3231
3232         Reviewed by Wenson Hsieh.
3233
3234         * Platform/spi/ios/UIKitSPI.h:
3235         * UIProcess/ios/WKContentView.mm:
3236         (-[WKContentView _didExitStableState]):
3237         * UIProcess/ios/WKContentViewInteraction.mm:
3238         (-[WKContentView _updateChangedSelection:]):
3239
3240 2018-04-09  Megan Gardner  <megan_gardner@apple.com>
3241
3242         Switch to UIWKTextInteractionAssistant for non-editable text
3243         https://bugs.webkit.org/show_bug.cgi?id=182834
3244
3245         Switch to only using one assistant for text selection.
3246
3247         Reviewed by Timothy Hatcher and Andy Estes.
3248
3249         * UIProcess/ios/WKContentViewInteraction.mm:
3250         (-[WKContentView useSelectionAssistantWithGranularity:]):
3251
3252 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3253
3254         Unreviewed, move 'using namespace' back to the right place after r230429
3255
3256         * Shared/glib/ProcessExecutablePathGLib.cpp:
3257
3258 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3259
3260         Unreviewed, rolling out r230390.
3261
3262         Broke accelerated compositing
3263
3264         Reverted changeset:
3265
3266         "[GTK] WaylandCompositorDisplay leaks its wl_display"
3267         https://bugs.webkit.org/show_bug.cgi?id=184406
3268         https://trac.webkit.org/changeset/230390
3269
3270 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3271
3272         [Extra zoom mode] Disable fast clicking by default in extra zoom mode
3273         https://bugs.webkit.org/show_bug.cgi?id=184411
3274         <rdar://problem/38726867>
3275
3276         Reviewed by Andy Estes.
3277
3278         As it turns out, existing fast-clicking heuristics don't work so well in extra zoom mode. Even at device-width,
3279         since the page is scaled to fit within the viewport, having single taps take precedence over double taps leads
3280         to a confusing experience when trying to double tap to zoom further on content that contains links and other
3281         click targets. Revert to legacy behavior here by disabling these heuristics.
3282
3283         * UIProcess/API/Cocoa/WKWebView.mm:
3284         (-[WKWebView _initializeWithConfiguration:]):
3285
3286 2018-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3287
3288         [Extra zoom mode] Add an SPI hook for clients to opt in to focus overlay UI
3289         https://bugs.webkit.org/show_bug.cgi?id=184370
3290         <rdar://problem/39250494>
3291
3292         Reviewed by Timothy Hatcher and Andy Estes.
3293
3294         Add a new SPI hook for internal clients to opt in to showing the focused form control overlay. By default, the
3295         overlay is not shown.
3296
3297         * UIProcess/API/Cocoa/_WKInputDelegate.h:
3298
3299 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3300
3301         [WPE] Use GNU install directories
3302         https://bugs.webkit.org/show_bug.cgi?id=184377
3303
3304         Reviewed by Carlos Garcia Campos.
3305
3306         Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
3307         WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
3308
3309         * PlatformWPE.cmake:
3310         * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
3311         (WebKit::getExecutablePath):
3312         (WebKit::findWebKitProcess):
3313         (WebKit::executablePathOfWebProcess):
3314         (WebKit::executablePathOfPluginProcess):
3315         (WebKit::executablePathOfNetworkProcess):
3316         (WebKit::executablePathOfStorageProcess):
3317         * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
3318         * SourcesGTK.txt:
3319         * SourcesWPE.txt:
3320
3321 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3322
3323         [GTK] WaylandCompositorDisplay leaks its wl_display
3324         https://bugs.webkit.org/show_bug.cgi?id=184406
3325
3326         Reviewed by Carlos Garcia Campos.
3327
3328         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
3329         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
3330         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): Fix the leak.
3331
3332 2018-04-08  Zan Dobersek  <zdobersek@igalia.com>
3333
3334         Non-Cocoa ports use default directory for ServiceWorker data during testing
3335         https://bugs.webkit.org/show_bug.cgi?id=183784
3336
3337         Reviewed by Youenn Fablet.
3338
3339         Add API to WKWebsiteDataStore that enables setting and retrieving the
3340         service worker registration directory for a given data store object.
3341         This enables setting the temporary directory for testing purposes in
3342         WebKitTestRunner.
3343
3344         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3345         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
3346         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
3347         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3348
3349 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
3350
3351         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
3352         https://bugs.webkit.org/show_bug.cgi?id=184127
3353
3354         Reviewed by Konstantin Tokarev.
3355
3356         * CMakeLists.txt: Link with WebCore as private,
3357         WebCoreHeaderInterface as public to WebKit if WebCore is a static
3358         library.
3359         * CMakeLists.txt:
3360         * PlatformGTK.cmake: Added PRIVATE keyword for WebKit_LIBRARIES.
3361         * PlatformWPE.cmake: Ditto.
3362         * PlatformWin.cmake: Ditto.
3363
3364 2018-04-08  Andy Estes  <aestes@apple.com>
3365
3366         [iOS] WKContentView and WKLegacyPDFView should share application state tracking logic
3367         https://bugs.webkit.org/show_bug.cgi?id=184402
3368
3369         Reviewed by Dan Bernstein.
3370
3371         WKContentView and WKLegacyPDFView have nearly identical logic for tracking
3372         application foreground state. Let's share it so we can more easily create new
3373         content views with proper application state tracking.
3374
3375         * UIProcess/ios/WKApplicationStateTrackingView.h: Added.
3376         * UIProcess/ios/WKApplicationStateTrackingView.mm: Added.
3377         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
3378         (-[WKApplicationStateTrackingView willMoveToWindow:]):
3379         (-[WKApplicationStateTrackingView didMoveToWindow]):
3380         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
3381         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]):
3382         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
3383         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
3384         (-[WKApplicationStateTrackingView isBackground]):
3385
3386         Moved common logic from WKContentView and WKLegacyPDFView into
3387         WKApplicationStateTrackingView.
3388
3389         * UIProcess/ios/WKContentView.h:
3390         * UIProcess/ios/WKContentView.mm:
3391         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
3392         (-[WKContentView willMoveToWindow:]):
3393         (-[WKContentView _applicationDidCreateWindowContext]):
3394         (-[WKContentView didMoveToWindow]): Deleted.
3395         (-[WKContentView isBackground]): Deleted.
3396         (-[WKContentView _applicationDidEnterBackground]): Deleted.
3397         (-[WKContentView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
3398         (-[WKContentView _applicationWillEnterForeground]): Deleted.
3399
3400         Made WKContentView a subclass of WKApplicationStateTrackingView.
3401
3402         * UIProcess/ios/WKLegacyPDFView.h:
3403         * UIProcess/ios/WKLegacyPDFView.mm:
3404         (-[WKLegacyPDFView web_initWithFrame:webView:]):
3405         (-[WKLegacyPDFView web_isBackground]):
3406         (-[WKLegacyPDFView _applicationWillEnterForeground]):
3407         (-[WKLegacyPDFView willMoveToWindow:]): Deleted.
3408         (-[WKLegacyPDFView didMoveToWindow]): Deleted.
3409         (-[WKLegacyPDFView _applicationDidEnterBackground]): Deleted.
3410         (-[WKLegacyPDFView _applicationDidCreateWindowContext]): Deleted.
3411         (-[WKLegacyPDFView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
3412
3413         Made WKLegacyPDFView a subclass of WKApplicationStateTrackingView.
3414
3415         * WebKit.xcodeproj/project.pbxproj:
3416
3417 2018-04-08  Dan Bernstein  <mitz@apple.com>
3418
3419         [Cocoa] Keep library validation disabled for WebContent.Development
3420         https://bugs.webkit.org/show_bug.cgi?id=184393
3421
3422 &nbs