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