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