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