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