[iOS] Apps that are not visible may not get suspended if they trigger page loads...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-05-10  Chris Dumez  <cdumez@apple.com>
2
3         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
4         https://bugs.webkit.org/show_bug.cgi?id=185318
5
6         Reviewed by Geoffrey Garen.
7
8         Whenever there is a page load going on, we take a background process assertion to delay process
9         suspension until this load completes. However, there is also a 3 seconds grace period after
10         a load is complete to allow the app to trigger a new load shortly after. This grace period was
11         introduced to support use cases where a visible app does loads in an offscreen view. However,
12         it can be abused by apps running in the background as they could trigger new page loads while
13         in the background to delay process suspension. This patch tightens the policy so that only
14         apps that are currently visible get to use this grace period. Apps that are in the background
15         get to finish their current load and will then get suspended.
16
17         * UIProcess/Cocoa/NavigationState.mm:
18         (WebKit::NavigationState::didChangeIsLoading):
19
20 2018-05-10  Chris Dumez  <cdumez@apple.com>
21
22         'Cross-Origin-Options header implementation follow-up
23         https://bugs.webkit.org/show_bug.cgi?id=185520
24
25         Reviewed by Ryosuke Niwa.
26
27         * WebProcess/WebPage/WebPage.cpp:
28         (WebKit::WebPage::frameBecameRemote):
29
30 2018-05-10  Per Arne Vollan  <pvollan@apple.com>
31
32         Drop-down Control borders missing.
33         https://bugs.webkit.org/show_bug.cgi?id=185500
34         <rdar://problem/40093461>
35
36         Reviewed by Brent Fulgham.
37
38         Open sandbox for reading of some files in temp folder.
39
40         * WebProcess/com.apple.WebProcess.sb.in:
41
42 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
43
44         [MediaStream, iOS] Don't check authorizationStatusForMediaType when using mock capture devices
45         https://bugs.webkit.org/show_bug.cgi?id=185516
46         <rdar://problem/36328191>
47
48         Reviewed by Youenn Fablet.
49
50         * UIProcess/Cocoa/UIDelegate.mm:
51         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Don't check
52         +[AVCaptureDevice authorizationStatusForMediaType:] when using mock capture devices.
53
54 2018-05-10  Brent Fulgham  <bfulgham@apple.com>
55
56         REGRESSION(r230323): UIProcess needs to notify WebContent process of Accessibility setting changes
57         https://bugs.webkit.org/show_bug.cgi?id=185515
58         <rdar://problem/39627764>
59
60         Reviewed by Chris Fleizach.
61
62         The UIProcess needs to register for relevant Accessibility preference updates so that it can notify the
63         WebContent processes that screen properties have changed.
64
65         This is represented by NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
66
67         Tested manually with the Accessibility preferences pane.
68
69         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
70         (WebKit::WebProcessPool::registerNotificationObservers): Add notification observer. When the notification
71         is received, call 'screenPropertiesStateChanged' to message the information to the WebContent processes.
72         (WebKit::WebProcessPool::unregisterNotificationObservers): Clean up observer.
73         * UIProcess/WebProcessPool.cpp:
74         (WebKit::WebProcessPool::screenPropertiesStateChanged): Added helper function.
75         * UIProcess/WebProcessPool.h:
76
77 2018-05-09  Carlos Garcia Campos  <cgarcia@igalia.com>
78
79         WebDriver: implement advance user interactions
80         https://bugs.webkit.org/show_bug.cgi?id=174616
81
82         Reviewed by Brian Burg.
83
84         Handle origin in case of mouse move transitions.
85
86         * UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState
87         together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the
88         node in the current browsing context.
89         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
90         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location.
91         (WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current
92         location and mouse move origin.
93         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions.
94         (WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID.
95         (WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID.
96         * UIProcess/Automation/SimulatedInputDispatcher.h:
97         * UIProcess/Automation/WebAutomationSession.cpp:
98         (WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with
99         viewportInViewCenterPointOfElement() callbacks.
100         (WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or
101         viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd
102         or even number.
103         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the
104         WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks.
105         (WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle.
106         (WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher.
107         * UIProcess/Automation/WebAutomationSession.h:
108         * UIProcess/Automation/WebAutomationSessionMacros.h:
109
110 2018-05-09  Tim Horton  <timothy_horton@apple.com>
111
112         Remove the unused HAVE_OS_ACTIVITY
113         https://bugs.webkit.org/show_bug.cgi?id=185501
114
115         Reviewed by Wenson Hsieh.
116
117         * config.h:
118
119 2018-05-09  Chris Dumez  <cdumez@apple.com>
120
121         Add initial support for 'Cross-Origin-Options' HTTP response header
122         https://bugs.webkit.org/show_bug.cgi?id=184996
123         <rdar://problem/39664620>
124
125         Reviewed by Geoff Garen.
126
127         * Shared/WebPreferences.yaml:
128         Add this as an experimental feature, on by default.
129
130         * WebProcess/WebPage/WebPage.cpp:
131         (WebKit::WebPage::frameBecameRemote):
132         Make sure we pass the cross-origin options from the local Window
133         to the remote one when transitioning.
134
135 2018-05-09  Wenson Hsieh  <wenson_hsieh@apple.com>
136
137         [Extra zoom mode] fast/viewport/extrazoom/viewport-change-min-device-width.html sometimes fails
138         https://bugs.webkit.org/show_bug.cgi?id=185490
139         <rdar://problem/40097629>
140
141         Reviewed by Tim Horton.
142
143         This test is currently flaky due to incorrect logic when computing the unobscured content rect, in the slice of
144         time after a frame load has been committed, and before the first visible content rect update from the UI process
145         after the frame load has been committed.
146
147         * WebProcess/WebPage/ios/WebPageIOS.mm:
148         (WebKit::WebPage::viewportConfigurationChanged):
149
150         In the case where !m_hasReceivedVisibleContentRectsAfterDidCommitLoad, we try to set the unobscured content size
151         to be the view size divided by the initial scale. However, in extra zoom mode, `ViewportConfiguration`'s
152         `minimumLayoutSize()` is the layout size, which is larger than the size of the view by default, so dividing this
153         by the initial scale yields a bogus value. Instead, use `viewLayoutSize()` instead.
154
155         (WebKit::WebPage::updateViewportSizeForCSSViewportUnits):
156
157         We also try to divide the view size by the initial scale when computing the effective viewport size for `vw` and
158         `vh`. Additionally, fix the misleading name of a variable (largestUnobscuredRect) that stores a size.
159
160 2018-05-09  Brent Fulgham  <bfulgham@apple.com>
161
162         Restrict unarchiving of bundle parameters to a set of known classes
163         https://bugs.webkit.org/show_bug.cgi?id=185489
164         <rdar://problem/21912401>
165
166         Reviewed by Ryosuke Niwa.
167
168         Stop accepting anything derived from NSObject, and instead only agree to unarchive objects
169         from a set of things we actually pass as InjectedBundle parameters.
170
171         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
172         (WebKit::InjectedBundle::setBundleParameter):
173
174 2018-05-09  Richard Houle  <rhoule@apple.com>
175
176         [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
177         https://bugs.webkit.org/show_bug.cgi?id=185260
178         <rdar://problem/39290394>
179
180         INPUT element are not considered to be text fields when
181         calling -[WKWebProcessPlugInNodeHandle isTextField]
182         when they are of type number.
183
184         Reviewed by Tim Horton.
185
186         * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
187         (WebKit::InjectedBundleNodeHandle::isTextField const):
188
189 2018-05-09  Youenn Fablet  <youenn@apple.com>
190
191         Allow WebResourceLoader to cancel a load served from a service worker
192         https://bugs.webkit.org/show_bug.cgi?id=185274
193
194         Reviewed by Chris Dumez.
195
196         Use FetchIdentifier instead of uint64_t.
197         Add IPC support for cancelling a fetch from WebProcess to service worker process.
198         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
199         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
200         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
201         or to abort reading the readable stream.
202
203         * Scripts/webkit/messages.py:
204         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
205         (WebKit::WebSWServerConnection::cancelFetch):
206         (WebKit::WebSWServerConnection::startFetch):
207         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
208         (WebKit::WebSWServerConnection::didReceiveFetchData):
209         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
210         (WebKit::WebSWServerConnection::didFinishFetch):
211         (WebKit::WebSWServerConnection::didFailFetch):
212         (WebKit::WebSWServerConnection::didNotHandleFetch):
213         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
214         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
215         * StorageProcess/StorageProcess.cpp:
216         (WebKit::StorageProcess::didFailFetch):
217         (WebKit::StorageProcess::didNotHandleFetch):
218         (WebKit::StorageProcess::didReceiveFetchResponse):
219         (WebKit::StorageProcess::didReceiveFetchData):
220         (WebKit::StorageProcess::didReceiveFetchFormData):
221         (WebKit::StorageProcess::didFinishFetch):
222         * StorageProcess/StorageProcess.h:
223         * StorageProcess/StorageProcess.messages.in:
224         * WebProcess/Network/WebLoaderStrategy.cpp:
225         (WebKit::WebLoaderStrategy::remove):
226         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
227         (WebKit::ServiceWorkerClientFetch::create):
228         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
229         (WebKit::ServiceWorkerClientFetch::start):
230         (WebKit::ServiceWorkerClientFetch::cancel):
231         * WebProcess/Storage/ServiceWorkerClientFetch.h:
232         * WebProcess/Storage/WebSWClientConnection.cpp:
233         (WebKit::WebSWClientConnection::startFetch):
234         (WebKit::WebSWClientConnection::cancelFetch):
235         * WebProcess/Storage/WebSWClientConnection.h:
236         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
237         (WebKit::WebSWContextManagerConnection::cancelFetch):
238         (WebKit::WebSWContextManagerConnection::startFetch):
239         * WebProcess/Storage/WebSWContextManagerConnection.h:
240         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
241         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
242         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
243         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
244         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
245         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
246         (WebKit::WebServiceWorkerProvider::handleFetch):
247         (WebKit::WebServiceWorkerProvider::cancelFetch):
248         (WebKit::WebServiceWorkerProvider::fetchFinished):
249         * WebProcess/Storage/WebServiceWorkerProvider.h:
250
251 2018-05-09  Andy Estes  <aestes@apple.com>
252
253         [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
254         https://bugs.webkit.org/show_bug.cgi?id=185472
255         <rdar://problem/39967092>
256
257         Reviewed by Daniel Bates.
258
259         Adopted new PDFHostViewControllerDelegate methods that include annotation rects
260         when URLs and page indices are long-pressed. This allows us to avoid obscuring
261         annotations when positioning action sheet popovers.
262
263         We also no longer need to convert the press location into host view coordinate
264         space, as PDFKit now does that for us.
265
266         * UIProcess/ios/WKPDFView.mm:
267         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
268         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
269         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
270         (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
271         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
272         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
273
274 2018-05-09  Andy Estes  <aestes@apple.com>
275
276         [iOS] Tell PDFHostViewController when animated resizes begin and end
277         https://bugs.webkit.org/show_bug.cgi?id=185477
278         <rdar://problem/39875372>
279
280         Reviewed by Anders Carlsson.
281
282         * UIProcess/API/Cocoa/WKWebView.mm:
283         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
284         (-[WKWebView _endAnimatedResize]):
285         * UIProcess/Cocoa/WKWebViewContentProvider.h:
286         * UIProcess/ios/WKPDFView.mm:
287         (-[WKPDFView web_beginAnimatedResize]):
288         (-[WKPDFView web_endAnimatedResize]):
289
290 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
291
292         Unreviewed. Update OptionsWPE.cmake and NEWS for 2.21.1 release.
293
294         * wpe/NEWS: Added. Add release notes for 2.21.1.
295
296 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
297
298         [WPE] Build cleanly with GCC 8 and ICU 60
299         https://bugs.webkit.org/show_bug.cgi?id=185462
300
301         Reviewed by Carlos Alberto Lopez Perez.
302
303         * Platform/IPC/glib/GSocketMonitor.cpp:
304         (IPC::GSocketMonitor::start): Silence -Wcast-function-type warning.
305         * Shared/API/glib/WebKitContextMenu.cpp:
306         (webkit_context_menu_new_with_items): Ditto.
307
308 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
309
310         Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
311         https://bugs.webkit.org/show_bug.cgi?id=185261
312         <rdar://problem/37214391>
313
314         Reviewed by Chris Dumez.
315
316         By adopting new async SPI _savecookies, we can keep networking process active(not suspended)
317         until cookies are fully synced to disk with process assertion.
318
319         * NetworkProcess/NetworkProcess.cpp:
320         (WebKit::NetworkProcess::didSyncAllCookies):
321         * NetworkProcess/NetworkProcess.h:
322         * NetworkProcess/NetworkProcess.messages.in:
323         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
324         (WebKit::NetworkProcess::syncAllCookies):
325         * UIProcess/Network/NetworkProcessProxy.cpp:
326         (WebKit::NetworkProcessProxy::didClose):
327         (WebKit::NetworkProcessProxy::syncAllCookies):
328         (WebKit::NetworkProcessProxy::didSyncAllCookies):
329         * UIProcess/Network/NetworkProcessProxy.h:
330         * UIProcess/Network/NetworkProcessProxy.messages.in:
331         * UIProcess/WebProcessPool.cpp:
332         (WebKit::WebProcessPool::syncNetworkProcessCookies):
333
334 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
335
336         Set colorspace in the PDF plugin.
337         https://bugs.webkit.org/show_bug.cgi?id=185445
338         <rdar://problem/40030981>
339
340         Reviewed by Simon Fraser.
341
342         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
343         * WebProcess/Plugins/PDF/PDFPlugin.mm:
344         (WebKit::PDFPlugin::PDFPlugin):
345
346 2018-05-08  Megan Gardner  <megan_gardner@apple.com>
347
348         Don't clear selection until we are actually interacting with a Node.
349         https://bugs.webkit.org/show_bug.cgi?id=185455
350
351         Reviewed by Wenson Hsieh.
352         
353         The presence of TextInteractionAssistant should not be used as a proxy for it we are actually editing content.
354         We need to check to see if we have an active node, and then we should clear the selection.
355
356         * UIProcess/ios/WKContentViewInteraction.mm:
357         (-[WKContentView setSelectedTextRange:]):
358
359 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
360
361         Unreviewed, rolling out r231486.
362
363         Caused service worker LayoutTest failures on macOS Debug WK2.
364
365         Reverted changeset:
366
367         "Allow WebResourceLoader to cancel a load served from a
368         service worker"
369         https://bugs.webkit.org/show_bug.cgi?id=185274
370         https://trac.webkit.org/changeset/231486
371
372 2018-05-08  Andy Estes  <aestes@apple.com>
373
374         [iOS] _WKWebViewPrintFormatter should return a page count of 0 for PDF documents that do not allow printing
375         https://bugs.webkit.org/show_bug.cgi?id=185133
376
377         Reviewed by Andreas Kling.
378
379         * UIProcess/ios/WKPDFView.mm:
380         (-[WKPDFView _ensureDocumentForPrinting]):
381         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
382         (-[WKPDFView _wk_printedDocument]):
383
384 2018-05-08  Andy Estes  <aestes@apple.com>
385
386         [iOS] WKPDFView remains in the view hierarchy after navigating away
387         https://bugs.webkit.org/show_bug.cgi?id=185449
388         <rdar://problem/39693469>
389
390         Reviewed by Tim Horton.
391
392         WKPDFView removes the PDF host view from the view hierarchy in its -dealloc
393         method, and relies on WKWebView releasing its last reference in
394         -_setHasCustomContentView:loadedMIMEType: when the user navigates.
395
396         However, WKWPDFView was capturing a strong reference to self in the block passed
397         to +[PDFHostViewController createHostView:forExtensionIdentifier:], and PDFKit
398         (actually UIKit) is retaining this block beyond its being called. This results in
399         the PDF host view remaining as a child of the WKScrollView even after the user
400         navigates to another page.
401
402         Changed the aforementioned block to a lambda that captures a weak reference to
403         self to prevent WKPDFView from outliving the current navigation.
404
405         * UIProcess/ios/WKPDFView.mm:
406         (-[WKPDFView retain]):
407         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
408
409 2018-05-08  John Wilander  <wilander@apple.com>
410
411         Storage Access API: Make user opt-in sticky
412         https://bugs.webkit.org/show_bug.cgi?id=185454
413         <rdar://problem/40003946>
414
415         Reviewed by Alex Christensen.
416
417         This patch persists the user's choice to opt-in to access under specific domains.
418         Such storage access should age out with the accessing domain's cookies and website
419         data. The opt-in prompt is still an experimental feature.
420
421         * UIProcess/WebResourceLoadStatisticsStore.cpp:
422         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
423         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
424         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
425         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
426         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
427         (WebKit::WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt const):
428         (WebKit::WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction const):
429         * UIProcess/WebResourceLoadStatisticsStore.h:
430
431 2018-05-08  Daniel Bates  <dabates@apple.com>
432
433         Do not apply X-Frame-Options and CSP frame-ancestors to Quick Look-applicable responses in NetworkProcess
434         https://bugs.webkit.org/show_bug.cgi?id=185442
435         <rdar://problem/40067209>
436
437         Reviewed by Andy Estes.
438
439         Just as we exempt responses in WebContent process that will be handled by Quick Look from the Content
440         Security Policy frame-ancestors directive and X-Frame-Options checking we need to do the same when
441         such checks are performed in NetworkProcess following r231479.
442
443         HTTP responses that will be previewed using Quick Look are not considered web pages and are subject
444         to the security model for Quick Look documents. That is, they are exempt from Content Security Policy
445         and X-Frame-Options processing.
446
447         * NetworkProcess/NetworkResourceLoader.cpp:
448         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
449
450 2018-05-08  Brian Burg  <bburg@apple.com>
451
452         REGRESSION(r230743): Mousemove events are not coalesced properly, mousemove/drag is very laggy
453         https://bugs.webkit.org/show_bug.cgi?id=185425
454         <rdar://problem/39323336>
455
456         Reviewed by Simon Fraser.
457
458         When mousemove events come in faster than they can be processed, we should coalesce
459         pending mousemoves that have not yet been sent to WebProcess. This has the effect of
460         processing the most recent mousemove location, which is the old behavior that regressed.
461
462         * UIProcess/WebPageProxy.cpp:
463         (WebKit::WebPageProxy::handleMouseEvent):
464         If there is >1 event in the mouse queue, then the first one is being processed by WebProcess
465         and the second one is eligible for coalescing. Replace it if the last event and new event
466         are both mousemoves.
467
468 2018-05-08  Per Arne Vollan  <pvollan@apple.com>
469
470         The PDF context menu should not be created in the WebContent process.
471         https://bugs.webkit.org/show_bug.cgi?id=185401
472
473         Reviewed by Tim Horton.
474
475         Send a sync IPC message from the WebContent process to the UI process with the necessary context
476         menu information when the menu is requested. The NSMenu will then be created and shown in the
477         UI process. The reply will contain the selected menu item index.
478
479         * Shared/mac/PDFContextMenu.h: Added.
480         (WebKit::PDFContextMenuItem::encode const):
481         (WebKit::PDFContextMenuItem::decode):
482         (WebKit::PDFContextMenu::encode const):
483         (WebKit::PDFContextMenu::decode):
484         * UIProcess/WebPageProxy.h:
485         * UIProcess/WebPageProxy.messages.in:
486         * UIProcess/mac/WebPageProxyMac.mm:
487         (-[WKPDFMenuTarget menuItem]):
488         (-[WKPDFMenuTarget contextMenuAction:]):
489         (WebKit::WebPageProxy::showPDFContextMenu):
490         * WebKit.xcodeproj/project.pbxproj:
491         * WebProcess/Plugins/PDF/PDFPlugin.mm:
492         (WebKit::PDFPlugin::handleContextMenuEvent):
493
494 2018-05-08  Dean Jackson  <dino@apple.com>
495
496         System Preview links should trigger a download
497         https://bugs.webkit.org/show_bug.cgi?id=185439
498         <rdar://problem/40065545>
499
500         Reviewed by Jon Lee.
501
502         Encode the new field identifying a system preview. And
503         if you encounter such a resource request, trigger
504         a download.
505
506         * Shared/WebCoreArgumentCoders.cpp:
507         (IPC::ArgumentCoder<ResourceRequest>::encode):
508         (IPC::ArgumentCoder<ResourceRequest>::decode):
509         * UIProcess/WebPageProxy.cpp:
510         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
511
512 2018-05-08  John Wilander  <wilander@apple.com>
513
514         Storage Access API: Add a request roundtrip to check whether prompting is needed
515         https://bugs.webkit.org/show_bug.cgi?id=185368
516         <rdar://problem/40011556>
517
518         Reviewed by Alex Christensen and Youenn Fablet.
519
520         This patch adds an enum WebKit::StorageAccessStatus to handle our three access
521         states:
522         - WebKit::StorageAccessStatus::CannotRequestAccess.
523             This means the domain is blocked from cookie access.
524         - WebKit::StorageAccessStatus::RequiresUserPrompt.
525             This means that access has not been granted yet and a prompt is required.
526         - WebKit::StorageAccessStatus::HasAccess.
527             This either means that this domain does not need to ask for access,
528             access was already granted, or access was granted now.
529
530         If the call to WebResourceLoadStatisticsStore::requestStorageAccess() comes
531         back as WebKit::StorageAccessStatus::RequiresUserPrompt, the WebPageProxy
532         prompts the user and if the user said yes, calls a direct
533         WebResourceLoadStatisticsStore::grantStorageAccess().
534
535         Existing test cases pass because requestStorageAccessConfirm in WKPage.cpp
536         does not have m_client.requestStorageAccessConfirm and thus returns true.
537
538         * UIProcess/Network/NetworkProcessProxy.messages.in:
539             Added a missing #endif.
540         * UIProcess/WebPageProxy.cpp:
541         (WebKit::WebPageProxy::requestStorageAccess):
542             Here we now handle the various cases encoded in WebKit::StorageAccessStatus.
543         * UIProcess/WebResourceLoadStatisticsStore.cpp:
544         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
545             Now covers the optional prompt case.
546         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
547         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
548         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessInternal):
549             Granting access is broken out to allow WebKit::WebPageProxy to call it
550             directly.
551         * UIProcess/WebResourceLoadStatisticsStore.h:
552         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
553         (WebKit::WebsiteDataStore::requestStorageAccess):
554         (WebKit::WebsiteDataStore::grantStorageAccess):
555             Piping through calls from from WebKit::WebResourceLoadStatisticsStore
556             to WebKit::WebPageProxy.
557         * UIProcess/WebsiteData/WebsiteDataStore.h:
558
559 2018-05-08  Chris Dumez  <cdumez@apple.com>
560
561         Unreviewed, rolling out r231376 and r231458.
562
563         Caused some API tests failures on iOS
564
565         Reverted changesets:
566
567         "[iOS] Apps that are not visible may not get suspended if they
568         trigger page loads while in the background"
569         https://bugs.webkit.org/show_bug.cgi?id=185318
570         https://trac.webkit.org/changeset/231376
571
572         "[iOS] Release page load process assertion if the screen is
573         locked"
574         https://bugs.webkit.org/show_bug.cgi?id=185333
575         https://trac.webkit.org/changeset/231458
576
577 2018-05-08  Dean Jackson  <dino@apple.com>
578
579         Use thumbnails in System Previews
580         https://bugs.webkit.org/show_bug.cgi?id=185397
581         <rdar://problem/40039376>
582
583         Reviewed by Jon Lee.
584
585         A system preview that goes through the WKWebViewContentProvider will
586         show a static thumbnail/snapshot of the item, rather than jumping
587         directly to QuickLook.
588
589         This means we have to link to the AssetViewer framework. That provides
590         a ASVThumbnailView that will trigger QuickLook for us.
591
592         * Configurations/WebKit.xcconfig: Link to AssetViewer.
593
594         * UIProcess/ios/WKSystemPreviewView.h: Better macro use. Remove some unneeded protocols.
595         * UIProcess/ios/WKSystemPreviewView.mm:
596         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): Update this
597         to use an ASVThumbnailView, when on the internal SDK (because it is private).
598         (-[WKSystemPreviewView _layoutThumbnailView]): Use the content insets to put
599         the thumbnail in the right place.
600         (-[WKSystemPreviewView thumbnailView:wantsToPresentPreviewController:forItem:]):
601         Delegate method.
602         (-[WKSystemPreviewView web_contentView]):
603         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
604         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): Deleted.
605         (-[WKSystemPreviewView previewController:previewItemAtIndex:]): Deleted.
606         (-[WKSystemPreviewView previewControllerWillDismiss:]): Deleted.
607
608 2018-05-08  Youenn Fablet  <youenn@apple.com>
609
610         Allow WebResourceLoader to cancel a load served from a service worker
611         https://bugs.webkit.org/show_bug.cgi?id=185274
612
613         Reviewed by Chris Dumez.
614
615         Use FetchIdentifier instead of uint64_t.
616         Add IPC support for cancelling a fetch from WebProcess to service worker process.
617         Ask service worker process to cancel the fetch when its corresponding WebResourceLoader is cancelled.
618         No change of behavior as once a WebResourceLoader is cancelled, any related IPC is not processed.
619         A follow-up patch should try to cancel the FetchResponse load, meaning to either cancel the network load
620         or to abort reading the readable stream.
621
622         * Scripts/webkit/messages.py:
623         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
624         (WebKit::WebSWServerConnection::cancelFetch):
625         (WebKit::WebSWServerConnection::startFetch):
626         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
627         (WebKit::WebSWServerConnection::didReceiveFetchData):
628         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
629         (WebKit::WebSWServerConnection::didFinishFetch):
630         (WebKit::WebSWServerConnection::didFailFetch):
631         (WebKit::WebSWServerConnection::didNotHandleFetch):
632         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
633         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
634         * StorageProcess/StorageProcess.cpp:
635         (WebKit::StorageProcess::didFailFetch):
636         (WebKit::StorageProcess::didNotHandleFetch):
637         (WebKit::StorageProcess::didReceiveFetchResponse):
638         (WebKit::StorageProcess::didReceiveFetchData):
639         (WebKit::StorageProcess::didReceiveFetchFormData):
640         (WebKit::StorageProcess::didFinishFetch):
641         * StorageProcess/StorageProcess.h:
642         * StorageProcess/StorageProcess.messages.in:
643         * WebProcess/Network/WebLoaderStrategy.cpp:
644         (WebKit::WebLoaderStrategy::remove):
645         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
646         (WebKit::ServiceWorkerClientFetch::create):
647         (WebKit::ServiceWorkerClientFetch::ServiceWorkerClientFetch):
648         (WebKit::ServiceWorkerClientFetch::start):
649         (WebKit::ServiceWorkerClientFetch::cancel):
650         * WebProcess/Storage/ServiceWorkerClientFetch.h:
651         * WebProcess/Storage/WebSWClientConnection.cpp:
652         (WebKit::WebSWClientConnection::startFetch):
653         (WebKit::WebSWClientConnection::cancelFetch):
654         * WebProcess/Storage/WebSWClientConnection.h:
655         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
656         (WebKit::WebSWContextManagerConnection::cancelFetch):
657         (WebKit::WebSWContextManagerConnection::startFetch):
658         * WebProcess/Storage/WebSWContextManagerConnection.h:
659         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
660         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
661         (WebKit::WebServiceWorkerFetchTaskClient::WebServiceWorkerFetchTaskClient):
662         (WebKit::WebServiceWorkerFetchTaskClient::cancel):
663         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
664         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
665         (WebKit::WebServiceWorkerProvider::handleFetch):
666         (WebKit::WebServiceWorkerProvider::cancelFetch):
667         (WebKit::WebServiceWorkerProvider::fetchFinished):
668         * WebProcess/Storage/WebServiceWorkerProvider.h:
669
670 2018-05-08  Antti Koivisto  <antti@apple.com>
671
672         Don't use mapped cache files in case of Class A/B protected app
673         https://bugs.webkit.org/show_bug.cgi?id=185422
674         <rdar://problem/34001688>
675
676         Reviewed by Chris Dumez.
677
678         Currently we don't use shared memory maps in these cases. This still leaves us open for crashes
679         in the network process when the device is locked.
680
681         This patch disables use of blob storage (mapped cache files) in apps that use class A/B protection.
682         Normally we use blobs for resources > 16KB. Since use of shared memory is already disabled,
683         the only optimization lost for these apps is body data deduplication.
684
685         Any existing cache entries with blobs are ignored and deleted. New entries are created with
686         body data inlined with the metadata.
687
688         * NetworkProcess/cache/NetworkCache.cpp:
689         (WebKit::NetworkCache::Cache::store):
690         * NetworkProcess/cache/NetworkCache.h:
691         (WebKit::NetworkCache::Cache::canUseSharedMemoryForBodyData const): Deleted.
692         * NetworkProcess/cache/NetworkCacheEntry.cpp:
693         (WebKit::NetworkCache::Entry::initializeShareableResourceHandleFromStorageRecord const):
694
695             Remove the code the prevented use of shared memory in these cases. Non-mapped Data objects
696             are never shareable.
697
698         (WebKit::NetworkCache::Entry::setNeedsValidation):
699         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
700         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
701         (WebKit::NetworkCache::canUseSharedMemoryForPath): Deleted.
702         * NetworkProcess/cache/NetworkCacheFileSystem.h:
703         * NetworkProcess/cache/NetworkCacheStorage.cpp:
704         (WebKit::NetworkCache::Storage::Storage):
705         (WebKit::NetworkCache::Storage::mayContainBlob const):
706         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
707         (WebKit::NetworkCache::shouldStoreBodyAsBlob): Deleted.
708         * NetworkProcess/cache/NetworkCacheStorage.h:
709         (WebKit::NetworkCache::Storage::canUseSharedMemoryForBodyData const): Deleted.
710
711 2018-05-07  Carlos Garcia Campos  <cgarcia@igalia.com>
712
713         Unreviewed. Add missing exit not included in r231298.
714
715         * WebProcess/WebProcess.cpp:
716         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
717
718 2018-05-07  Daniel Bates  <dabates@apple.com>
719
720         Check X-Frame-Options and CSP frame-ancestors in network process
721         https://bugs.webkit.org/show_bug.cgi?id=185410
722         <rdar://problem/37733934>
723
724         Reviewed by Ryosuke Niwa.
725
726         * NetworkProcess/NetworkResourceLoadParameters.cpp:
727         (WebKit::NetworkResourceLoadParameters::encode const): Always encode the frame ancestor origins.
728         (WebKit::NetworkResourceLoadParameters::decode): Always decode the frame ancestor origins.
729         * NetworkProcess/NetworkResourceLoader.cpp:
730         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Added.
731         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions): Added.
732         (WebKit::NetworkResourceLoader::didReceiveResponse): Check if the load needs to be interrupted due
733         to a violation of the CSP frame-ancestors directive or X-Frame-Options. If there is a violation
734         then stop the load.
735         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Ditto.
736         (NetworkResourceLoader::addConsoleMessage): Added.
737         (NetworkResourceLoader::sendCSPViolationReport): Added.
738         * NetworkProcess/NetworkResourceLoader.h:
739         * Scripts/webkit/messages.py: Teach the generator about data types MessageLevel and MessageSource
740         as they are both defined in file JavaScriptCore/ConsoleTypes.h as opposed to independent headers.
741         Also tell the generator that these types should not be forward declared so that we can use these
742         types without their JSC:: prefix in WebPage.messages.in.
743         * WebProcess/Network/NetworkProcessConnection.cpp:
744         (WebKit::NetworkProcessConnection::didReceiveMessage): Route WebPage messages to the appropriate
745         web page.
746         * WebProcess/Network/WebLoaderStrategy.cpp:
747         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Added message StopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied.
748         * WebProcess/Network/WebResourceLoader.cpp:
749         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Added.
750         * WebProcess/Network/WebResourceLoader.h:
751         * WebProcess/Network/WebResourceLoader.messages.in:
752         * WebProcess/WebPage/WebFrame.cpp:
753         (WebKit::WebFrame::addConsoleMessage):
754         * WebProcess/WebPage/WebFrame.h:
755         * WebProcess/WebPage/WebPage.cpp:
756         (WebKit::WebPage::addConsoleMessage): Added.
757         (WebKit::WebPage::sendCSPViolationReport): Added.
758         * WebProcess/WebPage/WebPage.h:
759         * WebProcess/WebPage/WebPage.messages.in: Add messages AddConsoleMessage and SendCSPViolationReport
760         for adding a console message to Web Inspector and sending a CSP report, respectively.
761
762 2018-05-07  Daniel Bates  <dabates@apple.com>
763
764         Abstract logic to log console messages and send CSP violation reports into a client
765         https://bugs.webkit.org/show_bug.cgi?id=185393
766         <rdar://problem/40036053>
767
768         Reviewed by Brent Fulgham.
769
770         For now, build a URL from the source origin associated with the NetworkResourceLoader
771         and pass this to the ContentSecurityPolicy constructor.
772
773         Additionally, make NetworkLoadChecker::contentSecurityPolicy() non-const since it returns
774         a non-const pointer to a ContentSecurityPolicy object; => callers can mutate this object
775         right from under NetworkLoadChecker. Making this non-const makes this clear to a reader.
776         Also remove the mutable keyword from the definition of NetworkLoadChecker::m_contentSecurityPolicy.
777
778         * NetworkProcess/NetworkLoadChecker.cpp:
779         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
780         (WebKit::NetworkLoadChecker::contentSecurityPolicy const): Deleted.
781         * NetworkProcess/NetworkLoadChecker.h:
782
783 2018-05-07  Alex Christensen  <achristensen@webkit.org>
784
785         WebResourceLoadStatisticsStore::requestStorageAccess should call its completion handler on the main thread
786         https://bugs.webkit.org/show_bug.cgi?id=185403
787
788         Reviewed by Brent Fulgham.
789
790         * UIProcess/WebResourceLoadStatisticsStore.cpp:
791         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
792
793 2018-05-07  Chris Dumez  <cdumez@apple.com>
794
795         [iOS] Release page load process assertion if the screen is locked
796         https://bugs.webkit.org/show_bug.cgi?id=185333
797
798         Reviewed by Geoffrey Garen.
799
800         We normally take a background process assertion during page loads to allow them to complete
801         even if the tab / app is backgrounded. We should however avoid doing so when the backgrounding
802         is caused by the screen locking. Keeping the process assertion in this case would prevent the
803         whole device from sleeping longer than it should, thus negatively impacting power.
804
805         * UIProcess/Cocoa/NavigationState.h:
806         * UIProcess/Cocoa/NavigationState.mm:
807         (WebKit::NavigationState::NavigationState):
808         (WebKit::NavigationState::releaseNetworkActivityToken):
809         (WebKit::NavigationState::didChangeIsLoading):
810         * UIProcess/ios/WebPageProxyIOS.mm:
811         (WebKit::WebPageProxy::applicationDidEnterBackground):
812
813 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
814
815         Add experimental feature to prompt for Storage Access API use
816         https://bugs.webkit.org/show_bug.cgi?id=185335
817         <rdar://problem/39994649>
818
819         Reviewed by Alex Christensen and Youenn Fablet.
820
821         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
822         Storage Access API is invoked.
823
824         Currently this feature doesn't have any user-visible impact.
825
826         * Shared/API/APIObject.h:
827         * Shared/API/c/WKBase.h:
828         * Shared/WebPreferences.yaml:
829         * UIProcess/API/APIUIClient.h:
830         (API::UIClient::requestStorageAccessConfirm):
831         * UIProcess/API/C/WKPage.cpp:
832         (WebKit::RequestStorageAccessConfirmResultListener::create):
833         (WebKit::RequestStorageAccessConfirmResultListener::~RequestStorageAccessConfirmResultListener):
834         (WebKit::RequestStorageAccessConfirmResultListener::call):
835         (WebKit::RequestStorageAccessConfirmResultListener::RequestStorageAccessConfirmResultListener):
836         (WKPageRequestStorageAccessConfirmResultListenerGetTypeID):
837         (WKPageRequestStorageAccessConfirmResultListenerCall):
838         (WKPageSetPageUIClient):
839         * UIProcess/API/C/WKPageUIClient.h:
840         * UIProcess/API/Cocoa/WKPreferences.mm:
841         (-[WKPreferences _storageAccessPromptsEnabled]):
842         (-[WKPreferences _setStorageAccessPromptsEnabled:]):
843         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
844         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
845         * UIProcess/Cocoa/UIDelegate.h:
846         * UIProcess/Cocoa/UIDelegate.mm:
847         (WebKit::UIDelegate::setDelegate):
848         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
849         * UIProcess/WebPageProxy.cpp:
850         (WebKit::WebPageProxy::requestStorageAccessConfirm):
851         * UIProcess/WebPageProxy.h:
852         * UIProcess/WebPageProxy.messages.in:
853         * UIProcess/WebPreferences.cpp:
854         (WebKit::WebPreferences::update):
855         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
856         (WebKit::WebChromeClient::requestStorageAccess):
857
858 2018-05-07  Dean Jackson  <dino@apple.com>
859
860         Use a dark gray for system preview bbackground
861         https://bugs.webkit.org/show_bug.cgi?id=185391
862         <rdar://problem/40035120>
863
864         Reviewed by Eric Carlson.
865
866         Throw some darker shade at this view.
867
868         * UIProcess/ios/WKSystemPreviewView.mm:
869         (-[WKSystemPreviewView web_initWithFrame:webView:]):
870
871 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
872
873         [Win] Add missing methods to WebChromeClient
874         https://bugs.webkit.org/show_bug.cgi?id=185325
875
876         Reviewed by Brent Fulgham.
877
878         * WebProcess/WebCoreSupport/WebChromeClient.h:
879
880 2018-05-07  Megan Gardner  <megan_gardner@apple.com>
881
882         Allow Web Touch events to timeout
883         https://bugs.webkit.org/show_bug.cgi?id=185282
884
885         Reviewed by Tim Horton.
886         
887         This is backwards, fixing.
888
889         * UIProcess/WebPageProxy.cpp:
890         (WebKit::WebPageProxy::handleTouchEventSynchronously):
891
892 2018-05-07  Don Olmstead  <don.olmstead@sony.com>
893
894         [Win] LoggingWin is missing includes
895         https://bugs.webkit.org/show_bug.cgi?id=185326
896
897         Reviewed by Per Arne Vollan.
898
899         * Platform/win/LoggingWin.cpp:
900
901 2018-05-07  Daniel Bates  <dabates@apple.com>
902
903         CSP should be passed the referrer
904         https://bugs.webkit.org/show_bug.cgi?id=185367
905
906         Reviewed by Per Arne Vollan.
907
908         Pass the referrer through NetworkLoadChecker so that it can pass it to the ContentSecurityPolicy
909         object it instantiates.
910
911         * NetworkProcess/NetworkLoadChecker.cpp:
912         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
913         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
914         * NetworkProcess/NetworkLoadChecker.h:
915         (WebKit::NetworkLoadChecker::create):
916         * NetworkProcess/NetworkResourceLoader.cpp:
917         * NetworkProcess/PingLoad.cpp:
918         (WebKit::PingLoad::PingLoad):
919
920 2018-05-07  Daniel Bates  <dabates@apple.com>
921
922         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
923         https://bugs.webkit.org/show_bug.cgi?id=185170
924
925         Reviewed by Per Arne Vollan.
926
927         * WebProcess/WebProcess.cpp:
928         (WebKit::WebProcess::clearResourceCaches):
929         (WebKit::WebProcess::deleteWebsiteData):
930
931 2018-05-07  Brian Burg  <bburg@apple.com>
932
933         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
934         https://bugs.webkit.org/show_bug.cgi?id=184861
935         <rdar://problem/39153768>
936
937         Reviewed by Timothy Hatcher.
938
939         We need to track how many frontends are attached to the web page (both local and remote).
940         InspectorController propagates this out to WebKit via InspectorClient. This is then
941         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
942         new process for a navigation, return early with "no" if any frontends are open for the
943         page being navigated.
944
945         * UIProcess/WebPageProxy.h:
946         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
947         (WebKit::WebPageProxy::inspectorFrontendCount const):
948         * UIProcess/WebPageProxy.messages.in:
949         * UIProcess/WebProcessPool.cpp:
950         (WebKit::WebProcessPool::processForNavigation):
951         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
952         (WebKit::WebInspectorClient::frontendCountChanged):
953         * WebProcess/WebCoreSupport/WebInspectorClient.h:
954         * WebProcess/WebPage/WebPage.cpp:
955         (WebKit::WebPage::inspectorFrontendCountChanged):
956         * WebProcess/WebPage/WebPage.h:
957
958 2018-05-04  Tim Horton  <timothy_horton@apple.com>
959
960         Shift to a lower-level framework for simplifying URLs
961         https://bugs.webkit.org/show_bug.cgi?id=185334
962
963         Reviewed by Dan Bernstein.
964
965         * Configurations/WebKit.xcconfig:
966         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
967         (-[WKFullScreenWindowController _updateLocationInfo]):
968
969 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
970
971         Shutdown WindowServer connections after checking in with launch services
972         https://bugs.webkit.org/show_bug.cgi?id=185082
973         <rdar://problem/39613173>
974
975         Reviewed by Brent Fulgham.
976
977         When WindowServer access is blocked in the WebContent process, we should shutdown all connections
978         after checking in with launch services.
979
980         * WebProcess/cocoa/WebProcessCocoa.mm:
981         (WebKit::WebProcess::platformInitializeProcess):
982
983 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
984
985         [Win][WebKit] Fix forwarding headers for Windows build
986         https://bugs.webkit.org/show_bug.cgi?id=184412
987
988         Reviewed by Alex Christensen.
989
990         * PlatformWin.cmake:
991         * UIProcess/API/APIAttachment.h:
992         * UIProcess/API/APIContextMenuClient.h:
993         * UIProcess/API/C/WKProcessTerminationReason.h:
994         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
995
996 2018-05-04  Chris Dumez  <cdumez@apple.com>
997
998         [iOS] Apps that are not visible may not get suspended if they trigger page loads while in the background
999         https://bugs.webkit.org/show_bug.cgi?id=185318
1000
1001         Reviewed by Geoffrey Garen.
1002
1003         Whenever there is a page load going on, we take a background process assertion to delay process
1004         suspension until this load completes. However, there is also a 3 seconds grace period after
1005         a load is complete to allow the app to trigger a new load shortly after. This grace period was
1006         introduced to support use cases where a visible app does loads in an offscreen view. However,
1007         it can be abused by apps running in the background as they could trigger new page loads while
1008         in the background to delay process suspension. This patch tightens the policy so that only
1009         apps that are currently visible get to use this grace period. Apps that are in the background
1010         get to finish their current load and will then get suspended.
1011
1012         * UIProcess/Cocoa/NavigationState.mm:
1013         (WebKit::NavigationState::didChangeIsLoading):
1014
1015 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
1016
1017         Adjust sandbox profile for simulator.
1018         https://bugs.webkit.org/show_bug.cgi?id=185319
1019
1020         Reviewed by Brent Fulgham.
1021
1022         Disable Kerberos rules, as well as rules related to NSApplication initialization.
1023
1024         * WebProcess/com.apple.WebProcess.sb.in:
1025
1026 2018-05-04  Tim Horton  <timothy_horton@apple.com>
1027
1028         Wasted time dlopening Lookup when tearing down a WKWebView
1029         https://bugs.webkit.org/show_bug.cgi?id=185310
1030         <rdar://problem/39934085>
1031
1032         Reviewed by Wenson Hsieh.
1033
1034         * UIProcess/Cocoa/WebViewImpl.h:
1035         * UIProcess/Cocoa/WebViewImpl.mm:
1036         (-[WKWindowVisibilityObserver dealloc]):
1037         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
1038         (WebKit::WebViewImpl::prepareForDictionaryLookup):
1039         (-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
1040         Avoid un-registering as a Lookup dismissal observer if we never
1041         registered in the first place, because that involves dlopening Lookup.
1042
1043 2018-05-04  Megan Gardner  <megan_gardner@apple.com>
1044
1045         Allow Web Touch events to timeout
1046         https://bugs.webkit.org/show_bug.cgi?id=185282
1047         <rdar://problem/38728319>
1048
1049         Reviewed by Tim Horton.
1050         
1051         Web Touch events currently never time out, which blocks the user from interacting with the UI Process at all.
1052         We should allow these events to time out so that the user can interact with the rest of the UI.
1053
1054         * UIProcess/WebPageProxy.cpp:
1055         (WebKit::WebPageProxy::handleTouchEventSynchronously):
1056
1057 2018-05-04  Wenson Hsieh  <whsieh@berkeley.edu>
1058
1059         REGRESSION: [ios-simulator] 3 WKWebViewAutofillTests API test failures seen with 11.3 SDK
1060         https://bugs.webkit.org/show_bug.cgi?id=184196
1061         <rdar://problem/39054481>
1062
1063         Reviewed by Tim Horton.
1064
1065         Remove an unnecessary call to NSClassFromString, now that trunk WebKit only supports iOS 11.3+.
1066
1067         * UIProcess/ios/WKContentViewInteraction.mm:
1068         (-[WKContentView insertTextSuggestion:]):
1069
1070 2018-05-04  Youenn Fablet  <youenn@apple.com>
1071
1072         NetworkProcessProxy::didReceiveAuthenticationChallenge should take an AuthenticationChallenge r-value
1073         https://bugs.webkit.org/show_bug.cgi?id=185302
1074
1075         Reviewed by Geoffrey Garen.
1076
1077         Pass AuthenticationChallenge as an r-value since it comes from IPC.
1078         No change of behavior.
1079
1080         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
1081         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
1082         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
1083         (WebKit::AuthenticationChallengeProxy::create):
1084         * UIProcess/Downloads/DownloadProxy.cpp:
1085         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
1086         * UIProcess/Downloads/DownloadProxy.h:
1087         * UIProcess/Network/NetworkProcessProxy.cpp:
1088         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1089         * UIProcess/Network/NetworkProcessProxy.h:
1090
1091 2018-05-04  Sihui Liu  <sihui_liu@apple.com>
1092
1093         Assertion failure in NetworkStorageSession::setCookie: privilege of UI process is not set
1094         https://bugs.webkit.org/show_bug.cgi?id=185262
1095
1096         Reviewed by Chris Dumez.
1097
1098         Fix an assertion failure by setting UI process privileges in constructor of WebsiteDataStore
1099         because UI process may use the cookie API before creating a WebView.
1100
1101         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1102         (WebKit::WebsiteDataStore::WebsiteDataStore):
1103
1104 2018-05-04  Per Arne Vollan  <pvollan@apple.com>
1105
1106         Adjust sandbox rules for simulator.
1107         https://bugs.webkit.org/show_bug.cgi?id=185275
1108
1109         Reviewed by Brent Fulgham.
1110
1111         Enable rules related to CoreMedia for minimal simulator.
1112
1113         * WebProcess/com.apple.WebProcess.sb.in:
1114
1115 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1116
1117         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
1118         https://bugs.webkit.org/show_bug.cgi?id=174730
1119
1120         Reviewed by Michael Catanzaro.
1121
1122         The problem is that we don't send any User-Agent HTTP header for downloads started by WebProcessPool::download().
1123
1124         * UIProcess/API/glib/WebKitDownload.cpp:
1125         (webkitDownloadUpdateRequest): Helper to update the cached request.
1126         (webkitDownloadStarted): Updated the cached request if we have one.
1127         (webkit_download_get_request): Use webkitDownloadUpdateRequest().
1128         * UIProcess/API/glib/WebKitDownloadClient.cpp:
1129         * UIProcess/API/glib/WebKitDownloadPrivate.h:
1130         * UIProcess/WebProcessPool.cpp:
1131         (WebKit::WebProcessPool::download): Set the User-Agent HTTP header if there isn't any.
1132
1133 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1134
1135         [GTK] Some event tests failing after r230817
1136         https://bugs.webkit.org/show_bug.cgi?id=185072
1137
1138         Reviewed by Michael Catanzaro.
1139
1140         Do not send mouse move events to the WebProcess for crossing events during testing. WTR never generates crossing
1141         events and they can confuse tests.
1142
1143         Fixes: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
1144                fast/css/user-drag-none.html
1145                fast/events/context-activated-by-key-event.html
1146                fast/events/drag-selects-image.html
1147                fast/events/dropzone-005.html
1148                fast/events/mouse-click-events.html
1149                fast/events/mouse-cursor-change.html
1150
1151         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1152         (webkitWebViewBaseCrossingNotifyEvent):
1153
1154 2018-05-03  Chris Dumez  <cdumez@apple.com>
1155
1156         More aggressively terminate child processes when the connection to their parent process is severed
1157         https://bugs.webkit.org/show_bug.cgi?id=177972
1158         <rdar://problem/33317607>
1159
1160         Reviewed by Geoff Garen.
1161
1162         More aggressively terminate child processes when the connection to their parent process is severed.
1163         Previously, we would dispatch to the main thread and then exit the process. This would sometimes
1164         cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the
1165         process. This could happen in particular when the main thread is blocked on a synchronous IPC.
1166
1167         * NetworkProcess/NetworkProcess.cpp:
1168         (WebKit::NetworkProcess::didClose): Deleted.
1169         * NetworkProcess/NetworkProcess.h:
1170         * PluginProcess/PluginProcess.cpp:
1171         (WebKit::PluginProcess::didClose): Deleted.
1172         * PluginProcess/PluginProcess.h:
1173         * Shared/ChildProcess.cpp:
1174         (WebKit::ChildProcess::didClose):
1175         (WebKit::didCloseOnConnectionWorkQueue):
1176         (WebKit::ChildProcess::terminationTimerFired):
1177         * Shared/ChildProcess.h:
1178         * StorageProcess/StorageProcess.cpp:
1179         (WebKit::StorageProcess::didClose): Deleted.
1180         * StorageProcess/StorageProcess.h:
1181         * WebProcess/WebProcess.cpp:
1182         (WebKit::WebProcess::didClose): Deleted.
1183         * WebProcess/WebProcess.h:
1184
1185 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1186
1187         Use default std::optional if it is provided
1188         https://bugs.webkit.org/show_bug.cgi?id=185159
1189
1190         Reviewed by Michael Catanzaro.
1191
1192         * Shared/SandboxExtension.h:
1193         (WebKit::SandboxExtension::Handle::decode):
1194         * Shared/TouchBarMenuItemData.cpp:
1195         (WebKit::TouchBarMenuItemData::decode):
1196
1197 2018-05-03  Justin Fan  <justin_fan@apple.com>
1198
1199         [WebGL] Add runtime flag for enabling ASTC support in WebGL
1200         https://bugs.webkit.org/show_bug.cgi?id=184840
1201
1202         Reviewed by Myles C. Maxfield.
1203
1204         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
1205
1206         * Shared/WebPreferences.yaml:
1207
1208 2018-05-03  Keith Rollin  <krollin@apple.com>
1209
1210         Unreviewed build fix after <https://trac.webkit.org/changeset/231282>.
1211
1212         * NetworkProcess/NetworkActivityTracker.h:
1213
1214 2018-05-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1215
1216         Ads in NYTimes app are shifted downwards by the scroll view's top content inset
1217         https://bugs.webkit.org/show_bug.cgi?id=185251
1218         <rdar://problem/39062357>
1219
1220         Reviewed by Tim Horton.
1221
1222         The NYTimes app embeds advertisements in each article's WKWebView by adding views in the WKScrollView's view
1223         hierarchy. These views are positioned using the bounding client rects of elements in the DOM (via Element
1224         ::getBoundingClientRect). Prior to r229641, WebKit would report bounding client rects inset by the content
1225         insets of WKScrollView, which means that if a top content inset X is specified on the scroll view, an element
1226         that is flush against the top of the viewport will have a bounding client rect top of -X (when it should really
1227         be 0).
1228
1229         To account for this, NYTimes adds the scroll view content insets back to the bounding client rect when
1230         determining the position of each advertisement which, after r229641, causes these views to be shifted downwards
1231         by an amount equal to the scroll view content inset top.
1232
1233         This new behavior does not affect Safari, since Safari uses SPI to explicitly set obscured insets. As such, we
1234         address this by gating the scroll view content inset fix with a linked-on-or-after check.
1235
1236         * UIProcess/API/Cocoa/WKWebView.mm:
1237         (-[WKWebView _computedObscuredInset]):
1238         * UIProcess/Cocoa/VersionChecks.h:
1239
1240 2018-05-03  Chris Dumez  <cdumez@apple.com>
1241
1242         Load hangs if the WebProcess fails to launch
1243         https://bugs.webkit.org/show_bug.cgi?id=185225
1244         <rdar://problem/38249058>
1245
1246         Reviewed by Geoff Garen.
1247
1248         When a process fails to launch, ChildProcessProxy::didFinishLaunching() gets called with an
1249         invalid connection identifier. While NetworkProcessProxy::didFinishLaunching() properly deals with
1250         this situation, WebProcessProxy::didFinishLaunching() does not. As a result, we do not attempt to
1251         relaunch the process, we do not notify the client and WebPageProxy::m_isValid stays true.
1252
1253         This patch thus updates WebProcessProxy::didFinishLaunching() to check if the connection identifier
1254         is valid and treats it as a crash. As a result, the WebPageProxies properly reset their state and
1255         the client gets notified of the crash so that it can attempt to reload.
1256
1257         * UIProcess/API/Cocoa/WKProcessPool.mm:
1258         (-[WKProcessPool _makeNextWebProcessLaunchFailForTesting]):
1259         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1260         * UIProcess/Launcher/ProcessLauncher.h:
1261         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1262         (WebKit::ProcessLauncher::launchProcess):
1263         Add SPI to make the next WebProcess launch fail, for the purpose of API testing.
1264
1265         * UIProcess/WebProcessPool.h:
1266         * UIProcess/WebProcessProxy.cpp:
1267         (WebKit::WebProcessProxy::getLaunchOptions):
1268         (WebKit::WebProcessProxy::didClose):
1269         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
1270         (WebKit::WebProcessProxy::didFinishLaunching):
1271         * UIProcess/WebProcessProxy.h:
1272
1273 2018-05-03  Commit Queue  <commit-queue@webkit.org>
1274
1275         Unreviewed, rolling out r231223 and r231288.
1276         https://bugs.webkit.org/show_bug.cgi?id=185256
1277
1278         The change in r231223 breaks internal builds, and r231288 is a
1279         dependent change. (Requested by ryanhaddad on #webkit).
1280
1281         Reverted changesets:
1282
1283         "Use default std::optional if it is provided"
1284         https://bugs.webkit.org/show_bug.cgi?id=185159
1285         https://trac.webkit.org/changeset/231223
1286
1287         "Use pointer instead of
1288         std::optional<std::reference_wrapper<>>"
1289         https://bugs.webkit.org/show_bug.cgi?id=185186
1290         https://trac.webkit.org/changeset/231288
1291
1292 2018-05-03  Per Arne Vollan  <pvollan@apple.com>
1293
1294         An error message is written to stderr when the WebContent process is blocking WindowServer access.
1295         https://bugs.webkit.org/show_bug.cgi?id=184701
1296
1297         Reviewed by Brent Fulgham.
1298
1299         Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
1300         access to the WindowServer in the WebContent process, will remove this error message. After this change,
1301         the url of the WebContent process is still showing up in Activity Monitor, which previously was a
1302         problem when calling 'setApplicationIsDaemon(true)'.
1303
1304         * WebProcess/WebProcess.cpp:
1305         (WebKit::WebProcess::initializeProcess):
1306         * WebProcess/cocoa/WebProcessCocoa.mm:
1307         (WebKit::WebProcess::platformInitializeProcess):
1308
1309 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
1310
1311         Unreviewed, rolling out r231253.
1312
1313         The API test added with this change is crashing on the bots.
1314
1315         Reverted changeset:
1316
1317         "Web Inspector: opt out of process swap on navigation if a Web
1318         Inspector frontend is connected"
1319         https://bugs.webkit.org/show_bug.cgi?id=184861
1320         https://trac.webkit.org/changeset/231253
1321
1322 2018-05-03  Brent Fulgham  <bfulgham@apple.com>
1323
1324         Re-eneable Network Extension support in the WebContent process
1325         https://bugs.webkit.org/show_bug.cgi?id=185236
1326         <rdar://problem/39883004>
1327
1328         Reviewed by Eric Carlson.
1329
1330         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1331         * WebProcess/com.apple.WebProcess.sb.in:
1332
1333 2018-05-03  Tim Horton  <timothy_horton@apple.com>
1334
1335         REGRESSION (r231014): Entitlements are not applied to XPC services on macOS
1336         https://bugs.webkit.org/show_bug.cgi?id=185241
1337
1338         Reviewed by Dan Bernstein.
1339
1340         * Configurations/BaseXPCService.xcconfig:
1341         * Configurations/WebContentService.Development.xcconfig:
1342         * Configurations/WebContentService.xcconfig:
1343
1344 2018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1345
1346         REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
1347         https://bugs.webkit.org/show_bug.cgi?id=183348
1348
1349         Reviewed by Michael Catanzaro.
1350
1351         When connection doesn't exit in case of sync message failure, always exit in case of failing to send
1352         GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
1353         and destroyed quickly.
1354
1355         * WebProcess/WebProcess.cpp:
1356         (WebKit::WebProcess::ensureNetworkProcessConnection):
1357         (WebKit::WebProcess::ensureWebToStorageProcessConnection):
1358
1359 2018-05-02  Nan Wang  <n_wang@apple.com>
1360
1361         AX: Missing kAXSWebAccessibilityEventsEnabledNotification causes a crash
1362         https://bugs.webkit.org/show_bug.cgi?id=185237
1363
1364         Reviewed by Dan Bernstein.
1365
1366         When libAccessibility.dylib is missing, the compiler would optimize out the global
1367         notification and lead to a crash. Fixed it by using the isNullFunction check instead,
1368         since we are sure the global notification would be there when the corresponding function 
1369         is available.
1370
1371         * UIProcess/API/Cocoa/WKWebView.mm:
1372         (-[WKWebView _initializeWithConfiguration:]):
1373
1374 2018-05-02  Keith Rollin  <krollin@apple.com>
1375
1376         Add facility for tracking times and results of page and resource loading
1377         https://bugs.webkit.org/show_bug.cgi?id=184838
1378         <rdar://problem/36548974>
1379
1380         Reviewed by Brent Fulgham.
1381
1382         Add NetworkActivityTracker. The idea behind this facility is to create
1383         and destroy them around networking activity that we want to track for
1384         the purpose of measuring overall network health. They can be created
1385         around the loading of pages or individual resources, and can be
1386         arranged in a parent/child hierarchy to indicate what pages the
1387         resources are part of. The NetworkActivity tracker tracks load times
1388         and results. On Cocoa, it can be integrated with CFNetwork in order to
1389         associate WebKit activity with low-level networking activity.
1390
1391         * CMakeLists.txt:
1392         * Configurations/WebKit.xcconfig:
1393         * NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
1394         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
1395         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
1396         (WebKit::NetworkActivityTracker::setParent):
1397         (WebKit::NetworkActivityTracker::start):
1398         (WebKit::NetworkActivityTracker::complete):
1399         * NetworkProcess/NetworkActivityTracker.h: Added.
1400         (WebKit::NetworkActivityTracker::getPlatformObject):
1401         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1402         (WebKit::NetworkConnectionToWebProcess::didClose):
1403         (WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
1404         (WebKit::networkActivityTrackingEnabled):
1405         (WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
1406         (WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
1407         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
1408         (WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
1409         (WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
1410         (WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
1411         * NetworkProcess/NetworkConnectionToWebProcess.h:
1412         (WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
1413         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1414         * NetworkProcess/NetworkDataTask.cpp:
1415         (WebKit::NetworkDataTask::create):
1416         * NetworkProcess/NetworkLoadParameters.h:
1417         * NetworkProcess/NetworkProcess.cpp:
1418         (WebKit::NetworkProcess::initializeNetworkProcess):
1419         * NetworkProcess/NetworkProcess.h:
1420         (WebKit::NetworkProcess::trackNetworkActivity const):
1421         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1422         (WebKit::NetworkProcessCreationParameters::encode const):
1423         (WebKit::NetworkProcessCreationParameters::decode):
1424         * NetworkProcess/NetworkProcessCreationParameters.h:
1425         * NetworkProcess/NetworkResourceLoader.cpp:
1426         (WebKit::NetworkResourceLoader::start):
1427         (WebKit::NetworkResourceLoader::cleanup):
1428         (WebKit::NetworkResourceLoader::abort):
1429         (WebKit::NetworkResourceLoader::didFinishLoading):
1430         (WebKit::NetworkResourceLoader::didFailLoading):
1431         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1432         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
1433         * NetworkProcess/NetworkResourceLoader.h:
1434         * NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
1435         (WebKit::NetworkActivityTracker::NetworkActivityTracker):
1436         (WebKit::NetworkActivityTracker::~NetworkActivityTracker):
1437         (WebKit::NetworkActivityTracker::setParent):
1438         (WebKit::NetworkActivityTracker::start):
1439         (WebKit::NetworkActivityTracker::complete):
1440         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1441         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1442         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1443         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1444         (API::ProcessPoolConfiguration::copy):
1445         * UIProcess/API/APIProcessPoolConfiguration.h:
1446         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1447         (WKContextConfigurationTrackNetworkActivity):
1448         (WKContextConfigurationSetTrackNetworkActivity):
1449         * UIProcess/API/C/WKContextConfigurationRef.h:
1450         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1451         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1452         (-[_WKProcessPoolConfiguration trackNetworkActivity]):
1453         (-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
1454         * UIProcess/WebProcessPool.cpp:
1455         (WebKit::WebProcessPool::ensureNetworkProcess):
1456         * WebKit.xcodeproj/project.pbxproj:
1457         * WebProcess/Network/WebLoaderStrategy.cpp:
1458         (WebKit::WebLoaderStrategy::pageLoadCompleted):
1459         * WebProcess/Network/WebLoaderStrategy.h:
1460
1461 2018-05-02  Jer Noble  <jer.noble@apple.com>
1462
1463         Open audio/video sandbox services for minimal simulator
1464         https://bugs.webkit.org/show_bug.cgi?id=185217
1465         <rdar://problem/39918909>
1466
1467         Reviewed by Per Arne Vollan.
1468
1469         * WebKit.xcodeproj/project.pbxproj:
1470         * WebProcess/com.apple.WebProcess.sb.in:
1471
1472 2018-05-02  Daniel Bates  <dabates@apple.com>
1473
1474         Cleanup NetworkResourceLoader::didReceiveResponse()
1475         https://bugs.webkit.org/show_bug.cgi?id=185209
1476
1477         Reviewed by Chris Dumez.
1478
1479         Use early returns to make the control flow easier to read and reason about. Disregarding a
1480         From-Origin violation, NetworkResourceLoader::didReceiveResponse() only returns NetworkLoadClient::ShouldContinueDidReceiveResponse::No
1481         when the load is for a main resource and hence it must wait for the embedding client to allow
1482         the load before continuing with it. With regards to a From-Origin violation, the network
1483         process schedules to fail the load in a subsequent turn of the event loop before returning
1484         NetworkLoadClient::ShouldContinueDidReceiveResponse::No. It return NetworkLoadClient::ShouldContinueDidReceiveResponse::No
1485         solely to tell the NetworkLoadClient to defer assuming the load is allowed (because we will
1486         fail it on the next turn of the event loop).
1487
1488         Additionally, remove all logging about the return value as we no longer have a need for
1489         such logging.
1490
1491         * NetworkProcess/NetworkResourceLoader.cpp:
1492         (WebKit::NetworkResourceLoader::didReceiveResponse):
1493
1494 2018-05-02  Alex Christensen  <achristensen@webkit.org>
1495
1496         Add WKWebsiteDataStorePrivate._proxyConfiguration SPI
1497         https://bugs.webkit.org/show_bug.cgi?id=185179
1498
1499         Reviewed by Andy Estes.
1500
1501         * NetworkProcess/NetworkSessionCreationParameters.h:
1502         (WebKit::NetworkSessionCreationParameters::encode const):
1503         (WebKit::NetworkSessionCreationParameters::decode):
1504         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1505         (WebKit::NetworkDataTaskCocoa::applySniffingPoliciesAndBindRequestToInferfaceIfNeeded):
1506         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1507         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1508         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1509         * Shared/WebsiteDataStoreParameters.cpp:
1510         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1511         * Shared/cf/ArgumentCodersCF.cpp:
1512         (IPC::encode):
1513         (IPC::decode):
1514         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1515         (-[WKWebsiteDataStore _setProxyConfiguration:]):
1516         (-[WKWebsiteDataStore _proxyConfiguration]):
1517         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1518         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1519         (WebKit::WebsiteDataStore::parameters):
1520         * UIProcess/WebsiteData/WebsiteDataStore.h:
1521         (WebKit::WebsiteDataStore::setProxyConfiguration):
1522         (WebKit::WebsiteDataStore::proxyConfiguration):
1523
1524 2018-05-02  Youenn Fablet  <youenn@apple.com>
1525
1526         Use NetworkLoadChecker for navigation loads
1527         https://bugs.webkit.org/show_bug.cgi?id=184892
1528         <rdar://problem/39652686>
1529
1530         Reviewed by Chris Dumez.
1531
1532         Compute whether a response is same origin in no-cors case.
1533         This allows providing more precise filtering.
1534         In case of navigate loads, set the tainting to basic which will make filtering to the minimum.
1535
1536         Pass the sourceOrigin for navigation loads as well.
1537         Enable to restrict HTTP response access for navigation load.
1538
1539         Content Blockers are disabled for now in NetworkLoadChecker for navigation loads.
1540         They should be reenabled as a follow-up.
1541
1542         Add a specific case to allow any redirection to about:// URLs.
1543         While this does not conform with the spec, this keeps the existing WebKit behavior.
1544
1545         * NetworkProcess/NetworkLoadChecker.cpp:
1546         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1547         (WebKit::NetworkLoadChecker::validateResponse):
1548         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1549         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
1550         * NetworkProcess/NetworkResourceLoader.cpp:
1551         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
1552         * WebProcess/Network/WebLoaderStrategy.cpp:
1553         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1554         (WebKit::WebLoaderStrategy::isDoingLoadingSecurityChecks const):
1555         We only do security checks if this runtime flag is on.
1556         * WebProcess/Network/WebLoaderStrategy.h:
1557
1558 2018-05-02  Jer Noble  <jer.noble@apple.com>
1559
1560         Make EncryptedMediaAPIEnabled an experimental feature
1561         https://bugs.webkit.org/show_bug.cgi?id=185212
1562
1563         Reviewed by Eric Carlson.
1564
1565         * Shared/WebPreferences.yaml:
1566
1567 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
1568
1569         Adjust sandbox profile in simulator mode.
1570         https://bugs.webkit.org/show_bug.cgi?id=185172
1571         <rdar://problem/39876860>
1572
1573         Reviewed by Brent Fulgham.
1574
1575         Fix some sandbox violations.
1576
1577         * WebProcess/com.apple.WebProcess.sb.in:
1578
1579 2018-05-02  Brian Burg  <bburg@apple.com>
1580
1581         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
1582         https://bugs.webkit.org/show_bug.cgi?id=184861
1583         <rdar://problem/39153768>
1584
1585         Reviewed by Ryosuke Niwa.
1586
1587         We need to track how many frontends are attached to the web page (both local and remote).
1588         InspectorController propagates this out to WebKit via InspectorClient. This is then
1589         kept in UIProcess as a member of WebPageProxy. When making a decision whether to use a
1590         new process for a navigation, return early with "no" if any frontends are open for the
1591         page being navigated.
1592
1593         * UIProcess/WebPageProxy.h:
1594         (WebKit::WebPageProxy::didChangeInspectorFrontendCount):
1595         (WebKit::WebPageProxy::inspectorFrontendCount const):
1596         * UIProcess/WebPageProxy.messages.in:
1597         * UIProcess/WebProcessPool.cpp:
1598         (WebKit::WebProcessPool::processForNavigation):
1599         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1600         (WebKit::WebInspectorClient::frontendCountChanged):
1601         * WebProcess/WebCoreSupport/WebInspectorClient.h:
1602         * WebProcess/WebPage/WebPage.cpp:
1603         (WebKit::WebPage::inspectorFrontendCountChanged):
1604         * WebProcess/WebPage/WebPage.h:
1605
1606 2018-05-02  Jer Noble  <jer.noble@apple.com>
1607
1608         Adopt -destinationWindowToExitFullScreenForWindow:
1609         https://bugs.webkit.org/show_bug.cgi?id=185204
1610         <rdar://problem/22486621>
1611
1612         Reviewed by Eric Carlson.
1613
1614         * UIProcess/mac/WKFullScreenWindowController.mm:
1615         (-[WKFullScreenWindowController destinationWindowToExitFullScreenForWindow:]):
1616
1617 2018-05-02  Per Arne Vollan  <pvollan@apple.com>
1618
1619         Disable Media capture rules in sandbox for simulator.
1620         https://bugs.webkit.org/show_bug.cgi?id=185206
1621         <rdar://problem/39910015>
1622
1623         Reviewed by Eric Carlson.
1624
1625         These rules are not relevant in this case.
1626
1627         * WebProcess/com.apple.WebProcess.sb.in:
1628
1629 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
1630
1631         [iOS] Provide audio route information when invoking AirPlay picker
1632         https://bugs.webkit.org/show_bug.cgi?id=185199
1633         <rdar://problem/39853103>
1634
1635         Reviewed by Jer Noble.
1636
1637         * Scripts/webkit/messages.py:
1638         * UIProcess/PageClient.h:
1639         * UIProcess/WebPageProxy.h:
1640         * UIProcess/WebPageProxy.messages.in:
1641         * UIProcess/ios/PageClientImplIOS.h:
1642         * UIProcess/ios/PageClientImplIOS.mm:
1643         (WebKit::PageClientImpl::showPlaybackTargetPicker):  Pass route sharing policy and routing context UID.
1644
1645         * UIProcess/ios/WKContentViewInteraction.h:
1646         * UIProcess/ios/WKContentViewInteraction.mm:
1647         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]): Take same.
1648         (-[WKContentView _showPlaybackTargetPicker:fromRect:]): Deleted.
1649
1650         * UIProcess/ios/WebPageProxyIOS.mm:
1651         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
1652
1653         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
1654         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1655         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:]): Take same.
1656         (-[WKAirPlayRoutePicker showFromView:]): Deleted.
1657
1658         * WebProcess/WebCoreSupport/WebChromeClient.h:
1659         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1660         (WebKit::WebChromeClient::showPlaybackTargetPicker):
1661
1662 2018-05-02  Jer Noble  <jer.noble@apple.com>
1663
1664         Get the WebKit.framework bundle by asking for WKWebView
1665         https://bugs.webkit.org/show_bug.cgi?id=185175
1666
1667         Reviewed by Tim Horton.
1668
1669         * NetworkProcess/mac/NetworkProcessMac.mm:
1670         (WebKit::NetworkProcess::initializeSandbox):
1671         * Shared/mac/ChildProcessMac.mm:
1672         (WebKit::ChildProcess::initializeSandbox):
1673         * StorageProcess/mac/StorageProcessMac.mm:
1674         (WebKit::StorageProcess::initializeSandbox):
1675
1676 2018-05-02  Youenn Fablet  <youenn@apple.com>
1677
1678         Cannot gather srflx or relay ICE candidates on IPv6 network (ICE agent hangs?)
1679         https://bugs.webkit.org/show_bug.cgi?id=181009
1680         <rdar://problem/36144555>
1681
1682         Reviewed by Eric Carlson.
1683
1684         On iOS/IPv6 networks, STUN servers name resolution returns a zero IPv6 IP address.
1685         No error is raised which leads to sending STUN requests with that IP address.
1686         Once the request times out, the ICE candidate gathering finishes with host candidates only.
1687
1688         This patch makes WebRTC DNS resolver to send only IPv4 resolved addresses.
1689         STUN is used for NAT traversal which is for IPv4 addresses.
1690         Not sending IPv6 addresses allows terminating ICE candidate gathering sooner.
1691
1692         Manually tested on iOS with IPv4/IPv6 and IPv6 networks.
1693
1694         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
1695         (WebKit::resolvedName):
1696
1697 2018-05-02  Youenn Fablet  <youenn@apple.com>
1698
1699         CacheStorage::Engine should keep a list of initialization callback
1700         https://bugs.webkit.org/show_bug.cgi?id=185184
1701         <rdar://problem/38875651>
1702
1703         Reviewed by Antti Koivisto.
1704
1705         Keep each initialize callback in a Vector so as to compute the salt only once.
1706         Call all callbacks then in a loop.
1707
1708         * NetworkProcess/cache/CacheStorageEngine.cpp:
1709         (WebKit::CacheStorage::Engine::~Engine):
1710         (WebKit::CacheStorage::Engine::initialize):
1711         * NetworkProcess/cache/CacheStorageEngine.h:
1712
1713 2018-05-02  Jer Noble  <jer.noble@apple.com>
1714
1715         Pipe volume through PlaybackSessionManager/Proxy.
1716         https://bugs.webkit.org/show_bug.cgi?id=185182
1717
1718         Reviewed by Eric Carlson.
1719
1720         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1721         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
1722         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1723         (WebKit::PlaybackSessionModelContext::setVolume):
1724         (WebKit::PlaybackSessionModelContext::volumeChanged):
1725         (WebKit::PlaybackSessionManagerProxy::volumeChanged):
1726         (WebKit::PlaybackSessionManagerProxy::setVolume):
1727         * WebProcess/cocoa/PlaybackSessionManager.h:
1728         * WebProcess/cocoa/PlaybackSessionManager.messages.in:
1729         * WebProcess/cocoa/PlaybackSessionManager.mm:
1730         (WebKit::PlaybackSessionInterfaceContext::volumeChanged):
1731         (WebKit::PlaybackSessionManager::volumeChanged):
1732         (WebKit::PlaybackSessionManager::setVolume):
1733
1734 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1735
1736         Use default std::optional if it is provided
1737         https://bugs.webkit.org/show_bug.cgi?id=185159
1738
1739         Reviewed by JF Bastien.
1740
1741         * Shared/SandboxExtension.h:
1742         (WebKit::SandboxExtension::Handle::decode):
1743         * Shared/TouchBarMenuItemData.cpp:
1744         (WebKit::TouchBarMenuItemData::decode):
1745
1746 2018-05-01  Jer Noble  <jer.noble@apple.com>
1747
1748         Production build error in Migrate Header phase when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
1749         https://bugs.webkit.org/show_bug.cgi?id=185171
1750
1751         Reviewed by Timothy Hatcher.
1752
1753         * Configurations/BaseTarget.xcconfig:
1754
1755 2018-05-01  Per Arne Vollan  <pvollan@apple.com>
1756
1757         Use correct runloop type in the WebContent process.
1758         https://bugs.webkit.org/show_bug.cgi?id=185140
1759
1760         Reviewed by Brent Fulgham.
1761
1762         Use WK_MACOS_* machinery to determine runloop type for the WebContent process.
1763
1764         * Configurations/WebContentService.xcconfig:
1765
1766 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
1767
1768         WebAssembly: add support for stream APIs - JavaScript API
1769         https://bugs.webkit.org/show_bug.cgi?id=183442
1770
1771         Reviewed by Yusuke Suzuki and JF Bastien.
1772
1773         Add WEBASSEMBLY_STREAMING_API feature flag
1774
1775         * Configurations/FeatureDefines.xcconfig:
1776
1777 2018-04-30  Per Arne Vollan  <pvollan@apple.com>
1778
1779         Use correct runloop type in the WebContent process.
1780         https://bugs.webkit.org/show_bug.cgi?id=185140
1781         <rdar://problem/39585037>
1782
1783         Reviewed by Brent Fulgham.
1784
1785         The macOS target version should be used to determine the runloop type.
1786
1787         * Configurations/WebContentService.xcconfig:
1788
1789 2018-04-30  Michael Saboff  <msaboff@apple.com>
1790
1791         Eliminate WebProcessShim.dylib
1792         https://bugs.webkit.org/show_bug.cgi?id=185147
1793
1794         Reviewed by Ryosuke Niwa.
1795
1796         * Configurations/WebContentService.xcconfig:
1797         * Configurations/WebProcessShim.xcconfig: Removed.
1798         * WebKit.xcodeproj/project.pbxproj:
1799
1800 2018-04-30  Michael Saboff  <msaboff@apple.com>
1801
1802         Remove unused mac/CookieStorageShimLibrary
1803         https://bugs.webkit.org/show_bug.cgi?id=185146
1804
1805         Reviewed by Alex Christensen.
1806
1807         * Shared/mac/CookieStorageShimLibrary.cpp: Removed.
1808         * Shared/mac/CookieStorageShimLibrary.h: Removed.
1809         * WebKit.xcodeproj/project.pbxproj:
1810
1811 2018-04-30  Alex Christensen  <achristensen@webkit.org>
1812
1813         Add WKUIDelegatePrivate equivalent of WKPageContextMenuClient getContextMenuFromProposedMenuAsync
1814         https://bugs.webkit.org/show_bug.cgi?id=180955
1815
1816         Reviewed by Andy Estes.
1817
1818         * UIProcess/API/APIContextMenuClient.h:
1819         (API::ContextMenuClient::menuFromProposedMenu):
1820         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1821         * UIProcess/Cocoa/UIDelegate.h:
1822         * UIProcess/Cocoa/UIDelegate.mm:
1823         (WebKit::UIDelegate::setDelegate):
1824         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
1825         * UIProcess/mac/WebContextMenuProxyMac.mm:
1826         (WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
1827
1828 2018-04-30  JF Bastien  <jfbastien@apple.com>
1829
1830         Use some C++17 features
1831         https://bugs.webkit.org/show_bug.cgi?id=185135
1832
1833         Reviewed by Alex Christensen.
1834
1835         As discussed here [0] let's move WebKit to a subset of C++17. We
1836         now require GCC 6 [1] which means that, according to [2] we can
1837         use the following C++17 language features (I removed some
1838         uninteresting ones):
1839
1840          - New auto rules for direct-list-initialization
1841          - static_assert with no message
1842          - typename in a template template parameter
1843          - Nested namespace definition
1844          - Attributes for namespaces and enumerators
1845          - u8 character literals
1846          - Allow constant evaluation for all non-type template arguments
1847          - Fold Expressions
1848          - Unary fold expressions and empty parameter packs
1849          - __has_include in preprocessor conditional
1850          - Differing begin and end types in range-based for
1851          - Improving std::pair and std::tuple
1852
1853         Consult the Tony Tables [3] to see before / after examples.
1854
1855         Of course we can use any library feature if we're willing to
1856         import them to WTF (and they don't require language support).
1857
1858
1859           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
1860           [1]: https://trac.webkit.org/changeset/231152/webkit
1861           [2]: https://en.cppreference.com/w/cpp/compiler_support
1862           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
1863
1864         * Configurations/Base.xcconfig:
1865         * DerivedSources.make:
1866         * PlatformMac.cmake:
1867
1868 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1869
1870         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
1871         https://bugs.webkit.org/show_bug.cgi?id=185132
1872         <rdar://problem/39834562>
1873
1874         Reviewed by Tim Horton.
1875
1876         Remove the experimental feature for `min-device-width`.
1877
1878         * Shared/WebPreferences.yaml:
1879
1880 2018-04-30  Keith Rollin  <krollin@apple.com>
1881
1882         Include breadcrumb for tracking resource loading into CFNetwork
1883         https://bugs.webkit.org/show_bug.cgi?id=184837
1884         rdar://problem/39575411
1885
1886         Reviewed by Brent Fulgham.
1887
1888         When starting the network-based loading of a resource, log the
1889         description provided by NetworkDataTask. On Cocoa, this is implemented
1890         to return the description property in NSURLSessionTask. This
1891         information better allows us to track a resource load through the
1892         WebContent process, the Networking process, and the Cocoa networking
1893         layers.
1894
1895         * NetworkProcess/NetworkDataTask.cpp:
1896         (WebKit::NetworkDataTask::description const):
1897         * NetworkProcess/NetworkDataTask.h:
1898         * NetworkProcess/NetworkLoad.cpp:
1899         (WebKit::NetworkLoad::description const):
1900         * NetworkProcess/NetworkLoad.h:
1901         * NetworkProcess/NetworkResourceLoader.cpp:
1902         (WebKit::NetworkResourceLoader::startNetworkLoad):
1903         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1904         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1905         (WebKit::NetworkDataTaskCocoa::description const):
1906
1907 2018-04-30  Andy Estes  <aestes@apple.com>
1908
1909         [iOS] Try to unlock PDF documents before printing them
1910         https://bugs.webkit.org/show_bug.cgi?id=185084
1911         <rdar://problem/39356622>
1912
1913         Reviewed by Dan Bernstein.
1914
1915         * UIProcess/ios/WKPDFView.mm:
1916         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
1917
1918         Stored the password that successfully unlocked the current PDF document.
1919
1920         (-[WKPDFView _wk_printedDocument]):
1921
1922         Used the stored password to unlock the CGPDFDocument we create for printing.
1923
1924 2018-04-28  Andy Estes  <aestes@apple.com>
1925
1926         [iOS] Present an action sheet when long-pressing on PDF links
1927         https://bugs.webkit.org/show_bug.cgi?id=185093
1928         <rdar://problem/39356651>
1929
1930         Reviewed by Dan Bernstein.
1931
1932         * UIProcess/ios/WKPDFView.mm:
1933         (-[WKPDFView dealloc]):
1934
1935         Called -[WKActionSheetAssistant cleanupSheet].
1936
1937         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1938
1939         Created a WKActionSheetAssistant with the host view as the assistant view and
1940         ourselves as the delegate.
1941
1942         (-[WKPDFView _URLWithPageIndex:]):
1943
1944         Added. Creates a URL to the current page with a page number fragment appended.
1945
1946         (-[WKPDFView _goToURL:atLocation:]):
1947
1948         Added. Navigates to a URL with a synthetic mouse click at a location in host view
1949         coordinates.
1950
1951         (-[WKPDFView pdfHostViewController:goToURL:]):
1952         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
1953
1954         Called -_goToURL:atLocation:. Used -_URLWithPageIndex: to construct an NSURL from
1955         a page index.
1956
1957         (-[WKPDFView _showActionSheetForURL:atLocation:]):
1958
1959         Added. Populates _positionInformation with a URL and location and calls
1960         -[WKActionSheetAssistant showLinkSheet].
1961
1962         (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]):
1963         (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]):
1964
1965         Called -_showActionSheetForURL:atLocation:. Used -_URLWithPageIndex: to construct
1966         an NSURL from a page index.
1967
1968         (-[WKPDFView positionInformationForActionSheetAssistant:]):
1969
1970         Returned _positionInformation.
1971
1972         (-[WKPDFView actionSheetAssistant:performAction:]):
1973
1974         Populated the pasteboard with plain text and URL representations of
1975         _positionInformation.url.
1976
1977         (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
1978
1979         Called -_goToURL:atLocation.
1980
1981         (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
1982
1983         Created a UIWKSelectionAssistant and called -showShareSheetFor:fromRect:.
1984
1985         (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
1986
1987         Returned API::UIClient::shouldIncludeAppLinkActionsForElement().
1988
1989         (-[WKPDFView actionSheetAssistant:decideActionsForElement:defaultActions:]):
1990
1991         Returned API::UIClient::actionsForElement()l
1992
1993 2018-04-28  Andy Estes  <aestes@apple.com>
1994
1995         [iOS] Allow com.apple.WebKit.Networking to look up com.apple.wifi.manager
1996         https://bugs.webkit.org/show_bug.cgi?id=185114
1997         <rdar://problem/39808763>
1998
1999         Reviewed by Wenson Hsieh.
2000
2001         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2002
2003 2018-04-28  Brent Fulgham  <bfulgham@apple.com>
2004
2005         Revise sandboxes to allow additional IOKit property access
2006         https://bugs.webkit.org/show_bug.cgi?id=185095
2007         <rdar://problem/39809455>
2008
2009         Reviewed by Eric Carlson.
2010
2011         Update the WebContent and Plugin processes to allow additional IOKit property access.
2012
2013         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2014         * WebProcess/com.apple.WebProcess.sb.in:
2015
2016 2018-04-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2017
2018         [GTK] WebProcess from WebKitGtk+ 2.19.92 SIGSEVs in WebCore::TextureMapperGL::~TextureMapperGL
2019         https://bugs.webkit.org/show_bug.cgi?id=184040
2020
2021         Reviewed by Michael Catanzaro.
2022
2023         This can happen when using single shared process model or when the process limit is reached in multiple process
2024         model. In this case, all pages in the same web process with accelerated compositing enabled share the same
2025         compositing thread. Every page sets its GL context as current when rendering a frame, but not when invalidating
2026         the threaded compositor when the page is closed. So, if a hidden tab is closed, the threaded compositor is
2027         invalidated and the GL resources of the current context (the visible page) are destroyed. This is also causing
2028         the blank pages issue when closing a tab related to another one, the current one stops rendering anything because
2029         its GL context has been released. We should make the threaded compositor context current when invalidating it.
2030
2031         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2032         (WebKit::ThreadedCompositor::invalidate):
2033
2034 2018-04-27  Timothy Hatcher  <timothy@apple.com>
2035
2036         REGRESSION: Touch events fail to dispatch to the page in all cases.
2037
2038         https://bugs.webkit.org/show_bug.cgi?id=185097
2039         rdar://problem/39731995
2040
2041         Reviewed by Tim Horton.
2042
2043         * UIProcess/ios/WKContentViewInteraction.mm:
2044         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2045         Consult internal gesture recognizers, otherwise NO might get returned.
2046
2047 2018-04-26  Ryosuke Niwa  <rniwa@webkit.org>
2048
2049         PSON: Triggering a navigation to an invalid URL creates a new WebContent process
2050         https://bugs.webkit.org/show_bug.cgi?id=185066
2051
2052         Reviewed by Youenn Fablet.
2053
2054         Don't create a new WebContent process when the target URL is invalid as well as when the source URL is invalid.
2055
2056         * UIProcess/WebProcessPool.cpp:
2057         (WebKit::WebProcessPool::processForNavigationInternal):
2058
2059 2018-04-27  Youenn Fablet  <youenn@apple.com>
2060
2061         Use NetworkLoadChecker for XHR/fetch loads
2062         https://bugs.webkit.org/show_bug.cgi?id=184741
2063
2064         Reviewed by Chris Dumez.
2065
2066         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2067         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
2068         Pass the preflight error as completion error if any.
2069         * NetworkProcess/NetworkLoad.cpp:
2070         (WebKit::NetworkLoad::willPerformHTTPRedirection):
2071         Set response source to Network so that checks relying on that are correct.
2072         * NetworkProcess/NetworkLoadChecker.cpp:
2073         (WebKit::NetworkLoadChecker::validateResponse):
2074         Adding Oppaqueredirect tainting.
2075         (NetworkLoadChecker::doesNotNeedCORSCheck):
2076         Adding a check to only activate CORS checks for CORS enabled schemes.
2077         Non CORS enabled schemes loads should have failed in WebProcess already.
2078         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
2079         Remove Authorization header as done by SubresourceLoader.
2080         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2081         If error is cancellation, we still want to call the completion handler.
2082         * NetworkProcess/NetworkResourceLoader.cpp:
2083         Activate network load checker for all types of loads.
2084         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2085         Handle manual redirection by directly calling didReceiveResponse.
2086
2087 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2088
2089         Add an experimental feature flag for viewport "min-device-width"
2090         https://bugs.webkit.org/show_bug.cgi?id=185050
2091         <rdar://problem/39624038>
2092
2093         Reviewed by Tim Horton.
2094
2095         Add MinDeviceWidthEnabled as a new experimental feature, on by default in extra zoom mode and off elsewhere.
2096
2097         * Shared/WebPreferences.yaml:
2098         * Shared/WebPreferencesDefaultValues.h:
2099
2100 2018-04-27  Daniel Bates  <dabates@apple.com>
2101
2102         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
2103         https://bugs.webkit.org/show_bug.cgi?id=185079
2104         <rdar://problem/39794960>
2105
2106         I inadvertently forgot to move the UIDelegate field webViewDidResignInputElementStrongPasswordAppearanceWithUserInfo
2107         outside the PLATFORM(MAC)-guard.
2108
2109         * UIProcess/Cocoa/UIDelegate.h:
2110
2111 2018-04-27  Daniel Bates  <dabates@apple.com>
2112
2113         UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance() is applicable to both Mac and iOS
2114         https://bugs.webkit.org/show_bug.cgi?id=185079
2115         <rdar://problem/39794960>
2116
2117         Reviewed by Andy Estes.
2118
2119         * UIProcess/Cocoa/UIDelegate.h:
2120         * UIProcess/Cocoa/UIDelegate.mm:
2121         (WebKit::UIDelegate::setDelegate):
2122         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
2123
2124 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2125
2126         Rename minimumLayoutSize to viewLayoutSize
2127         https://bugs.webkit.org/show_bug.cgi?id=185050
2128         <rdar://problem/39624038>
2129
2130         Reviewed by Tim Horton.
2131
2132         Renames minimumLayoutSize to viewLayoutSize, since the minimum layout size in ViewportConfiguration is now
2133         different from the minimum layout size that is currently pushed down from the UI process (e.g. WKWebView SPI) in
2134         the case where `min-device-width` is used to override the minimum layout size.
2135
2136         * Shared/WebPageCreationParameters.cpp:
2137         (WebKit::WebPageCreationParameters::encode const):
2138         (WebKit::WebPageCreationParameters::decode):
2139         * Shared/WebPageCreationParameters.h:
2140         * UIProcess/API/Cocoa/WKWebView.mm:
2141         (-[WKWebView _processDidExit]):
2142         (-[WKWebView activeViewLayoutSize:]):
2143         (-[WKWebView _dispatchSetViewLayoutSize:]):
2144         (-[WKWebView _frameOrBoundsChanged]):
2145         (-[WKWebView _minimumLayoutSizeOverride]):
2146         (-[WKWebView _setViewLayoutSizeOverride:]):
2147         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2148         (-[WKWebView _endAnimatedResize]):
2149         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:maximumUnobscuredSizeOverride:]):
2150         (-[WKWebView _clearOverrideLayoutParameters]):
2151         (-[WKWebView _minimumLayoutWidth]):
2152         (-[WKWebView _setMinimumLayoutWidth:]):
2153         (-[WKWebView activeMinimumLayoutSize:]): Deleted.
2154         (-[WKWebView _dispatchSetMinimumLayoutSize:]): Deleted.
2155         (-[WKWebView _setMinimumLayoutSizeOverride:]): Deleted.
2156         (-[WKWebView _overrideLayoutParametersWithMinimumLayoutSize:minimumLayoutSizeForMinimalUI:maximumUnobscuredSizeOverride:]): Deleted.
2157
2158         Remove unused SPI that has been deprecated since iOS 9, has a simple drop-in replacement, and no longer has any
2159         internal clients.
2160
2161         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2162         * UIProcess/Cocoa/WebViewImpl.mm:
2163         (WebKit::WebViewImpl::setMinimumSizeForAutoLayout):
2164         (WebKit::WebViewImpl::minimumSizeForAutoLayout const):
2165         (WebKit::WebViewImpl::setIntrinsicContentSize):
2166         * UIProcess/DrawingAreaProxy.h:
2167         (WebKit::DrawingAreaProxy::viewLayoutSizeDidChange):
2168         (WebKit::DrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
2169         * UIProcess/WebPageProxy.cpp:
2170         (WebKit::WebPageProxy::creationParameters):
2171         (WebKit::WebPageProxy::setViewLayoutSize):
2172         (WebKit::WebPageProxy::setMinimumLayoutSize): Deleted.
2173         * UIProcess/WebPageProxy.h:
2174         (WebKit::WebPageProxy::viewLayoutSize const):
2175         (WebKit::WebPageProxy::minimumLayoutSize const): Deleted.
2176         * UIProcess/ios/WebPageProxyIOS.mm:
2177         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2178         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize):
2179         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize): Deleted.
2180         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2181         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2182         (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange):
2183         (WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry):
2184         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange):
2185         (WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry):
2186         (WebKit::TiledCoreAnimationDrawingAreaProxy::minimumLayoutSizeDidChange): Deleted.
2187         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2188         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
2189         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2190         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
2191         * WebProcess/WebPage/WebPage.cpp:
2192         (WebKit::m_credentialsMessenger):
2193         (WebKit::WebPage::setViewLayoutSize):
2194         (WebKit::WebPage::setMinimumLayoutSize): Deleted.
2195         * WebProcess/WebPage/WebPage.h:
2196         (WebKit::WebPage::viewLayoutSize const):
2197         (WebKit::WebPage::minimumLayoutSize const): Deleted.
2198         * WebProcess/WebPage/WebPage.messages.in:
2199         * WebProcess/WebPage/ios/WebPageIOS.mm:
2200         (WebKit::WebPage::setViewportConfigurationViewLayoutSize):
2201         (WebKit::WebPage::dynamicViewportSizeUpdate):
2202         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize): Deleted.
2203         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2204         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded):
2205         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
2206
2207 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2208
2209         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
2210         https://bugs.webkit.org/show_bug.cgi?id=185050
2211         <rdar://problem/39624038>
2212
2213         Reviewed by Tim Horton.
2214
2215         Remove the forceHorizontalViewportShrinkToFit and minimumAllowedLayoutWidth SPI hooks from WebKit, and
2216         additionally remove all logic for plumbing viewSize to WebCore. See WebCore/ChangeLog for more information.
2217
2218         * Shared/VisibleContentRectUpdateInfo.cpp:
2219         (WebKit::VisibleContentRectUpdateInfo::encode const):
2220         (WebKit::VisibleContentRectUpdateInfo::decode):
2221         (WebKit::operator<<):
2222         * Shared/VisibleContentRectUpdateInfo.h:
2223         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2224         (WebKit::VisibleContentRectUpdateInfo::allowShrinkToFit const):
2225         (WebKit::operator==):
2226         (WebKit::VisibleContentRectUpdateInfo::forceHorizontalShrinkToFit const): Deleted.
2227         * UIProcess/API/Cocoa/WKWebView.mm:
2228         (-[WKWebView _initializeWithConfiguration:]):
2229         (-[WKWebView activeMinimumLayoutSize:]):
2230         (-[WKWebView _dispatchSetMinimumLayoutSize:]):
2231         (-[WKWebView _frameOrBoundsChanged]):
2232         (-[WKWebView _setMinimumLayoutSizeOverride:]):
2233         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
2234         (-[WKWebView _endAnimatedResize]):
2235         (-[WKWebView _minimumAllowedLayoutWidth]): Deleted.
2236         (-[WKWebView _setMinimumAllowedLayoutWidth:]): Deleted.
2237         (-[WKWebView activeMinimumLayoutSizes:]): Deleted.
2238         (-[WKWebView _dispatchSetMinimumLayoutSize:viewSize:]): Deleted.
2239         (-[WKWebView _setForceHorizontalViewportShrinkToFit:]): Deleted.
2240         (-[WKWebView _forceHorizontalViewportShrinkToFit]): Deleted.
2241         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2242         * UIProcess/WebPageProxy.cpp:
2243         (WebKit::WebPageProxy::creationParameters):
2244         * UIProcess/WebPageProxy.h:
2245         * UIProcess/ios/WKContentView.mm:
2246         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2247         * UIProcess/ios/WebPageProxyIOS.mm:
2248         (WebKit::WebPageProxy::dynamicViewportSizeUpdate):
2249         (WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
2250         * WebProcess/WebPage/WebPage.cpp:
2251         (WebKit::m_credentialsMessenger):
2252         * WebProcess/WebPage/WebPage.h:
2253         * WebProcess/WebPage/WebPage.messages.in:
2254         * WebProcess/WebPage/ios/WebPageIOS.mm:
2255         (WebKit::WebPage::setViewportConfigurationMinimumLayoutSize):
2256         (WebKit::WebPage::dynamicViewportSizeUpdate):
2257         (WebKit::WebPage::updateVisibleContentRects):
2258
2259 2018-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2260
2261         REGRESSION(r230812): [WPE][GTK] WebKitWebViewSessionState.cpp throws away encoded BackForwardList identifier
2262         https://bugs.webkit.org/show_bug.cgi?id=184823
2263
2264         Reviewed by Michael Catanzaro.
2265
2266         Bump session sate format version to 2 and stop encoding the backfoward list item identifier, since it's always
2267         regenerated.
2268
2269         * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
2270         (encodeBackForwardListItemState): Always encode version 2.
2271         (encodeBackForwardListState): Ditto.
2272         (encodeSessionState): Ditto.
2273         (decodeBackForwardListItemStateV1): Decode list item state for version 1.
2274         (decodeBackForwardListItemState): Receive the version and call decodeBackForwardListItemStateV1() if it's 1 or
2275         use the version 2 otherwise.
2276         (decodeSessionState): Load data for known formats and use the one that worked to decode it.
2277
2278 2018-04-26  Megan Gardner  <megan_gardner@apple.com>
2279
2280         Add timeout for ensurePositionInformationIsUpToDate
2281         https://bugs.webkit.org/show_bug.cgi?id=184567
2282
2283         Reviewed by Wenson Hsieh.
2284         
2285         We are having long hang times for WebKit, and this is one of the culprits.
2286         If we do not get an answer for positionInformation in a reasonable amount of time, we should timeout,
2287         so as to not hang the UI.
2288
2289         * UIProcess/ios/WKContentViewInteraction.mm:
2290         (-[WKContentView ensurePositionInformationIsUpToDate:]):
2291
2292 2018-04-26  Andy Estes  <aestes@apple.com>
2293
2294         Try again to fix the iOS build after r231063.
2295
2296         * Configurations/Base.xcconfig:
2297
2298 2018-04-26  Jer Noble  <jer.noble@apple.com>
2299
2300         WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
2301         https://bugs.webkit.org/show_bug.cgi?id=185007
2302         <rdar://problem/39735943>
2303
2304         Reviewed by Timothy Hatcher.
2305
2306         * Configurations/WebKit.xcconfig:
2307
2308 2018-04-26  Jer Noble  <jer.noble@apple.com>
2309
2310         Unreviewed build fix; fix iOS TAPI build step after r231063.
2311
2312         * Configurations/WebKit.xcconfig:
2313
2314 2018-04-26  Jer Noble  <jer.noble@apple.com>
2315
2316         WK_COCOA_TOUCH all the things.
2317         https://bugs.webkit.org/show_bug.cgi?id=185006
2318
2319         Reviewed by Tim Horton.
2320
2321         * Configurations/BaseTarget.xcconfig:
2322         * Configurations/WebKit.xcconfig:
2323
2324 2018-04-26  Daniel Bates  <dabates@apple.com>
2325
2326         Remove WebCore::-qualifier in NetworkLoadChecker.cpp
2327         https://bugs.webkit.org/show_bug.cgi?id=185037
2328
2329         Reviewed by Youenn Fablet.
2330
2331         It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
2332         "using namespace WebCore" directive.
2333
2334         * NetworkProcess/NetworkLoadChecker.cpp:
2335         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2336         (WebKit::NetworkLoadChecker::checkRedirection):
2337         (WebKit::NetworkLoadChecker::validateResponse):
2338         (WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
2339         parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
2340         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2341
2342 2018-04-26  Daniel Bates  <dabates@apple.com>
2343
2344         Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
2345         https://bugs.webkit.org/show_bug.cgi?id=185035
2346
2347         Reviewed by Youenn Fablet.
2348
2349         Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
2350         to better describe that it is a convenience function that returns a wrapped ResourceError object,
2351         that represents an access control error, suitable to be passed directly to a validation handler.
2352
2353         * NetworkProcess/NetworkLoadChecker.cpp:
2354         (WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
2355         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
2356         class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
2357         for the access control error.
2358         (WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
2359         to match the argument of accessControlErrorForValidationHandler() with the same name.
2360         (WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
2361         (WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
2362         * NetworkProcess/NetworkLoadChecker.h:
2363
2364 2018-04-26  Jiewen Tan  <jiewen_tan@apple.com>
2365
2366         Remove access to keychain from the WebContent process
2367         https://bugs.webkit.org/show_bug.cgi?id=184428
2368         <rdar://problem/13150903>
2369
2370         Part 3.
2371
2372         Tighten WebContent Process' sandbox profile to all Security.framework services.
2373
2374         Reviewed by Brent Fulgham.
2375
2376         * WebProcess/com.apple.WebProcess.sb.in:
2377
2378 2018-04-26  Youenn Fablet  <youenn@apple.com>
2379
2380         Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
2381         https://bugs.webkit.org/show_bug.cgi?id=185023
2382
2383         Reviewed by Chris Dumez.
2384
2385         Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.
2386
2387         * NetworkProcess/NetworkLoadChecker.cpp:
2388         (WebKit::NetworkLoadChecker::checkRedirection):
2389         (WebKit::NetworkLoadChecker::validateResponse):
2390
2391 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
2392
2393         Activate selection when interacting with editable content
2394         https://bugs.webkit.org/show_bug.cgi?id=185017
2395
2396         Reviewed by Tim Horton.
2397         
2398         Fixes a regression from r231016 where selection now does not work when interacting with
2399         editable content. When we go into editable content, we should turn on the assistant.
2400         This fulfills the requirement of user interaction as well, so any javascript selections
2401         after this point should be valid.
2402
2403         * UIProcess/ios/WKContentViewInteraction.mm:
2404         (-[WKContentView _startAssistingKeyboard]):
2405         (-[WKContentView _stopAssistingKeyboard]):
2406
2407 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
2408
2409         Disable content filtering in minimal simulator mode
2410         https://bugs.webkit.org/show_bug.cgi?id=185027
2411         <rdar://problem/39736091>
2412
2413         Reviewed by Jer Noble.
2414
2415         * Configurations/FeatureDefines.xcconfig:
2416
2417 2018-04-26  Brady Eidson  <beidson@apple.com>
2418
2419         Add a setting for keeping around all processes and always reusing them per-origin.
2420         <rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020
2421
2422         Reviewed by Andy Estes.
2423
2424         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2425         (API::ProcessPoolConfiguration::copy):
2426         * UIProcess/API/APIProcessPoolConfiguration.h:
2427
2428         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2429         (WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
2430         (WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
2431         * UIProcess/API/C/WKContextConfigurationRef.h:
2432
2433         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2434         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2435         (-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
2436         (-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):
2437
2438         * UIProcess/SuspendedPageProxy.cpp:
2439         (WebKit::SuspendedPageProxy::webProcessDidClose):
2440         (WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
2441         * UIProcess/SuspendedPageProxy.h:
2442
2443         * UIProcess/WebPageProxy.cpp:
2444         (WebKit::WebPageProxy::suspendedPageClosed):
2445         (WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
2446         * UIProcess/WebPageProxy.h:
2447         (WebKit::WebPageProxy::suspendedPage const):
2448
2449         * UIProcess/WebProcessPool.cpp:
2450         (WebKit::WebProcessPool::shouldTerminate):
2451         (WebKit::WebProcessPool::disconnectProcess):
2452         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
2453         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
2454         (WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
2455         (WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
2456         * UIProcess/WebProcessPool.h:
2457
2458         * WebProcess/WebPage/WebPage.cpp:
2459         (WebKit::m_credentialsMessenger):
2460
2461 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
2462
2463         [INTL] Implement Intl.PluralRules
2464         https://bugs.webkit.org/show_bug.cgi?id=184312
2465
2466         Reviewed by JF Bastien.
2467
2468         Added Intl.PluralRules feature flag.
2469
2470         * Configurations/FeatureDefines.xcconfig:
2471
2472 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
2473
2474         [GTK][WPE] Initial ASYNC_SCROLLING support
2475         https://bugs.webkit.org/show_bug.cgi?id=184961
2476
2477         Reviewed by Carlos Garcia Campos.
2478
2479         Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
2480         usage in WebChromeClient and WebPageProxy, respectively, with
2481         PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.
2482
2483         Despite enabling the code at build-time, the feature (as intended) is
2484         not yet used because of the DrawingArea rejection in the WebPage
2485         constructor.
2486
2487         * UIProcess/WebPageProxy.cpp:
2488         (WebKit::WebPageProxy::initializeWebPage):
2489         (WebKit::WebPageProxy::handleWheelEvent):
2490         (WebKit::WebPageProxy::updateTouchEventTracking):
2491         * UIProcess/WebPageProxy.h:
2492         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2493         (WebKit::WebChromeClient::createScrollingCoordinator const):
2494
2495 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2496
2497         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
2498         https://bugs.webkit.org/show_bug.cgi?id=184643
2499
2500         Reviewed by Žan Doberšek.
2501
2502         Adapt to single-header WPE includes.
2503
2504         Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)
2505
2506         * Shared/NativeWebTouchEvent.h:
2507         * Shared/wpe/WebEventFactory.cpp:
2508         * UIProcess/API/glib/WebKitPrivate.cpp:
2509         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
2510         * UIProcess/API/wpe/ScrollGestureController.h:
2511         * UIProcess/API/wpe/WPEView.cpp:
2512         (WKWPE::m_backend):
2513         * UIProcess/API/wpe/WebKitWebViewBackend.h:
2514         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2515         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2516         (WebKit::AcceleratedSurfaceWPE::initialize):
2517
2518 2018-04-25  Saam Barati  <sbarati@apple.com>
2519
2520         dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
2521         https://bugs.webkit.org/show_bug.cgi?id=184904
2522
2523         Reviewed by Geoffrey Garen.
2524
2525         Loading an NSBundle does a lot of work to find the principal class inside
2526         the bundle. This means it walks all the objective C class names loaded
2527         by the bundle. Doing this is *really* expensive.
2528         
2529         Some users of the injected bundle define a WKBundleInitialize function.
2530         In such a case, we don't need the principal class, so we can skip loading
2531         the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
2532         for the WKBundleInitialize function. If we find it, we skip loading
2533         the bundle. If we don't find the WKBundleInitialize function, we fall
2534         back to loading the bundle and finding the principal class.
2535         
2536         This speeds up initializeWebProcess by ~70ms on my MBP.
2537
2538         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2539         (WebKit::InjectedBundle::initialize):
2540
2541 2018-04-25  Youenn Fablet  <youenn@apple.com>
2542
2543         Use NetworkLoadChecker for all subresource loads except fetch/XHR
2544         https://bugs.webkit.org/show_bug.cgi?id=184870
2545         <rdar://problem/39370034>
2546
2547         Reviewed by Chris Dumez.
2548
2549         Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
2550         This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
2551         We keep these checks when WebProcess asks to continue the load and for all PingLoads.
2552
2553         Update error messages to be more consistent with WK1.
2554
2555         * NetworkProcess/NetworkLoadChecker.cpp:
2556         (WebKit::NetworkLoadChecker::checkRedirection):
2557         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2558         (WebKit::NetworkLoadChecker::validateResourceResponse):
2559         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2560         * NetworkProcess/NetworkLoadChecker.h:
2561         (WebKit::NetworkLoadChecker::validateResponse):
2562         * NetworkProcess/NetworkResourceLoader.cpp:
2563         (WebKit::shouldUseNetworkLoadChecker):
2564         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2565
2566 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
2567
2568         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
2569         https://bugs.webkit.org/show_bug.cgi?id=184962
2570
2571         Reviewed by Youenn Fablet.
2572         <rdar://problem/39715044>
2573
2574         Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
2575         These checks are for the source / originating URL, not the target URL.
2576
2577         * UIProcess/WebProcessPool.cpp:
2578         (WebKit::WebProcessPool::processForNavigation):
2579
2580 2018-04-25  Youenn Fablet  <youenn@apple.com>
2581
2582         WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
2583         https://bugs.webkit.org/show_bug.cgi?id=184978
2584         <rdar://problem/39667094>
2585
2586         Reviewed by Simon Fraser.
2587
2588         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.
2589
2590         * WebProcess/Network/WebLoaderStrategy.cpp:
2591         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
2592         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
2593
2594 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
2595
2596         Remove access to keychain from the WebContent process
2597         https://bugs.webkit.org/show_bug.cgi?id=184428
2598         <rdar://problem/13150903>
2599
2600         Reviewed by Brent Fulgham.
2601
2602         This patch does the followings:
2603         1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
2604         2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
2605         that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).
2606
2607         * UIProcess/API/APINavigationClient.h:
2608         (API::NavigationClient::signedPublicKeyAndChallengeString):
2609         * UIProcess/API/C/WKPage.cpp:
2610         (WKPageSetPageNavigationClient):
2611         * UIProcess/API/C/WKPageNavigationClient.h:
2612         * UIProcess/Cocoa/NavigationState.h:
2613         * UIProcess/Cocoa/NavigationState.mm:
2614         (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
2615         * UIProcess/WebPageProxy.cpp:
2616         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
2617         * UIProcess/WebPageProxy.h:
2618         * UIProcess/WebPageProxy.messages.in:
2619         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2620         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
2621         * WebProcess/WebCoreSupport/WebChromeClient.h:
2622
2623 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2624
2625         [Extra zoom mode] The search field on www.bing.com is missing label text
2626         https://bugs.webkit.org/show_bug.cgi?id=184975
2627         <rdar://problem/39723081>
2628
2629         Reviewed by Tim Horton.
2630
2631         Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
2632         adds support for grabbing the input label's text for testing.
2633
2634         Test: fast/forms/extrazoom/form-control-label-text.html
2635
2636         * Shared/AssistedNodeInformation.cpp:
2637         (WebKit::AssistedNodeInformation::encode const):
2638         (WebKit::AssistedNodeInformation::decode):
2639         * Shared/AssistedNodeInformation.h:
2640         * UIProcess/API/Cocoa/WKWebView.mm:
2641         (-[WKWebView formInputLabel]):
2642         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2643         * UIProcess/ios/WKContentViewInteraction.h:
2644         * UIProcess/ios/WKContentViewInteraction.mm:
2645         (-[WKContentView formInputLabel]):
2646         * WebProcess/WebPage/ios/WebPageIOS.mm:
2647         (WebKit::WebPage::getAssistedNodeInformation):
2648
2649 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
2650
2651         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
2652         https://bugs.webkit.org/show_bug.cgi?id=184962
2653
2654         Reviewed by Youenn Fablet.
2655
2656         Don't create a new WebContent process when navigating to a blob object URL since doing so
2657         can result in a race condition in which the blog URL is removed from the blob registry of
2658         the network process by the time the navigation gets commited. This causes a failure in
2659         fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.
2660
2661         In the future, the network process should verify that a given WebContent process has access
2662         to a given blob URL. For now, we rely on WebContent process to tell us whether it can
2663         navigate to a given blob URL or not.
2664
2665         * Shared/NavigationActionData.cpp:
2666         (WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
2667         (WebKit::NavigationActionData::decode): Ditto for decoding.
2668         * Shared/NavigationActionData.h:
2669         (WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
2670         * UIProcess/API/APINavigation.h:
2671         (API::Navigation::setTreatAsSameOriginNavigation): Added.
2672         (API::Navigation::treatAsSameOriginNavigation const): Added.
2673         * UIProcess/API/APIProcessPoolConfiguration.h:
2674         * UIProcess/WebPageProxy.cpp:
2675         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
2676         treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
2677         document has access.
2678         * UIProcess/WebProcessPool.cpp:
2679         (WebKit::WebProcessPool::processForNavigation):
2680         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2681         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2682
2683 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
2684
2685         Don't activate Selection Assistant unless it is actually needed.
2686         https://bugs.webkit.org/show_bug.cgi?id=184944
2687         <rdar://problem/39469671>
2688
2689         Reviewed by Tim Horton.
2690         
2691         Don't activate the selection unless we need to. Activating on init is overeager and allowing Javascript to 
2692         activate selections without user input.
2693
2694         * UIProcess/ios/WKContentViewInteraction.mm:
2695         (-[WKContentView useSelectionAssistantWithGranularity:]):
2696
2697 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2698
2699         Fix entitlements and sandbox configurations in WebKit after r230778
2700         https://bugs.webkit.org/show_bug.cgi?id=184960
2701         <rdar://problem/39662827>
2702
2703         Reviewed by Tim Horton.
2704
2705         Build fixes for watchOS and tvOS after r230778.
2706
2707         * Configurations/BaseXPCService.xcconfig:
2708         * Configurations/NetworkService.xcconfig:
2709         * Configurations/WebContentService.xcconfig:
2710
2711 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2712
2713         Unreviewed build fix after r231008.
2714
2715         * NetworkProcess/NetworkDataTask.cpp:
2716         (WebKit::NetworkDataTask::create): Forgot to remove an unneeded constructor argument.
2717
2718 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2719
2720         Don't Block First Party Cookies on Redirects
2721         https://bugs.webkit.org/show_bug.cgi?id=184948
2722         <rdar://problem/39534099>
2723
2724         Reviewed by Youenn Fablet.
2725
2726         Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame
2727         navigation we are blocking cookies, leading to site breakage.
2728         
2729         We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed
2730         on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for
2731         that URL.
2732
2733         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2734         (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize
2735         NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class.
2736         * NetworkProcess/NetworkConnectionToWebProcess.h:
2737         * NetworkProcess/NetworkDataTask.cpp:
2738         (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. 
2739         (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor.
2740         * NetworkProcess/NetworkDataTask.h:
2741         (WebKit::NetworkDataTask::isTopLevelNavigation const): Added.
2742         * NetworkProcess/NetworkDataTaskBlob.cpp:
2743         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument.
2744         * NetworkProcess/NetworkDataTaskBlob.h:
2745         * NetworkProcess/NetworkLoad.cpp:
2746         (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect.
2747         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2748         (NetworkResourceLoadParameters::decode): Update to pass new flag.
2749         (NetworkResourceLoadParameters::encode): Ditto.
2750         * NetworkProcess/NetworkLoadParameters.h:
2751         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2752         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument.
2753         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2754         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2755         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument.
2756         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2757         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2758         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Accept new constructor argument.
2759         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2760         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2761         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument.
2762         * NetworkProcess/soup/NetworkDataTaskSoup.h:
2763
2764 2018-04-25  Youenn Fablet  <youenn@apple.com>
2765
2766         Ensure DNT is set for redirections handled in NetworkProcess
2767         https://bugs.webkit.org/show_bug.cgi?id=184890
2768
2769         Reviewed by Ryosuke Niwa.
2770
2771         Compute whether DNT header should be set on requests based on:
2772         - request has a DNT header
2773         - session is ephemeral (aka private browsing mode)
2774         In both cases, we ensure a DNT header is added for any request triggered by a redirection.
2775
2776         Covered by http/wpt/fetch/dnt-header-after-redirection.html.
2777
2778         * NetworkProcess/NetworkLoadChecker.cpp:
2779         (WebKit::NetworkLoadChecker::check):
2780         (WebKit::NetworkLoadChecker::prepareRedirectedRequest):
2781         * NetworkProcess/NetworkLoadChecker.h:
2782         * NetworkProcess/NetworkResourceLoader.cpp:
2783         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2784         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2785         * NetworkProcess/PingLoad.cpp:
2786         (WebKit::PingLoad::willPerformHTTPRedirection):
2787         * WebProcess/Network/WebLoaderStrategy.cpp:
2788         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2789
2790 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2791
2792         [WPE] Remove deprecated functions and properties from the API
2793         https://bugs.webkit.org/show_bug.cgi?id=179295
2794
2795         Reviewed by Žan Doberšek.
2796
2797         * UIProcess/API/glib/WebKitCookieManager.cpp:
2798         * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp:
2799         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
2800         (webkitNavigationPolicyDecisionGetProperty):
2801         (webkit_navigation_policy_decision_class_init):
2802         * UIProcess/API/glib/WebKitSettings.cpp:
2803         (webKitSettingsSetProperty):
2804         (webKitSettingsGetProperty):
2805         (webkit_settings_class_init):
2806         * UIProcess/API/glib/WebKitWebContext.cpp:
2807         (webkitWebContextGetProperty):
2808         (webkitWebContextSetProperty):
2809         (webkit_web_context_class_init):
2810         * UIProcess/API/glib/WebKitWebView.cpp:
2811         (webkit_web_view_class_init):
2812         (webkitWebViewHandleAuthenticationChallenge):
2813         (webkitWebViewWebProcessTerminated):
2814         * UIProcess/API/wpe/WebKitCookieManager.h:
2815         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h:
2816         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h:
2817         * UIProcess/API/wpe/WebKitSettings.h:
2818         * UIProcess/API/wpe/WebKitWebContext.h:
2819
2820 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2821
2822         Unreviewed, silence -Wreturn-type warning
2823         https://bugs.webkit.org/show_bug.cgi?id=184560
2824
2825         * NetworkProcess/NetworkResourceLoader.cpp:
2826         (WebKit::shouldCancelCrossOriginLoad):
2827
2828 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2829
2830         [GTK] Miscellaneous build cleanups
2831         https://bugs.webkit.org/show_bug.cgi?id=184399
2832
2833         Reviewed by Žan Doberšek.
2834
2835         * PlatformGTK.cmake:
2836
2837 2018-04-25  Dean Jackson  <dino@apple.com>
2838
2839         Make a better flag for system preview, and disable it where necessary
2840         https://bugs.webkit.org/show_bug.cgi?id=184968
2841         <rdar://problem/39686506>
2842
2843         Reviewed by Eric Carlson.
2844
2845         Use USE(SYSTEM_PREVIEW).
2846
2847         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2848         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2849         (-[WKWebViewContentProviderRegistry init]):
2850         * UIProcess/ios/WKSystemPreviewView.mm:
2851
2852 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2853
2854         [GTK] Implement MouseEvent.buttons
2855         https://bugs.webkit.org/show_bug.cgi?id=184913
2856
2857         Reviewed by Žan Doberšek.
2858
2859         It's currently returning always 0.
2860
2861         * Shared/gtk/WebEventFactory.cpp:
2862         (WebKit::pressedMouseButtons): Helper function to get the pressed mouse buttons.
2863         (WebKit::WebEventFactory::createWebMouseEvent): Pass presssed mouse buttons to constructor instead of 0.
2864         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2865         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Include the mouse buttons state in automation
2866         synthesized events and update m_currentModifiers with the mouse buttons state.
2867         (WebKit::keyCodeForVirtualKey): Do not set the state here.
2868         (WebKit::modifiersForKeyCode): Helper to get the modifiers for a key code.
2869         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Initialize the modifiers also when
2870         virtualKey is std::nullopt;
2871
2872 2018-04-24  Nan Wang  <n_wang@apple.com>
2873
2874         AX: soft link libAccessibility.dylb
2875         https://bugs.webkit.org/show_bug.cgi?id=184919
2876
2877         Reviewed by Dan Bernstein.
2878
2879         Weakly linked libAccessibility.dylib on macOS.
2880
2881         * Configurations/WebKit.xcconfig:
2882         * UIProcess/API/Cocoa/WKWebView.mm:
2883         (-[WKWebView _initializeWithConfiguration:]):
2884         (-[WKWebView _updateAccessibilityEventsEnabled]):
2885
2886 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2887
2888         [WinCairo] Add WKView and WKAPI
2889         https://bugs.webkit.org/show_bug.cgi?id=182869
2890
2891         Reviewed by Alex Christensen.
2892
2893         Resurrected source files for WebKit for Windows port which was
2894         removed in r139003.
2895
2896         * PlatformWin.cmake: Renamed the output name of WebKit to WebKit2
2897         not to conflict WebKitLegacy. Added source files and include paths.
2898         * UIProcess/API/C/WKAPICast.h:
2899         * UIProcess/API/C/win/WKAPICastWin.h: Added.
2900         * UIProcess/API/C/win/WKView.cpp: Added.
2901         (WKViewCreate):
2902         (WKViewGetWindow):
2903         (WKViewGetPage):
2904         (WKViewSetParentWindow):
2905         (WKViewWindowAncestryDidChange):
2906         (WKViewSetIsInWindow):
2907         (WKViewSetScrollOffsetOnNextResize):
2908         * UIProcess/API/C/win/WKView.h: Added.
2909         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added.
2910         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
2911         (API::WebsiteDataStore::defaultCacheStorageDirectory):
2912         (API::WebsiteDataStore::defaultNetworkCacheDirectory):
2913         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
2914         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
2915         (API::WebsiteDataStore::defaultLocalStorageDirectory):
2916         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
2917         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
2918         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
2919         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
2920         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
2921         (API::WebsiteDataStore::defaultDataStoreConfiguration):
2922         * UIProcess/Launcher/ProcessLauncher.h:
2923         * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added.
2924         (WebKit::processName):
2925         (WebKit::ProcessLauncher::launchProcess):
2926         (WebKit::ProcessLauncher::terminateProcess):
2927         (WebKit::ProcessLauncher::platformInvalidate):
2928         * UIProcess/Network/NetworkProcessProxy.cpp:
2929         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
2930         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2931         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: Added.
2932         (WebKit::WebsiteDataStore::platformInitialize):
2933         (WebKit::WebsiteDataStore::platformDestroy):
2934         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
2935         * UIProcess/win/PageClientImpl.cpp: Added.
2936         (WebKit::PageClientImpl::PageClientImpl):
2937         (WebKit::PageClientImpl::createDrawingAreaProxy):
2938         (WebKit::PageClientImpl::setViewNeedsDisplay):
2939         (WebKit::PageClientImpl::requestScroll):
2940         (WebKit::PageClientImpl::viewScrollPosition):
2941         (WebKit::PageClientImpl::viewSize):
2942         (WebKit::PageClientImpl::isViewWindowActive):
2943         (WebKit::PageClientImpl::isViewFocused):
2944         (WebKit::PageClientImpl::isViewVisible):
2945         (WebKit::PageClientImpl::isViewInWindow):
2946         (WebKit::PageClientImpl::PageClientImpl::processDidExit):
2947         (WebKit::PageClientImpl::didRelaunchProcess):
2948         (WebKit::PageClientImpl::toolTipChanged):
2949         (WebKit::PageClientImpl::setCursor):
2950         (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
2951         (WebKit::PageClientImpl::didChangeViewportProperties):
2952         (WebKit::PageClientImpl::registerEditCommand):
2953         (WebKit::PageClientImpl::clearAllEditCommands):
2954         (WebKit::PageClientImpl::canUndoRedo):
2955         (WebKit::PageClientImpl::executeUndoRedo):
2956         (WebKit::PageClientImpl::convertToDeviceSpace):
2957         (WebKit::PageClientImpl::convertToUserSpace):
2958         (WebKit::PageClientImpl::screenToRootView):
2959         (WebKit::PageClientImpl::rootViewToScreen):
2960         (WebKit::PageClientImpl::doneWithKeyEvent):
2961         (WebKit::PageClientImpl::createPopupMenuProxy):
2962         (WebKit::PageClientImpl::createContextMenuProxy):
2963         (WebKit::createColorPicker):
2964         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
2965         (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
2966         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
2967         (WebKit::PageClientImpl::pageClosed):
2968         (WebKit::PageClientImpl::preferencesDidChange):
2969         (WebKit::PageClientImpl::didChangeContentSize):
2970         (WebKit::PageClientImpl::handleDownloadRequest):
2971         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
2972         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
2973         (WebKit::PageClientImpl::closeFullScreenManager):
2974         (WebKit::PageClientImpl::isFullScreen):
2975         (WebKit::PageClientImpl::enterFullScreen):
2976         (WebKit::PageClientImpl::exitFullScreen):
2977         (WebKit::PageClientImpl::beganEnterFullScreen):
2978         (WebKit::PageClientImpl::beganExitFullScreen):
2979         (WebKit::PageClientImpl::doneWithTouchEvent):
2980         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
2981         (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
2982         (WebKit::PageClientImpl::navigationGestureDidBegin):
2983         (WebKit::PageClientImpl::navigationGestureWillEnd):
2984         (WebKit::PageClientImpl::navigationGestureDidEnd):
2985         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
2986         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
2987         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
2988         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
2989         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
2990         (WebKit::PageClientImpl::didChangeBackgroundColor):
2991         (WebKit::PageClientImpl::isPlayingAudioWillChange):
2992         (WebKit::PageClientImpl::isPlayingAudioDidChange):
2993         (WebKit::PageClientImpl::refView):
2994         (WebKit::PageClientImpl::derefView):
2995         * UIProcess/win/PageClientImpl.h: Added.
2996         * UIProcess/win/TextCheckerWin.cpp: Added.
2997         (WebKit::checkerState):
2998         (WebKit::TextChecker::state):
2999         (WebKit::TextChecker::setTestingMode):
3000         (WebKit::TextChecker::isTestingMode):
3001         (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
3002         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
3003         (WebKit::TextChecker::setGrammarCheckingEnabled):
3004         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
3005         (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
3006         (WebKit::TextChecker::uniqueSpellDocumentTag):
3007         (WebKit::TextChecker::closeSpellDocumentWithTag):
3008         (WebKit::TextChecker::checkSpellingOfString):
3009         (WebKit::TextChecker::checkGrammarOfString):
3010         (WebKit::TextChecker::spellingUIIsShowing):
3011         (WebKit::TextChecker::toggleSpellingUIIsShowing):
3012         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
3013         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
3014         (WebKit::TextChecker::getGuessesForWord):
3015         (WebKit::TextChecker::learnWord):
3016         (WebKit::TextChecker::ignoreWord):
3017         (WebKit::TextChecker::requestCheckingOfString):
3018         (WebKit::TextChecker::checkTextOfParagraph):
3019         * UIProcess/win/WebContextMenuProxyWin.cpp: Added.
3020         (WebKit::WebContextMenuProxyWin::show):
3021         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
3022         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
3023         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
3024         * UIProcess/win/WebContextMenuProxyWin.h: Added.
3025         (WebKit::WebContextMenuProxyWin::create):
3026         * UIProcess/win/WebInspectorProxyWin.cpp: Added.
3027         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3028         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3029         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3030         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3031         (WebKit::WebInspectorProxy::platformInvalidate):
3032         (WebKit::WebInspectorProxy::platformHide):
3033         (WebKit::WebInspectorProxy::platformBringToFront):
3034         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
3035         (WebKit::WebInspectorProxy::platformIsFront):
3036         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
3037         (WebKit::WebInspectorProxy::inspectorPageURL):
3038         (WebKit::WebInspectorProxy::inspectorTestPageURL):
3039         (WebKit::WebInspectorProxy::inspectorBaseURL):
3040         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
3041         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
3042         (WebKit::WebInspectorProxy::platformAttach):
3043         (WebKit::WebInspectorProxy::platformDetach):
3044         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
3045         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
3046         (WebKit::WebInspectorProxy::platformStartWindowDrag):
3047         (WebKit::WebInspectorProxy::platformSave):
3048         (WebKit::WebInspectorProxy::platformAppend):
3049         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
3050         * UIProcess/win/WebPageProxyWin.cpp: Added.
3051         (WebKit::WebPageProxy::platformInitialize):
3052         (WebKit::WebPageProxy::standardUserAgent):
3053         (WebKit::WebPageProxy::saveRecentSearches):
3054         (WebKit::WebPageProxy::loadRecentSearches):
3055         (WebKit::WebPageProxy::editorStateChanged):
3056         * UIProcess/win/WebPreferencesWin.cpp: Added.
3057         (WebKit::WebPreferences::platformInitializeStore):
3058         (WebKit::WebPreferences::platformUpdateStringValueForKey):
3059         (WebKit::WebPreferences::platformUpdateBoolValueForKey):
3060         (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
3061         (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
3062         (WebKit::WebPreferences::platformUpdateFloatValueForKey):
3063         (WebKit::WebPreferences::platformGetStringUserValueForKey):
3064         (WebKit::WebPreferences::platformGetBoolUserValueForKey):
3065         (WebKit::WebPreferences::platformGetUInt32UserValueForKey):
3066         (WebKit::WebPreferences::platformGetDoubleUserValueForKey):
3067         * UIProcess/win/WebProcessPoolWin.cpp: Added.
3068         (WebKit::WebProcessPool::platformInitialize):
3069         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3070         (WebKit::WebProcessPool::platformInitializeWebProcess):
3071         (WebKit::WebProcessPool::platformInvalidateContext):
3072         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
3073         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory):
3074         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory):
3075         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
3076         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory):
3077         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory):
3078         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
3079         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
3080         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
3081         * UIProcess/win/WebView.cpp: Added.
3082         (WebKit::WebView::WebViewWndProc):
3083         (WebKit::WebView::wndProc):
3084         (WebKit::WebView::registerWebViewWindowClass):
3085         (WebKit::WebView::WebView):
3086         (WebKit::WebView::~WebView):
3087         (WebKit::WebView::initialize):
3088         (WebKit::WebView::setParentWindow):
3089         (WebKit::findTopLevelParentWindow):
3090         (WebKit::WebView::windowAncestryDidChange):
3091         (WebKit::WebView::onMouseEvent):
3092         (WebKit::WebView::onWheelEvent):
3093         (WebKit::WebView::onHorizontalScroll):
3094         (WebKit::WebView::onVerticalScroll):
3095         (WebKit::WebView::onKeyEvent):
3096         (WebKit::drawPageBackground):
3097         (WebKit::WebView::paint):
3098         (WebKit::WebView::onPaintEvent):
3099         (WebKit::WebView::onPrintClientEvent):
3100         (WebKit::WebView::onSizeEvent):
3101         (WebKit::WebView::onWindowPositionChangedEvent):
3102         (WebKit::WebView::onSetFocusEvent):
3103         (WebKit::WebView::onKillFocusEvent):
3104         (WebKit::WebView::onTimerEvent):
3105         (WebKit::WebView::onShowWindowEvent):
3106         (WebKit::WebView::onSetCursor):
3107         (WebKit::WebView::updateActiveState):
3108         (WebKit::WebView::updateActiveStateSoon):
3109         (WebKit::initCommonControls):
3110         (WebKit::WebView::initializeToolTipWindow):
3111         (WebKit::WebView::startTrackingMouseLeave):
3112         (WebKit::WebView::stopTrackingMouseLeave):
3113         (WebKit::WebView::shouldInitializeTrackPointHack):
3114         (WebKit::WebView::close):
3115         (WebKit::WebView::cursorToShow const):
3116         (WebKit::WebView::updateNativeCursor):
3117         (WebKit::WebView::setOverrideCursor):
3118         (WebKit::WebView::setIsInWindow):
3119         (WebKit::WebView::setIsVisible):
3120         (WebKit::WebView::isWindowActive):
3121         (WebKit::WebView::isFocused):
3122         (WebKit::WebView::isVisible):
3123         (WebKit::WebView::isInWindow):
3124         (WebKit::WebView::setScrollOffsetOnNextResize):
3125         (WebKit::WebView::setViewNeedsDisplay):
3126         (WebKit::WebView::createColorChooserProxy):
3127         (WebKit::WebView::didCommitLoadForMainFrame):
3128         (WebKit::WebView::customRepresentationZoomFactor):
3129         (WebKit::WebView::setCustomRepresentationZoomFactor):
3130         (WebKit::WebView::findStringInCustomRepresentation):
3131         (WebKit::WebView::countStringMatchesInCustomRepresentation):
3132         (WebKit::WebView::nativeWindow):
3133         (WebKit::WebView::windowReceivedMessage):
3134         * UIProcess/win/WebView.h: Added.
3135         (WebKit::WebView::create):
3136         (WebKit::WebView::window const):
3137         (WebKit::WebView::page const):
3138         (WebKit::WebView::drawingArea):
3139         (WebKit::WebView::setWasActivatedByMouseEvent):
3140
3141 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
3142
3143         Implement Same-Site cookies
3144         https://bugs.webkit.org/show_bug.cgi?id=159464
3145         <rdar://problem/27196358>
3146
3147         Unreviewed build fix.
3148
3149         WinCairo WebKit2 can't compile since r230921.
3150
3151         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3152         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
3153         CookieJarCurlDatabase::cookieRequestHeaderFieldValue needs
3154         SameSiteInfo.
3155
3156 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
3157
3158         Add a new "color-filter" CSS property as an experimental feature
3159         https://bugs.webkit.org/show_bug.cgi?id=184940
3160
3161         Reviewed by Jon Lee.
3162         
3163         Add the color-filter property as an experimental feature.
3164
3165         * Shared/WebPreferences.yaml:
3166
3167 2018-04-24  Saam Barati  <sbarati@apple.com>
3168
3169         Keep around a pre-warmed process when doing process swap on navigation
3170         https://bugs.webkit.org/show_bug.cgi?id=184765
3171         <rdar://problem/39685099>
3172
3173         Reviewed by Ryosuke Niwa and Brady Eidson.
3174
3175         This patch makes it so that WebProcessPool prewarms a process when process
3176         swap on navigation is turned on. When we do a process swap on navigation,
3177         we first try to grab a prewarmed process before creating a new one.
3178         
3179         We try to be smart about when to create these processes. The initial heuristic
3180         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
3181         layout milestone. We're going to try to improve on this heuristic in:
3182         https://bugs.webkit.org/show_bug.cgi?id=184899
3183         
3184         This is a 40% progression on PLT with process swap on navigation turned on.
3185
3186         * UIProcess/API/Cocoa/WKProcessPool.mm:
3187         (-[WKProcessPool _prewarmedWebProcessCount]):
3188         (-[WKProcessPool _webProcessCountIgnoringPrewarmed]):
3189         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3190         * UIProcess/ServiceWorkerProcessProxy.cpp:
3191         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
3192         * UIProcess/WebPageProxy.cpp:
3193         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3194         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3195         * UIProcess/WebPageProxy.h:
3196         * UIProcess/WebProcessPool.cpp:
3197         (WebKit::WebProcessPool::createNewWebProcess):
3198         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3199         (WebKit::WebProcessPool::warmInitialProcess):
3200         (WebKit::WebProcessPool::disconnectProcess):
3201         (WebKit::WebProcessPool::createWebPage):
3202         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3203         (WebKit::WebProcessPool::processForNavigation):
3204         * UIProcess/WebProcessPool.h:
3205         * UIProcess/WebProcessProxy.cpp:
3206         (WebKit::WebProcessProxy::create):
3207         (WebKit::WebProcessProxy::WebProcessProxy):
3208         (WebKit::m_isInPrewarmedPool):
3209         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
3210         * UIProcess/WebProcessProxy.h:
3211         (WebKit::WebProcessProxy::isInPrewarmedPool const):
3212         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
3213
3214 2018-04-24  Commit Queue  <commit-queue@webkit.org>
3215
3216         Unreviewed, rolling out r230971.
3217         https://bugs.webkit.org/show_bug.cgi?id=184939
3218
3219         This fix was not appropriate (Requested by n_wang on #webkit).
3220
3221         Reverted changeset:
3222
3223         "AX: soft link libAccessibility.dylb"
3224         https://bugs.webkit.org/show_bug.cgi?id=184919
3225         https://trac.webkit.org/changeset/230971
3226
3227 2018-04-24  Nan Wang  <n_wang@apple.com>
3228
3229         AX: soft link libAccessibility.dylb
3230         https://bugs.webkit.org/show_bug.cgi?id=184919
3231
3232         Reviewed by Chris Fleizach.
3233
3234         Make sure we soft link the library so that it won't crash
3235         if it's missing in the system.
3236
3237         * Configurations/WebKit.xcconfig:
3238         * UIProcess/API/Cocoa/WKWebView.mm:
3239         (-[WKWebView _initializeWithConfiguration:]):
3240         (-[WKWebView _updateAccessibilityEventsEnabled]):
3241
3242 2018-04-24  John Wilander  <wilander@apple.com>
3243
3244         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
3245         https://bugs.webkit.org/show_bug.cgi?id=184560
3246         <rdar://problem/38901344>
3247
3248         Reviewed by Youenn Fablet and Daniel Bates.
3249
3250         This patch implements significant parts of https://github.com/whatwg/fetch/issues/687.
3251         We consume the From-Origin response header and only load the resource if:
3252         - The header is non-existent, empty, or invalid.
3253         - The header specifies 'same' and the resource's origin matches the originating
3254           document's origin and the origins up the frame tree.
3255         - The header specifies 'same-site' and the resource's eTLD+1 matches the originating
3256           document's eTLD+1 and the eTLD+1 of the documents up the frame tree.
3257
3258         This feature is experimental and off by default.
3259
3260         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3261         (WebKit::NetworkResourceLoadParameters::encode const):
3262         (WebKit::NetworkResourceLoadParameters::decode):
3263             Support for the two new load parameters:
3264             - shouldEnableFromOriginResponseHeader
3265             - frameAncestorOrigins
3266         * NetworkProcess/NetworkResourceLoadParameters.h:
3267         * NetworkProcess/NetworkResourceLoader.cpp:
3268         (WebKit::areFrameAncestorsSameSite):
3269         (WebKit::areFrameAncestorsSameOrigin):
3270         (WebKit::shouldCancelCrossOriginLoad):
3271             The three functions above implement the new blocking logic.
3272         (WebKit::fromOriginResourceError):
3273             Convenience function that returns an error with the From-Origin error message.
3274         (WebKit::NetworkResourceLoader::didReceiveResponse):
3275             Now checks for a From-Origin response header.
3276         (WebKit::NetworkResourceLoader::didFailLoading):
3277             Now checks for a From-Origin response header.
3278         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
3279             Now checks for a From-Origin response header.
3280         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3281             Now checks for a From-Origin response header.
3282         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
3283             Now checks for a From-Origin response header.
3284         * Shared/WebCoreArgumentCoders.cpp:
3285         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::encode):
3286         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode):
3287             Now encodes and decodes vectors of RefPtr<WebCore::SecurityOrigin>.
3288         * Shared/WebCoreArgumentCoders.h:
3289         * Shared/WebPreferences.yaml:
3290             Added From-Origin support as an experimental feature.
3291         * UIProcess/API/C/WKPreferences.cpp:
3292         (WKPreferencesSetFromOriginResponseHeaderEnabled):
3293         (WKPreferencesGetFromOriginResponseHeaderEnabled):
3294         * UIProcess/API/C/WKPreferencesRef.h:
3295         * WebProcess/Network/WebLoaderStrategy.cpp:
3296         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3297             Sets the two new load parameters:
3298             - shouldEnableFromOriginResponseHeader
3299             - frameAncestorOrigins
3300
3301 2018-04-24  Jer Noble  <jer.noble@apple.com>
3302
3303         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
3304         https://bugs.webkit.org/show_bug.cgi?id=184786
3305
3306         Reviewed by Tim Horton.
3307
3308         * Configurations/BaseTarget.xcconfig:
3309         * DerivedSources.make:
3310
3311 2018-04-24  Ryan Haddad  <ryanhaddad@apple.com>
3312
3313         Unreviewed, rolling out r230938.
3314
3315         Introduced two ProcessSwap API test failures.
3316
3317         Reverted changeset:
3318
3319         "Keep around a pre-warmed process when doing process swap on
3320         navigation"
3321         https://bugs.webkit.org/show_bug.cgi?id=184765
3322         https://trac.webkit.org/changeset/230938
3323
3324 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3325
3326         [CoordGraphics] Remove dead fixed layer code
3327         https://bugs.webkit.org/show_bug.cgi?id=184912
3328
3329         Reviewed by Michael Catanzaro.
3330
3331         Drop the unused fixed layer handling  code in CoordinatedGraphicsScene.
3332         The m_fixedLayers container can be removed, along with the
3333         adjustPositionForFixedLayers() method that operated on that container.
3334
3335         This was the only method that operated with the m_scrollPosition member
3336         variable and the contentsPosition argument that's passed to the
3337         CoordinatedGraphicsScene::paintToCurrentGLContext() method. Both of
3338         these are removed, along with the scrollPosition attribute on the
3339         CoordinatedGraphicsState struct.
3340
3341         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3342         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
3343         (WebKit::CoordinatedGraphicsScene::setLayerState):
3344         (WebKit::CoordinatedGraphicsScene::deleteLayer):
3345         (WebKit::CoordinatedGraphicsScene::commitSceneState):
3346         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
3347         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers): Deleted.
3348         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3349         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3350         (WebKit::ThreadedCompositor::renderLayerTree):
3351         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3352         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
3353
3354 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3355
3356         REGRESSION(r230950): Faulty commit sequencing in CoordinatedGraphicsScene
3357         https://bugs.webkit.org/show_bug.cgi?id=184917
3358
3359         Reviewed by Michael Catanzaro.
3360
3361         After r230950, current animation state for a given layer is also taken
3362         into account when determining whether or not the layer requires a
3363         backing store. For that to work properly, all the animation state has
3364         to be updated before the backing store work. This patch changes the
3365         order of helper method invocations in
3366         CoordinatedGraphicsScene::setLayerState() to address that.
3367
3368         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3369         (WebKit::CoordinatedGraphicsScene::setLayerState):
3370
3371 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3372
3373         [CoordGraphics] Remove unused fixed layout functionality
3374         https://bugs.webkit.org/show_bug.cgi?id=184908
3375
3376         Reviewed by Carlos Garcia Campos.
3377
3378         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
3379         support. As such, we're able to remove a lot of unused code and
3380         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
3381         in both WebCore and WebKit.
3382
3383         Remove USE(COORDINATED_GRAPHICS) special-casing from the
3384         WebPage::setUseFixedLayout() method. This is not possible to enable for
3385         the GTK+ and WPE ports that use the CoordinatedGraphics subsytem via
3386         API. Removing all this unlocks removing considerable amounts of dead
3387         code and complexities in CoordinatedGraphics.
3388
3389         WebChromeClient::delegatedScrollRequested() method is removed, along
3390         with the WebPage::pageDidRequestScroll() method that was only called
3391         from there.
3392
3393         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3394         (WebKit::WebChromeClient::delegatedScrollRequested): Deleted.
3395         * WebProcess/WebCoreSupport/WebChromeClient.h:
3396         * WebProcess/WebPage/WebPage.cpp:
3397         (WebKit::WebPage::setUseFixedLayout):
3398         (WebKit::WebPage::pageDidRequestScroll): Deleted.
3399         * WebProcess/WebPage/WebPage.h:
3400
3401 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3402
3403         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
3404         https://bugs.webkit.org/show_bug.cgi?id=184143
3405
3406         Reviewed by Carlos Garcia Campos.
3407
3408         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3409         (WebKit::layerShouldHaveBackingStore):
3410         Mirror CoordinatedGraphicsLayer's backing store requirements.
3411
3412 2018-04-23  Daniel Bates  <dabates@apple.com>
3413
3414         Implement Same-Site cookies
3415         https://bugs.webkit.org/show_bug.cgi?id=159464
3416         <rdar://problem/27196358>
3417
3418         Reviewed by Brent Fulgham.
3419
3420         Pass the Same-Site info through the WebKit abstractions.
3421
3422         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3423         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3424         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3425         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3426         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3427         * NetworkProcess/NetworkConnectionToWebProcess.h:
3428         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3429         * NetworkProcess/NetworkResourceLoader.cpp:
3430         (WebKit::NetworkResourceLoader::logCookieInformation const):
3431         (WebKit::logBlockedCookieInformation):
3432         (logCookieInformationInternal):
3433         (NetworkResourceLoader::logCookieInformation):
3434         * NetworkProcess/NetworkResourceLoader.h:
3435         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3436         (WebKit::NetworkCache::constructRevalidationRequest):
3437         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3438         (WebKit::NetworkCache::SubresourceInfo::encode const):
3439         (WebKit::NetworkCache::SubresourceInfo::decode):
3440         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3441         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3442         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
3443         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
3444         a top-level navigation.
3445         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3446         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
3447         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
3448         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3449         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3450         * UIProcess/WebProcessPool.cpp:
3451         (WebKit::WebProcessPool::download):
3452         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3453         (WebKit::WebPlatformStrategies::cookiesForDOM):
3454         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3455         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3456         (WebKit::WebPlatformStrategies::getRawCookies):
3457         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3458
3459 2018-04-23  Youenn Fablet  <youenn@apple.com>
3460
3461         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
3462         https://bugs.webkit.org/show_bug.cgi?id=184763
3463
3464         Reviewed by Chris Dumez.
3465
3466         Set all required NetworkResourceLoadParameters for asynchronous loads.
3467         This includes preflight policy, CSP response headers, SecurityOrigin and content blockers identifier.
3468
3469         Update NetworkLoadChecker to handle preflight policy.
3470         This is not needed right now since sync XHR and ping loads are using the default ConsiderPreflight policy.
3471         But this will be needed for XHR/fetch/EventSource loads. 
3472
3473         * NetworkProcess/NetworkLoadChecker.cpp:
3474         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3475         (WebKit::NetworkLoadChecker::checkRedirection):
3476         (WebKit::NetworkLoadChecker::validateResponse):
3477         (WebKit::NetworkLoadChecker::checkCORSRequest):
3478         * NetworkProcess/NetworkLoadChecker.h:
3479         (WebKit::NetworkLoadChecker::create):
3480         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3481         (WebKit::NetworkResourceLoadParameters::encode const):
3482         (WebKit::NetworkResourceLoadParameters::decode):
3483         * NetworkProcess/NetworkResourceLoadParameters.h:
3484         * NetworkProcess/NetworkResourceLoader.cpp:
3485         * NetworkProcess/PingLoad.cpp:
3486         (WebKit::PingLoad::PingLoad):
3487         * WebProcess/Network/WebLoaderStrategy.cpp:
3488         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3489
3490 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3491
3492         [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
3493         https://bugs.webkit.org/show_bug.cgi?id=184901
3494         <rdar://problem/39664797>
3495
3496         Reviewed by Tim Horton.
3497
3498         Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
3499         is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
3500
3501         * UIProcess/API/Cocoa/WKWebView.mm:
3502         (-[WKWebView setTimePickerValueToHour:minute:]):
3503         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3504         * UIProcess/ios/WKContentViewInteraction.h:
3505         * UIProcess/ios/WKContentViewInteraction.mm:
3506         (-[WKContentView setTimePickerValueToHour:minute:]):
3507
3508         Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
3509         minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
3510         as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
3511
3512         * WebProcess/WebPage/WebPage.cpp:
3513         (WebKit::WebPage::setTextAsync):
3514
3515 2018-04-23  Saam Barati  <sbarati@apple.com>
3516
3517         Keep around a pre-warmed process when doing process swap on navigation
3518         https://bugs.webkit.org/show_bug.cgi?id=184765
3519
3520         Reviewed by Ryosuke Niwa.
3521
3522         This patch makes it so that WebProcessPool prewarms a process when process
3523         swap on navigation is turned on. When we do a process swap on navigation,
3524         we first try to grab a prewarmed process before creating a new one.
3525         
3526         We try to be smart about when to create these processes. The initial heuristic
3527         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
3528         layout milestone. We're going to try to improve on this heuristic in:
3529         https://bugs.webkit.org/show_bug.cgi?id=184899
3530         
3531         This is a 40% progression on PLT with process swap on navigation turned on.
3532
3533         * UIProcess/ServiceWorkerProcessProxy.cpp:
3534         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
3535         * UIProcess/WebPageProxy.cpp:
3536         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
3537         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3538         * UIProcess/WebPageProxy.h:
3539         * UIProcess/WebProcessPool.cpp:
3540         (WebKit::WebProcessPool::createNewWebProcess):
3541         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
3542         (WebKit::WebProcessPool::warmInitialProcess):
3543         (WebKit::WebProcessPool::disconnectProcess):
3544         (WebKit::WebProcessPool::createWebPage):
3545         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
3546         (WebKit::WebProcessPool::processForNavigation):
3547         * UIProcess/WebProcessPool.h:
3548         * UIProcess/WebProcessProxy.cpp:
3549         (WebKit::WebProcessProxy::create):
3550         (WebKit::WebProcessProxy::WebProcessProxy):
3551         (WebKit::m_isInPrewarmedPool):
3552         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
3553         * UIProcess/WebProcessProxy.h:
3554         (WebKit::WebProcessProxy::isInPrewarmedPool const):
3555         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
3556
3557 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
3558
3559         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
3560         https://bugs.webkit.org/show_bug.cgi?id=184405
3561
3562         Reviewed by Carlos Garcia Campos.
3563
3564         Switch to std::unique_ptr.
3565
3566         * UIProcess/gtk/WaylandCompositor.cpp:
3567         (WebKit::WaylandCompositor::WaylandCompositor):
3568         * UIProcess/gtk/WaylandCompositor.h:
3569         (WebKit::WaylandCompositor::DisplayDeleter::operator()):
3570
3571 2018-04-23  Daniel Bates  <dabates@apple.com>
3572
3573         Attempt to fix the Apple Internal build following r230921
3574         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3575
3576         Forward declare some SPI. Add availability guard.
3577
3578         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3579
3580 2018-04-23  Zalan Bujtas  <zalan@apple.com>
3581
3582         [LayoutFormattingContext] Initial commit.
3583         https://bugs.webkit.org/show_bug.cgi?id=184896
3584
3585         Reviewed by Antti Koivisto.
3586
3587         * Configurations/FeatureDefines.xcconfig:
3588
3589 2018-04-23  Daniel Bates  <dabates@apple.com>
3590
3591         Implement Same-Site cookies
3592         https://bugs.webkit.org/show_bug.cgi?id=159464
3593         <rdar://problem/27196358>
3594
3595         Reviewed by Brent Fulgham.
3596
3597         Pass the Same-Site info through the WebKit abstractions.
3598
3599         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3600         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
3601         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
3602         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
3603         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
3604         * NetworkProcess/NetworkConnectionToWebProcess.h:
3605         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3606         * NetworkProcess/NetworkResourceLoader.cpp:
3607         (WebKit::NetworkResourceLoader::logCookieInformation const):
3608         (WebKit::logBlockedCookieInformation):
3609         (logCookieInformationInternal):
3610         (NetworkResourceLoader::logCookieInformation):
3611         * NetworkProcess/NetworkResourceLoader.h:
3612         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3613         (WebKit::NetworkCache::constructRevalidationRequest):
3614         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
3615         (WebKit::NetworkCache::SubresourceInfo::encode const):
3616         (WebKit::NetworkCache::SubresourceInfo::decode):
3617         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
3618         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
3619         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
3620         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
3621         a top-level navigation.
3622         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3623         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
3624         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
3625         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3626         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
3627         * UIProcess/WebProcessPool.cpp:
3628         (WebKit::WebProcessPool::download):
3629         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3630         (WebKit::WebPlatformStrategies::cookiesForDOM):
3631         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
3632         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
3633         (WebKit::WebPlatformStrategies::getRawCookies):
3634         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3635
3636 2018-04-23  Chris Dumez  <cdumez@apple.com>
3637
3638         WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
3639         https://bugs.webkit.org/show_bug.cgi?id=184889
3640         <rdar://problem/38151530>
3641
3642         Reviewed by Brady Eidson.
3643
3644         In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
3645         as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
3646         for the same assertion state, which would cause duplicate logging but also some unnecessary work.
3647
3648         * UIProcess/ProcessThrottler.cpp:
3649         (WebKit::ProcessThrottler::updateAssertionNow):
3650
3651 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3652
3653         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
3654         https://bugs.webkit.org/show_bug.cgi?id=184881
3655
3656         Reviewed by Michael Catanzaro.
3657
3658         The CompositingCoordinator::setVisibleContentsRect() method is always
3659         called with a (0,0) FloatPoint value as the trajectory vector parameter,
3660         which is already the default value in TiledBackingStore where this ends
3661         up. Removing this call chain also enables removing some unnecessary and
3662         odd code in the CoordinatedGraphicsLayer class.
3663
3664         This doesn't yet touch the trajectory logic in the TiledBackingStore
3665         class since it's not yet a given this won't be used in the future. But
3666         if that will be necessary, hope is to not use it this way.
3667
3668         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3669         (WebKit::CompositingCoordinator::setVisibleContentsRect):
3670         (WebKit::CompositingCoordinator::mainContentsLayer): Deleted.
3671         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3672         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3673         (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
3674         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
3675         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
3676         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport):
3677
3678 2018-04-23  Fujii Hironori  <Hironori.Fujii@sony.com>
3679
3680         [Win][WK2] REGRESSION(r230834) 'getpid': identifier not found
3681         https://bugs.webkit.org/show_bug.cgi?id=184877
3682
3683         Reviewed by Yusuke Suzuki.
3684
3685         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3686         (WebKit::WebBackForwardListProxy::addItem): Use WTF::getCurrentProcessID() instead of getpid().
3687         * WebProcess/WebPage/WebPage.cpp:
3688         (WebKit::WebPage::goToBackForwardItem): Ditto.
3689
3690 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3691
3692         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
3693         https://bugs.webkit.org/show_bug.cgi?id=184810
3694
3695         Reviewed by Carlos Garcia Campos.
3696
3697         CoordinatedBackingStore should inherit directly from RefCounted<> now
3698         that TextureMapperBackingStore doesn't anymore.
3699
3700         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
3701         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3702         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded):
3703
3704 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3705
3706         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
3707         https://bugs.webkit.org/show_bug.cgi?id=184811
3708
3709         Reviewed by Carlos Garcia Campos.
3710
3711         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3712         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Stop setting
3713         the removed contentsSize and coveredRect attributes. These were only
3714         ever set to the appropriate values, but were then never used anywhere.
3715
3716 2018-04-22  Matt Baker  <mattbaker@apple.com>
3717
3718         Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
3719         https://bugs.webkit.org/show_bug.cgi?id=184865
3720         <rdar://problem/37764960>
3721
3722         Reviewed by Brian Burg.
3723
3724         Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661,
3725         so that WKWebInspectorProxyObjCAdapter and the view controller can be reused
3726         when reopening the Inspector while the WebView is still alive.
3727
3728         * UIProcess/mac/WebInspectorProxyMac.mm:
3729         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3730
3731 2018-04-22  Paul Knight  <pknight@apple.com>
3732
3733         Add -[WKInputDelegate _webView:decidePolicyForFocusedElement:] so clients can request default focusing behavior
3734         https://bugs.webkit.org/show_bug.cgi?id=184844
3735
3736         Reviewed by Dan Bernstein.
3737
3738         If a client doesn't implement -[_WKInputDelegate _webView:focusShouldStartInputSession:] the default
3739         focus behavior only brings up the keyboard if it's already onscreen, the interaction is user driven,
3740         and other factors that even depend on what feature flags are enabled.
3741
3742         If a client implements _webView:focusShouldStartInputSession:, they don't have a good way to specifiy
3743         they'd like to fall back to the default behavior. This makes it difficult for a client to use the
3744         default in most cases, but sometimes allow programmatic focus from the page, for example.
3745
3746         Add a new delegate method -_webView:decidePolicyForFocusedElement: that returns a new enum type
3747         _WKFocusStartsInputSessionPolicy. Clients can return _WKFocusStartsInputSessionPolicyAuto to request
3748         the default behavior, or _WKFocusStartsInputSessionPolicyAllow / Disallow to directly control whether
3749         the keyboard appears to assist the focused node.
3750
3751         * UIProcess/API/Cocoa/_WKInputDelegate.h:
3752         * UIProcess/ios/WKContentViewInteraction.mm:
3753         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3754
3755 2018-04-21  Jeremy Jones  <jeremyj@apple.com>
3756
3757         Disable backward and forward navigation swipes while in fullscreen.
3758         https://bugs.webkit.org/show_bug.cgi?id=184656
3759         rdar://problem/36057535
3760
3761         Reviewed by Tim Horton.
3762
3763         Disable navigation swipes while in fullscreen.
3764
3765         * UIProcess/Cocoa/ViewGestureController.cpp:
3766         (WebKit::ViewGestureController::canSwipeInDirection const):
3767
3768 2018-04-21  Youenn Fablet  <youenn@apple.com>
3769
3770         Activate NetworkLoadChecker for media loads
3771         https://bugs.webkit.org/show_bug.cgi?id=184841
3772
3773         Reviewed by Eric Carlson.
3774
3775         Instantiate a NetworkLoadChecker for NetworkResourceLoader for audio/video loads.
3776
3777         Move CORS checks for response after handling of 304 checks.
3778         For 304 checks, we need to do the CORS checks on the validated cached response, not the 304 received response.
3779
3780         Updated ResourceError argument coder to explicitly pass the error type
3781         as some errors created by NetworkLoadChecker would otherwise be received as General errors by WebProcess.
3782         Updated platform data encoding of ResourceError accordingly.
3783
3784         All changes are covered by regular media loading layout tests.
3785
3786         * NetworkProcess/NetworkResourceLoader.cpp:
3787         (WebKit::shouldUseNetworkLoadChecker):
3788         (WebKit::NetworkResourceLoader::didReceiveResponse):
3789         * Shared/WebCoreArgumentCoders.cpp:
3790         (IPC::ArgumentCoder<ResourceError>::encode):
3791         (IPC::ArgumentCoder<ResourceError>::decode):
3792         * Shared/mac/WebCoreArgumentCodersMac.mm:
3793         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
3794         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
3795         We need to set the type after decoding the NSError as ResourceError tries to guess the type from NSError data.
3796         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
3797         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
3798         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
3799
3800 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3801
3802         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
3803         https://bugs.webkit.org/show_bug.cgi?id=184480
3804
3805         Reviewed by Michael Catanzaro.
3806
3807         Connect to GTlsConnection::accept-certificate signal instead of SoupMessage::notify::tls-errors to perform the
3808         TLS errors check.
3809
3810         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3811         (WebKit::NetworkDataTaskSoup::createRequest): Do not connect to SoupMessage::notify::tls-errors.
3812         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): Call tlsConnectionAcceptCertificate() is
3813         the task is still ongoing.
3814         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Check TLS errors here.
3815         (WebKit::NetworkDataTaskSoup::networkEventCallback): Pass the stream to networkEvent.
3816         (WebKit::NetworkDataTaskSoup::networkEvent): Connect to GTlsConnection::accept-certificate.
3817         * NetworkProcess/soup/NetworkDataTaskSoup.h:
3818
3819 2018-04-20  Timothy Hatcher  <timothy@apple.com>
3820
3821         NULL dereference crash sometimes under [super initWithCoder:] in WebView
3822
3823         https://bugs.webkit.org/show_bug.cgi?id=184851
3824         rdar://problem/39611236
3825
3826         Reviewed by Tim Horton.
3827
3828         * UIProcess/API/Cocoa/WKWebView.mm:
3829         (-[WKWebView _initializeWithConfiguration:]):
3830         (-[WKWebView effectiveAppearanceDidChange]):
3831         Added a null check and call the code later in initialization.
3832
3833 2018-04-20  Tim Horton  <timothy_horton@apple.com>
3834
3835         Adjust geolocation feature flag
3836         https://bugs.webkit.org/show_bug.cgi?id=184856
3837
3838         Reviewed by Wenson Hsieh.
3839
3840         * Configurations/FeatureDefines.xcconfig:
3841
3842 2018-04-20  Chris Dumez  <cdumez@apple.com>
3843
3844         Unreviewed attempt to fix GTK build after r230867.
3845
3846         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
3847         (webkit_dom_dom_window_get_self):
3848         (webkit_dom_dom_window_get_window):
3849         (webkit_dom_dom_window_get_frames):
3850         (webkit_dom_dom_window_get_opener):
3851         (webkit_dom_dom_window_get_parent):
3852         (webkit_dom_dom_window_get_top):
3853
3854 2018-04-20  Commit Queue  <commit-queue@webkit.org>
3855
3856         Unreviewed, rolling out r230873.
3857         https://bugs.webkit.org/show_bug.cgi?id=184857
3858
3859         Broke the iOS build (Requested by cdumez on #webkit).
3860
3861         Reverted changeset:
3862
3863         "Disable backward and forward navigation swipes while in
3864         fullscreen."
3865         https://bugs.webkit.org/show_bug.cgi?id=184656
3866         https://trac.webkit.org/changeset/230873
3867
3868 2018-04-20  Chris Dumez  <cdumez@apple.com>
3869
3870         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
3871         https://bugs.webkit.org/show_bug.cgi?id=184210
3872         <rdar://problem/39072354>
3873
3874         Reviewed by Wenson Hsieh.
3875
3876         r229828 tried to have some API tests happy on iOS by freezing the layer tree
3877         during the navigation policy decision. However, this is observable by the client
3878         application and a regression from when the policy delegate was synchronous.
3879
3880         To address the issue, this patch reverts r229828 and instead updates the iOS
3881         API tests to wait for the next presentation update after navigating
3882         before interacting with the view.
3883
3884         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3885         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3886         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3887         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
3888         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
3889         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3890         * WebProcess/WebPage/WebPage.cpp:
3891         * WebProcess/WebPage/WebPage.h:
3892
3893 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
3894
3895         Limit cookie header access to Network process
3896         https://bugs.webkit.org/show_bug.cgi?id=184764
3897         <rdar://problem/36785285>
3898
3899         Reviewed by Youenn Fablet.
3900
3901         Revise the handling of cookie request headers so that we don't interact with them in the
3902         WebContent process. They are only needed for interaction with the server and the network
3903         process, so we should limit their scope to just the Network process.
3904
3905         Instead, we should handle a token that represents the cookie headers in the WebContent
3906         process, which can be converted to the relevant cookie data in the network process when
3907         needed.
3908
3909         * NetworkProcess/NetworkSocketStream.cpp:
3910         (WebKit::NetworkSocketStream::sendHandshake):
3911         * NetworkProcess/NetworkSocketStream.h:
3912         * NetworkProcess/NetworkSocketStream.messages.in:
3913         * WebProcess/Network/WebSocketStream.cpp:
3914         (WebKit::WebSocketStream::networkProcessCrashed):
3915         (WebKit::WebSocketStream::platformSendHandshake):
3916         (WebKit::WebSocketStream::didSendHandshake):
3917         * WebProcess/Network/WebSocketStream.h:
3918         * WebProcess/Network/WebSocketStream.messages.in:
3919
3920 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3921
3922         Disable backward and forward navigation swipes while in fullscreen.
3923         https://bugs.webkit.org/show_bug.cgi?id=184656
3924         rdar://problem/36057535
3925
3926         Reviewed by Tim Horton.
3927
3928         Disable navigation swipes while in fullscreen.
3929
3930         * UIProcess/Cocoa/ViewGestureController.cpp:
3931         (WebKit::ViewGestureController::canSwipeInDirection const):
3932
3933 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3934
3935         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
3936         https://bugs.webkit.org/show_bug.cgi?id=184826
3937         rdar://problem/39600825
3938
3939         Reviewed by Tim Horton.
3940
3941         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
3942
3943         * UIProcess/API/Cocoa/WKWebView.mm:
3944         (-[WKWebView _fullScreenPlaceholderView]):
3945         (-[WKWebView closeFullScreenWindowController]):
3946         (-[WKWebView fullScreenPlaceholderView]): Deleted.
3947         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3948         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3949         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
3950         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3951         (-[WKFullScreenWindowController webViewPlaceholder]):
3952
3953 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3954
3955         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
3956         https://bugs.webkit.org/show_bug.cgi?id=184822
3957         <rdar://problem/38807319>
3958
3959         Reviewed by Tim Horton.
3960
3961         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
3962         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
3963         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
3964
3965         * UIProcess/API/Cocoa/WKWebView.mm:
3966         (-[WKWebView _simulateTextEntered:]):
3967         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3968
3969         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
3970         SPI added in 2017 to help test drag and drop for iOS 11.
3971
3972         * UIProcess/ios/WKContentViewInteraction.h:
3973         * UIProcess/ios/WKContentViewInteraction.mm:
3974         (-[WKContentView _simulateTextEntered:]):
3975         * WebProcess/WebPage/WebPage.cpp:
3976         (WebKit::WebPage::setTextAsync):
3977
3978 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
3979
3980         EnterFullscreen must update the minimum and maximum layout sizes.
3981         https://bugs.webkit.org/show_bug.cgi?id=184828
3982         rdar://problem/38435829
3983
3984         Reviewed by Jon Lee.
3985
3986         Without this, the WKWebView won't layout to the full size in fullscreen mode.
3987
3988         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3989         (-[WKFullScreenWindowController enterFullScreen]):
3990
3991 2018-04-18  Jer Noble  <jer.noble@apple.com>
3992
3993         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
3994         https://bugs.webkit.org/show_bug.cgi?id=184762
3995
3996         Reviewed by Dan Bernstein.
3997
3998         * Configurations/BaseTarget.xcconfig:
3999
4000 2018-04-20  Youenn Fablet  <youenn@apple.com>
4001
4002         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
4003         https://bugs.webkit.org/show_bug.cgi?id=184755
4004
4005         Reviewed by Chris Dumez.
4006
4007         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
4008         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
4009
4010         Since we call didFail asynchronously to make sync/async handling more consistent,
4011         We need to keep track of whether we will do clean-up twice.
4012         A boolean is added for that purpose in NetworkResourceLoader.
4013
4014         There is a small change of behavior in the way we return an error.
4015         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
4016         This allows getting some more error logging in the JS console.
4017
4018         * NetworkProcess/NetworkResourceLoader.cpp:
4019         (WebKit::NetworkResourceLoader::didReceiveResponse):
4020         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
4021         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
4022         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
4023         * NetworkProcess/NetworkResourceLoader.h:
4024
4025 2018-04-20  Timothy Hatcher  <timothy@apple.com>
4026
4027         Include missing files in WKContentViewInteraction.{mm,h}
4028
4029         https://bugs.webkit.org/show_bug.cgi?id=184832
4030         rdar://problem/35377120
4031
4032         Reviewed by Wenson Hsieh.
4033
4034         Some WebDriver files were missing and should be included.
4035
4036         * UIProcess/ios/WKContentViewInteraction.h:
4037         * UIProcess/ios/WKContentViewInteraction.mm: