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