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