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