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