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