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