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