Make fetch() use "same-origin" credentials by default
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-07-10  Youenn Fablet  <youenn@apple.com>
2
3         Make fetch() use "same-origin" credentials by default
4         https://bugs.webkit.org/show_bug.cgi?id=176023
5
6         Reviewed by Chris Dumez.
7
8         Before the patch, when changing the credential mode in case of redirection,
9         we were not waiting for WebProcess response to restart the load.
10         This patch updates the implementation to ask the WebProcess whether to proceed as for other regular asynchronous loads.
11         This requires some refactoring in particular we now pass request, redirectRequest and redirectResponse to NetworkLoadChecker
12         that will send them back as part of the completion handler.
13
14         To do so, we change manual redirection handling and make it a successful case and not an error case as before.
15
16         * NetworkProcess/NetworkLoadChecker.cpp:
17         (WebKit::redirectionError):
18         (WebKit::NetworkLoadChecker::checkRedirection):
19         * NetworkProcess/NetworkLoadChecker.h:
20         * NetworkProcess/NetworkResourceLoader.cpp:
21         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
22         (WebKit::NetworkResourceLoader::restartNetworkLoad):
23         (WebKit::NetworkResourceLoader::continueWillSendRequest):
24         * NetworkProcess/NetworkResourceLoader.h:
25         * NetworkProcess/PingLoad.cpp:
26         (WebKit::PingLoad::willPerformHTTPRedirection):
27
28 2018-07-10  Chris Dumez  <cdumez@apple.com>
29
30         [IOS] We should prevent WebProcess suspension while the UIProcess is waiting for a reply from its injected bundle
31         https://bugs.webkit.org/show_bug.cgi?id=187536
32         <rdar://problem/41931912>
33
34         Reviewed by Brady Eidson.
35
36         Update RemoteObjectRegistry to take a background process assertion for each pending reply on the
37         UIProcess side. Otherwise, the destination web process may get suspended and the reply block would
38         not get called. We already do this in WebPageProxy for callbacks waiting for an IPC from the
39         WebProcess.
40
41         * Shared/API/Cocoa/RemoteObjectRegistry.h:
42         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
43         (WebKit::RemoteObjectRegistry::RemoteObjectRegistry):
44         (WebKit::RemoteObjectRegistry::sendInvocation):
45         (WebKit::RemoteObjectRegistry::callReplyBlock):
46         (WebKit::RemoteObjectRegistry::releaseUnusedReplyBlock):
47         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
48         (-[_WKRemoteObjectRegistry _initWithWebPage:]):
49         (-[_WKRemoteObjectRegistry _initWithWebPageProxy:]):
50         (-[_WKRemoteObjectRegistry _initWithMessageSender:]): Deleted.
51         * Shared/API/Cocoa/_WKRemoteObjectRegistryInternal.h:
52         * UIProcess/API/Cocoa/WKWebView.mm:
53         (-[WKWebView _remoteObjectRegistry]):
54         * UIProcess/Cocoa/WebViewImpl.mm:
55         (WebKit::WebViewImpl::remoteObjectRegistry):
56         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
57         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
58
59 2018-07-09  Brian Burg  <bburg@apple.com>
60
61         WebDriver: hang when running Selenium test correct_event_firing_tests.py::testShouldEmitOnChangeEventsWhenSelectingElements[Safari]
62         https://bugs.webkit.org/show_bug.cgi?id=187486
63         <rdar://problem/41987110>
64
65         Reviewed by Tim Horton.
66
67         This test takes the unusual step of doing Element Click directly on a <select> element,
68         despite the specification supporting clicking on <option> elements directly. It hangs
69         because we fire a nested run loop when the Carbon popup menu appears, and the nested runloop
70         is not exited until the popup menu is clicked or dismissed.
71
72         If a click is being simulated on the <select> via WebDriver, we should just not show
73         the popup menu but still deliver all of the events that are fired when clicking the element.
74
75         * UIProcess/WebPageProxy.cpp:
76         (WebKit::WebPageProxy::showPopupMenu):
77
78 2018-07-10  Tim Horton  <timothy_horton@apple.com>
79
80         Try to fix the build
81
82         * UIProcess/API/Cocoa/WKWebView.mm:
83         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
84
85 2018-07-10  Tim Horton  <timothy_horton@apple.com>
86
87         doAfterNextPresentationUpdate should not be called while content is hidden due to animated resize
88         https://bugs.webkit.org/show_bug.cgi?id=187500
89         <rdar://problem/41294139>
90
91         Reviewed by Simon Fraser.
92
93         Clients generally expect that after doAfterNextPresentationUpdate, there's
94         something vaguely sensible on the screen. They use this to remove snapshots,
95         unhide web views, etc.
96
97         During some kinds of resize/rotation, we will hide the WKContentView,
98         and asynchronously hide it when the resize/rotation is complete. This
99         can cause clients to prematurely expose a blank WKWebView.
100
101         To fix this, avoid calling doAfterNextPresentationUpdate until the
102         animated resize completes. Add a variant that does not wait for this
103         (to be used for testing purposes).
104
105         * UIProcess/API/Cocoa/WKWebView.mm:
106         (-[WKWebView _didCompleteAnimatedResize]):
107         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
108         Rename the vector of blocks that we call after animated resize completes
109         to be generic rather than just about snapshots.
110
111         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
112         Add this _internal variant of _doAfterNextPresentationUpdate that takes bits determining
113         which waits to perform or avoid, to reduce duplication.
114
115         (-[WKWebView _doAfterNextPresentationUpdate:]):
116         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]):
117         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
118         Call _internalDoAfterNextPresentationUpdate with the appropriate bits set for each situation.
119
120         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
121         Add _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting to WKWebView(WKTesting).
122
123 2018-07-10  Tim Horton  <timothy_horton@apple.com>
124
125         REGRESSION (r231510): Dismissing PDFPlugin context menu automatically clicks the first item
126         https://bugs.webkit.org/show_bug.cgi?id=187507
127         <rdar://problem/42007155>
128
129         Reviewed by Per Arne Vollan.
130
131         WebPageProxy::showPDFContextMenu, introduced in r213510, assumes that
132         the user always chooses some item from the menu; it does not handle
133         the case where the context menu is dismissed without selecting anything.
134
135         * UIProcess/WebPageProxy.h:
136         * UIProcess/WebPageProxy.messages.in:
137         * UIProcess/mac/WebPageProxyMac.mm:
138         (-[WKPDFMenuTarget selectedMenuItem]):
139         (-[WKPDFMenuTarget contextMenuAction:]):
140         (WebKit::WebPageProxy::showPDFContextMenu):
141         * WebProcess/Plugins/PDF/PDFPlugin.mm:
142         (WebKit::PDFPlugin::handleContextMenuEvent):
143         Make showPDFContextMenu return an optional index, instead of always
144         returning an index. Don't perform any action if it is nullopt.
145
146 2018-07-10  Stephan Szabo  <stephan.szabo@sony.com>
147
148         [WinCairo] Support display of webinspector ui on non-legacy minibrowser
149         https://bugs.webkit.org/show_bug.cgi?id=187415
150
151         Reviewed by Brian Burg.
152
153         * UIProcess/WebInspectorProxy.h:
154         * UIProcess/win/WebInspectorProxyWin.cpp:
155         (WebKit::getInspectedWindowInfo):
156         (WebKit::WebInspectorProxy::windowReceivedMessage):
157         (WebKit::WebInspectorProxy::wndProc):
158         (WebKit::WebInspectorProxy::registerWindowClass):
159         (WebKit::decidePolicyForNavigationAction):
160         (WebKit::webProcessDidCrash):
161         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
162         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
163         (WebKit::WebInspectorProxy::inspectorPageURL):
164         (WebKit::WebInspectorProxy::inspectorTestPageURL):
165         (WebKit::WebInspectorProxy::inspectorBaseURL):
166         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
167         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
168         (WebKit::WebInspectorProxy::platformAttach):
169         (WebKit::WebInspectorProxy::platformDetach):
170         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
171         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
172         (WebKit::WebInspectorProxy::platformIsFront):
173         (WebKit::WebInspectorProxy::platformHide):
174         (WebKit::WebInspectorProxy::platformBringToFront):
175         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
176         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
177         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
178         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
179         (WebKit::WebInspectorProxy::platformInvalidate):
180         (WebKit::WebInspectorProxy::platformStartWindowDrag):
181         * WebProcess/WebPage/WebInspector.cpp:
182         (WebKit::WebInspector::openFrontendConnection):
183         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
184         (WebKit::WebInspectorUI::localizedStringsURL):
185         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
186
187 2018-07-10  John Wilander  <wilander@apple.com>
188
189         Resource Load Statistics: Make testRunner.statisticsResetToConsistentState() take a completion handler
190         https://bugs.webkit.org/show_bug.cgi?id=187499
191         <rdar://problem/41999431>
192
193         Reviewed by Chris Dumez.
194
195         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
196         (WKWebsiteDataStoreStatisticsResetToConsistentState):
197             Now uses a WTF::CallbackAggregator to call its
198             completion handler when both the call to
199             WebResourceLoadStatisticsStore::scheduleClearInMemory()
200             and to
201             WebResourceLoadStatisticsStore::resetParametersToDefaultValues()
202             are complete.
203         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
204         * UIProcess/WebResourceLoadStatisticsStore.cpp:
205         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
206             Now takes a WTF::CompletionHandler so that it can support the
207             completion handler in
208             WKWebsiteDataStoreStatisticsResetToConsistentState().
209         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
210             Now takes a WTF::CompletionHandler so that it can support the
211             completion handler in
212             WKWebsiteDataStoreStatisticsResetToConsistentState().
213         * UIProcess/WebResourceLoadStatisticsStore.h:
214
215 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
216
217         Disable cross-origin-window-policy by default
218         https://bugs.webkit.org/show_bug.cgi?id=187509
219
220         Reviewed by Chris Dumez.
221
222         * Shared/WebPreferences.yaml:
223         * UIProcess/API/C/WKPreferences.cpp:
224         (WKPreferencesSetCrossOriginWindowPolicyEnabled):
225         (WKPreferencesGetCrossOriginWindowPolicyEnabled):
226         * UIProcess/API/C/WKPreferencesRef.h:
227
228 2018-07-09  Tim Horton  <timothy_horton@apple.com>
229
230         REGRESSION (r232416): Flickering when going back to Google search results on back swipe
231         https://bugs.webkit.org/show_bug.cgi?id=187506
232         <rdar://problem/41939594>
233
234         Reviewed by Chris Dumez.
235
236         Same document navigations won't have a preceding didStartProvisionalLoadForMainFrame,
237         so the code introduced in r232416 would immediately remove the snapshot
238         upon any same document navigation.
239
240         Instead, adjust r232416 slightly to start tracking snapshot removal events
241         after didStartProvisionalLoad OR didSameDocumentNavigation. Call the block
242         that starts tracking, then immediately fire the same-document navigation event.
243
244         * UIProcess/Cocoa/ViewGestureController.cpp:
245         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
246         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
247         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
248         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
249         * UIProcess/Cocoa/ViewGestureController.h:
250         * UIProcess/ios/ViewGestureControllerIOS.mm:
251         (WebKit::ViewGestureController::endSwipeGesture):
252         * UIProcess/mac/ViewGestureControllerMac.mm:
253         (WebKit::ViewGestureController::endSwipeGesture):
254
255 2018-07-09  Youenn Fablet  <youenn@apple.com>
256
257         Remove cfca.com.npCryptoKit.CGB.MAC.sb and cfca.com.npP11CertEnroll.MAC.CGB.sb
258         https://bugs.webkit.org/show_bug.cgi?id=187487
259         <rdar://problem/41991584>
260
261         Reviewed by Alexey Proskuryakov.
262
263         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Removed.
264         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Removed.
265         * WebKit.xcodeproj/project.pbxproj:
266
267 2018-07-09  Youenn Fablet  <youenn@apple.com>
268
269         Add the possibility to run unsandboxed plug-ins
270         https://bugs.webkit.org/show_bug.cgi?id=187310
271         <rdar://problem/41798808>
272
273         Reviewed by Alexey Proskuryakov.
274
275         Add a utility method to know which plug-ins are allowed to run unsandboxed.
276         For such plug-ins, we skip the sandboxing done when starting the plug-in process.
277
278         * PluginProcess/mac/PluginProcessMac.mm:
279         (WebKit::PluginProcess::initializeSandbox):
280         * Shared/WebPreferences.yaml:
281         * UIProcess/Plugins/PluginInfoStore.cpp:
282         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
283         * UIProcess/Plugins/PluginInfoStore.h:
284         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
285         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
286         (WebKit::PluginInfoStore::shouldUsePlugin):
287
288 2018-07-09  Dean Jackson  <dino@apple.com>
289
290         Remove fullscreen-auto-hide-delay
291         https://bugs.webkit.org/show_bug.cgi?id=187493
292         <rdar://problem/41830852>
293
294         Reviewed by Antoine Quint.
295
296         Now there is no delay, rename setFullscreenAutoHideTiming to setFullscreenAutoHideDuration,
297         and only send that value over to the Web Process.
298
299         * UIProcess/WebFullScreenManagerProxy.cpp:
300         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
301         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideTiming): Deleted.
302         * UIProcess/WebFullScreenManagerProxy.h:
303         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
304         (-[WKFullScreenViewController viewWillAppear:]):
305         * WebProcess/FullScreen/WebFullScreenManager.cpp:
306         (WebKit::WebFullScreenManager::didExitFullScreen):
307         (WebKit::WebFullScreenManager::setFullscreenAutoHideDuration):
308         (WebKit::WebFullScreenManager::setFullscreenAutoHideTiming): Deleted.
309         * WebProcess/FullScreen/WebFullScreenManager.h:
310         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
311
312 2018-07-09  Timothy Hatcher  <timothy@apple.com>
313
314         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
315         https://bugs.webkit.org/show_bug.cgi?id=187425
316         rdar://problem/39948240
317
318         Reviewed by Tim Horton.
319
320         * UIProcess/API/Cocoa/WKWebView.mm:
321         (-[WKWebView _initializeWithConfiguration:]): Moved call to setUseDarkAppearance to WebViewImpl.
322         (-[WKWebView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
323         (-[WKWebView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
324         (-[WKWebView _effectiveAppearanceIsDark]): Deleted.
325         (-[WKWebView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
326         * UIProcess/API/mac/WKView.mm:
327         (-[WKView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
328         (-[WKView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
329         (-[WKView _effectiveAppearanceIsDark]): Deleted.
330         (-[WKView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
331         * UIProcess/Cocoa/WebViewImpl.h:
332         * UIProcess/Cocoa/WebViewImpl.mm:
333         (WebKit::WebViewImpl::WebViewImpl): Call setUseDarkAppearance before page config is sent in initializeWebPage.
334         (WebKit::WebViewImpl::effectiveAppearanceDidChange): Added.
335         * WebProcess/WebPage/WebPage.cpp:
336         (WebKit::WebPage::setUseDarkAppearance): WebCore::Page::setUseDarkAppearance now handles the style changes.
337         The RenderTheme color caches also don't need cleared with platformColorsDidChange(), since we cache light
338         and dark colors seperatly in RenderThemeMac.
339
340 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
341
342         Shrink various loading-related enums to shrink CachedResource
343         https://bugs.webkit.org/show_bug.cgi?id=187443
344
345         Reviewed by Chris Dumez.
346
347         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
348         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
349         * NetworkProcess/NetworkLoad.cpp:
350         (WebKit::NetworkLoad::continueWillSendRequest):
351         * NetworkProcess/NetworkLoadParameters.h:
352         * NetworkProcess/NetworkResourceLoader.cpp:
353         (WebKit::NetworkResourceLoader::canUseCache const):
354         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
355         * NetworkProcess/cache/NetworkCache.cpp:
356         (WebKit::NetworkCache::cachePolicyAllowsExpired):
357         (WebKit::NetworkCache::makeRetrieveDecision):
358         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
359         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
360         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
361         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
362         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
363         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
364         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
365         * Shared/API/c/mac/WKURLRequestNS.mm:
366         (WKURLRequestCopyNSURLRequest):
367         * Shared/Cocoa/WKNSURLRequest.mm:
368         (-[WKNSURLRequest _web_createTarget]):
369         * Shared/mac/WebCoreArgumentCodersMac.mm:
370         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
371         * UIProcess/API/Cocoa/WKFrameInfo.mm:
372         (-[WKFrameInfo request]):
373         * UIProcess/API/Cocoa/WKNavigation.mm:
374         (-[WKNavigation _request]):
375         * UIProcess/API/Cocoa/WKNavigationAction.mm:
376         (-[WKNavigationAction request]):
377         * UIProcess/API/Cocoa/WKNavigationData.mm:
378         (-[WKNavigationData originalRequest]):
379         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
380         (-[WKNavigationResponse _request]):
381         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
382         (-[WKURLSchemeTaskImpl request]):
383         * UIProcess/API/Cocoa/_WKDownload.mm:
384         (-[_WKDownload request]):
385         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
386         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
387         * WebProcess/Network/WebLoaderStrategy.cpp:
388         (WebKit::maximumBufferingTime):
389         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
390         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
391         * WebProcess/WebPage/mac/WebPageMac.mm:
392         (WebKit::WebPage::platformCanHandleRequest):
393
394 2018-07-09  Chris Dumez  <cdumez@apple.com>
395
396         WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData() fails to protect the page in its lambda
397         https://bugs.webkit.org/show_bug.cgi?id=187478
398         <rdar://problem/41975998>
399
400         Reviewed by Youenn Fablet.
401
402         Make sure we protect the WebPageProxy when we capture it in the lambda or it might go away by the
403         time the lambda gets called.
404
405         * UIProcess/WebProcessProxy.cpp:
406         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
407
408 2018-07-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
409
410         [Curl] Remove unused AuthenticationManager static methods.
411         https://bugs.webkit.org/show_bug.cgi?id=187419
412
413         Reviewed by Yusuke Suzuki.
414
415         The file for curl port was added without implementation and never called from anyware.
416         Also interfaces only used by the curl port were removed from the shared header file.
417
418         * PlatformWin.cmake:
419         * Shared/Authentication/AuthenticationManager.h:
420         * Shared/Authentication/curl/AuthenticationManagerCurl.cpp: Removed.
421
422 2018-07-09  Stephan Szabo  <stephan.szabo@sony.com>
423
424         Check that LayerTreeHost was created before use
425         https://bugs.webkit.org/show_bug.cgi?id=187404
426
427         Reviewed by Žan Doberšek.
428
429         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
430         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
431
432 2018-07-09  Commit Queue  <commit-queue@webkit.org>
433
434         Unreviewed, rolling out r233612.
435         https://bugs.webkit.org/show_bug.cgi?id=187475
436
437         Revision caused the api test LinkColorWithSystemAppearance to
438         fail on all systems. (Requested by Truitt on #webkit).
439
440         Reverted changeset:
441
442         "Semantic colors don't update when accessibility Increase
443         Contrast mode is enabled."
444         https://bugs.webkit.org/show_bug.cgi?id=187425
445         https://trac.webkit.org/changeset/233612
446
447 2018-07-09  Brian Burg  <bburg@apple.com>
448
449         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
450         https://bugs.webkit.org/show_bug.cgi?id=187418
451         <rdar://problem/41909520>
452
453         Unreviewed build fix for Sierra.
454
455         * UIProcess/WebPageProxy.cpp:
456         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
457         According to some compilers, the local 'automationSession' is unused. Change this
458         to just convert the return value to boolean rather than assign to an unused local.
459
460 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
461
462         Introduce a layout milestone to track when the document contains a large number of rendered characters
463         https://bugs.webkit.org/show_bug.cgi?id=187412
464         <rdar://problem/41744338>
465
466         Reviewed by Ryosuke Niwa.
467
468         Add plumbing for the new significant rendered text layout milestone in the modern WebKit client layer. See
469         WebCore/ChangeLog for more details.
470
471         * Shared/API/Cocoa/_WKRenderingProgressEvents.h:
472         * Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h:
473         (renderingProgressEvents):
474         * Shared/API/c/WKPageLoadTypes.h:
475         * Shared/API/c/WKSharedAPICast.h:
476         (WebKit::toWKLayoutMilestones):
477         (WebKit::toLayoutMilestones):
478         * UIProcess/API/Cocoa/WKWebView.mm:
479         (layoutMilestones):
480
481 2018-07-07  Simon Fraser  <simon.fraser@apple.com>
482
483         REGRESSION (r233561): MobileMail crashes when replying to an email
484         https://bugs.webkit.org/show_bug.cgi?id=187436
485         rdar://problem/41931915
486
487         Reviewed by Alan Bujtas.
488         
489         r233561 added a RELEASE_ASSERT(isMainThread()) in this function. This is fine most of the time,
490         until Mail spawns a WebThread for mail compose, at which point the meaning of isMainThread changes
491         and the RELEASE_ASSERT fires.
492         
493         For now, just remove the RELEASE_ASSERT.
494
495         * UIProcess/API/Cocoa/WKWebView.mm:
496         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
497
498 2018-07-06  Timothy Hatcher  <timothy@apple.com>
499
500         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
501         https://bugs.webkit.org/show_bug.cgi?id=187425
502         rdar://problem/39948240
503
504         Reviewed by Tim Horton.
505
506         * UIProcess/API/Cocoa/WKWebView.mm:
507         (-[WKWebView _initializeWithConfiguration:]): Moved call to setUseDarkAppearance to WebViewImpl.
508         (-[WKWebView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
509         (-[WKWebView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
510         (-[WKWebView _effectiveAppearanceIsDark]): Deleted.
511         (-[WKWebView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
512         * UIProcess/API/mac/WKView.mm:
513         (-[WKView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
514         (-[WKView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
515         (-[WKView _effectiveAppearanceIsDark]): Deleted.
516         (-[WKView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
517         * UIProcess/Cocoa/WebViewImpl.h:
518         * UIProcess/Cocoa/WebViewImpl.mm:
519         (WebKit::WebViewImpl::WebViewImpl): Call setUseDarkAppearance before page config is sent in initializeWebPage.
520         (WebKit::WebViewImpl::effectiveAppearanceDidChange): Added.
521         * WebProcess/WebPage/WebPage.cpp:
522         (WebKit::WebPage::setUseDarkAppearance): WebCore::Page::setUseDarkAppearance now handles the style changes.
523         The RenderTheme color caches also don't need cleared with platformColorsDidChange(), since we cache light
524         and dark colors seperatly in RenderThemeMac.
525
526 2018-07-06  Chris Dumez  <cdumez@apple.com>
527
528         Add release assertions to try and catch a possible HashMap corruption in NetworkConnectionToWebProcess
529         https://bugs.webkit.org/show_bug.cgi?id=187417
530
531         Reviewed by Ryosuke Niwa.
532
533         Add assertions to make sure we:
534         - Always use NetworkConnectionToWebProcess::m_networkResourceLoaders from the main thread
535         - Never use a 0 identifier as key for NetworkConnectionToWebProcess::m_networkResourceLoaders
536
537         We see crashes (rdar://problem/39265927) that only seem to make sense if this HashMap was
538         somehow getting corrupted. Let's try and catch the most common reasons for HashMap corruption.
539
540         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
541         (WebKit::NetworkConnectionToWebProcess::didCleanupResourceLoader):
542         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
543         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
544         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
545         (WebKit::NetworkConnectionToWebProcess::removeLoadIdentifier):
546         (WebKit::NetworkConnectionToWebProcess::setDefersLoading):
547         (WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
548         * WebProcess/Network/WebResourceLoader.cpp:
549         (WebKit::WebResourceLoader::messageSenderDestinationID):
550
551 2018-07-06  Brian Burg  <bburg@apple.com>
552
553         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
554         https://bugs.webkit.org/show_bug.cgi?id=187418
555         <rdar://problem/41909520>
556
557         Reviewed by Timothy Hatcher.
558
559         Per the W3C specification, “User prompts that are spawned from beforeunload event handlers,
560         are dismissed implicitly upon navigation or close window, regardless of the defined user prompt handler.”
561
562         This behavior differs from legacy Selenium behavior where (as in the test) it's expected that
563         a test can accept or dismiss a beforeunload alert manually.
564
565         Prior to this patch, beforeunload alerts hang because Safari uses a nested modal run loop, which does
566         not process incoming Automation messages, so there was no way for the test to manually dismiss
567         the alert.
568
569         * UIProcess/WebPageProxy.cpp:
570         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
571         Don't show beforeunload alerts for pages being controlled by automation.
572
573
574 2018-07-06  Chris Dumez  <cdumez@apple.com>
575
576         ASSERTION FAILED: contextConnection under WebCore::SWServer::terminateWorkerInternal
577         https://bugs.webkit.org/show_bug.cgi?id=187348
578         <rdar://problem/41853270>
579
580         Reviewed by Youenn Fablet.
581
582         Make sure we mark corresponding SWServerWorkers as terminated when we terminate a
583         Service Worker context connection once it is no longer needed.
584
585         * StorageProcess/StorageProcess.cpp:
586         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
587
588 2018-07-06  Andy Estes  <aestes@apple.com>
589
590         [iOS] WKPDFView should show the Data Detectors sheet when long-pressing a URL that Data Detectors can handle
591         https://bugs.webkit.org/show_bug.cgi?id=187396
592         <rdar://problem/41786980>
593
594         Reviewed by Dan Bernstein.
595
596         If a URL can be presented by Data Detectors, show the Data Detectors sheet instead
597         of the link sheet. Also implement the optional WKActionSheetAssistantDelegate
598         method that asks the UI delegate for its data detection context.
599
600         * UIProcess/ios/WKPDFView.mm:
601         (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
602         (-[WKPDFView dataDetectionContextForActionSheetAssistant:]):
603
604 2018-07-06  Chris Dumez  <cdumez@apple.com>
605
606         WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler() should take in a CompletionHandler
607         https://bugs.webkit.org/show_bug.cgi?id=187392
608
609         Reviewed by Youenn Fablet.
610
611         * UIProcess/WebResourceLoadStatisticsStore.cpp:
612         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
613         * UIProcess/WebResourceLoadStatisticsStore.h:
614
615 2018-07-06  Chris Dumez  <cdumez@apple.com>
616
617         [iOS] Assertion failure in WebProcessProxy::allProcesses() (isMainThread())
618         https://bugs.webkit.org/show_bug.cgi?id=187394
619
620         Reviewed by Dan Bernstein.
621
622         Use RunLoop::isMain() instead of isMainThread() in the assertion to fix issues for
623         applications using both WebKit and WebKitLegacy.
624
625         * UIProcess/WebProcessProxy.cpp:
626
627 2018-07-06  Daniel Bates  <dabates@apple.com>
628
629         Remove Strong Confirmation Password button
630         https://bugs.webkit.org/show_bug.cgi?id=187306
631         <rdar://problem/41795185>
632
633         Reviewed by Sam Weinig.
634
635         Remove support for the Strong Confirmation Password button because we never made use of it.
636
637         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
638         (toAutoFillButtonType):
639         (toWKAutoFillButtonType):
640         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
641         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
642         (toAutoFillButtonType):
643         (toWKAutoFillButtonType):
644         * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
645
646 2018-07-05  Youenn Fablet  <youenn@apple.com>
647
648         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
649         https://bugs.webkit.org/show_bug.cgi?id=187346
650         <rdar://problem/41773974>
651
652         Reviewed by Ryosuke Niwa.
653
654         Reset page plugins when the load client policies are updated.
655         This will ensure that pages will rebuild their plugin lists based on the new policies.
656
657         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
658         (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
659         (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
660
661 2018-07-05  Brady Eidson  <beidson@apple.com>
662
663         IndexedDB operations in a Page fail after a StorageProcess crash.
664         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
665
666         Reviewed by Alex Christensen.
667
668         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
669         in the WebProcess about it.
670         
671         This puts Documents/Workers in an error mode where requests fail instead of timeout.
672         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
673         new connection that works.
674         
675         * UIProcess/API/C/WKContext.cpp:
676         (WKContextTerminateStorageProcess):
677         
678         * UIProcess/API/Cocoa/WKProcessPool.mm:
679         (-[WKProcessPool _terminateStorageProcess]):
680         
681         * UIProcess/Storage/StorageProcessProxy.cpp:
682         (WebKit::StorageProcessProxy::terminateForTesting):
683         * UIProcess/Storage/StorageProcessProxy.h:
684         
685         * UIProcess/WebProcessPool.cpp:
686         (WebKit::WebProcessPool::terminateStorageProcessForTesting):
687         (WebKit::WebProcessPool::terminateStorageProcess): Deleted.
688         * UIProcess/WebProcessPool.h:
689         
690         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
691         (WebKit::WebToStorageProcessConnection::didClose):
692         * WebProcess/Storage/WebToStorageProcessConnection.h:
693         (WebKit::WebToStorageProcessConnection::existingIDBConnectionToServerForIdentifier):
694         
695         * WebProcess/WebProcess.cpp:
696         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
697
698 2018-07-05  Simon Fraser  <simon.fraser@apple.com>
699
700         Address two possible causes of missing tiles in iOS Safari, and add logging to gather more data about other possible causes
701         https://bugs.webkit.org/show_bug.cgi?id=187376
702         rdar://problem/40941118
703
704         Reviewed by Tim Horton.
705         
706         We have continual reports of users experiencing missing tiles in MobileSafari, where loading a page
707         shows the tiles at the top, but we don't render new tiles as the user scrolls down. This is consistent
708         with failing to dispatch visible content rect updates via -[WKWebView _updateVisibleContentRects].
709         
710         This patch addresses two possible (but unlikely) causes. First, it resets _currentlyAdjustingScrollViewInsetsForKeyboard
711         after a web process crash. Second, it catches exceptions thrown by [webView _updateVisibleContentRects]
712         and resets _hasScheduledVisibleRectUpdate.
713         
714         This patch also adds release logging that fires if over 1s has elapsed between scheduling
715         a visible content rect update and trying to re-schedule, and logging for all reasons that
716         -_updateVisibleContentRects returns early.
717
718         * UIProcess/API/Cocoa/WKWebView.mm:
719         (-[WKWebView _initializeWithConfiguration:]):
720         (-[WKWebView _processDidExit]):
721         (-[WKWebView _addUpdateVisibleContentRectPreCommitHandler]):
722         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
723         (-[WKWebView _updateVisibleContentRects]):
724
725 2018-07-05  Olivia Barnett  <obarnett@apple.com>
726
727         iPad: Scrolling with hardware keyboard while SELECT popover is visible scrolls the page, detaches popover
728         https://bugs.webkit.org/show_bug.cgi?id=187363
729         <rdar://problem/41106306>
730
731         Reviewed by Tim Horton.
732
733         Added extra check to prevent keyboard scrolling when the select box is open.
734
735         * UIProcess/ios/WKContentViewInteraction.mm:
736         (-[WKContentView _scrollOffsetForEvent:]):
737
738 2018-07-05  Timothy Hatcher  <timothy@apple.com>
739
740         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
741         https://bugs.webkit.org/show_bug.cgi?id=187369
742         rdar://problem/41870420
743
744         Reviewed by Tim Horton.
745
746         * Shared/WebPageCreationParameters.cpp:
747         (WebKit::WebPageCreationParameters::encode const):
748         (WebKit::WebPageCreationParameters::decode):
749         * Shared/WebPageCreationParameters.h:
750         * UIProcess/API/Cocoa/WKWebView.mm:
751         (-[WKWebView _effectiveAppearanceIsDark]):
752         (-[WKWebView _initializeWithConfiguration:]):
753         (-[WKWebView _setUseSystemAppearance:]):
754         (-[WKWebView effectiveAppearanceDidChange]):
755         (-[WKWebView _defaultAppearance]): Deleted.
756         * UIProcess/API/mac/WKView.mm:
757         (-[WKView _effectiveAppearanceIsDark]):
758         (-[WKView effectiveAppearanceDidChange]):
759         (-[WKView _setUseSystemAppearance:]):
760         (-[WKView _defaultAppearance]): Deleted.
761         (-[WKView _setDefaultAppearance:]): Deleted.
762         * UIProcess/Cocoa/WebViewImpl.h:
763         * UIProcess/Cocoa/WebViewImpl.mm:
764         (WebKit::WebViewImpl::effectiveAppearanceIsDark):
765         (WebKit::WebViewImpl::setUseDarkAppearance):
766         (WebKit::WebViewImpl::useDefaultAppearance): Deleted.
767         (WebKit::WebViewImpl::setDefaultAppearance): Deleted.
768         * UIProcess/WebPageProxy.cpp:
769         (WebKit::WebPageProxy::creationParameters):
770         (WebKit::WebPageProxy::setUseDarkAppearance):
771         (WebKit::WebPageProxy::showPlaybackTargetPicker):
772         (WebKit::WebPageProxy::setDefaultAppearance): Deleted.
773         * UIProcess/WebPageProxy.h:
774         (WebKit::WebPageProxy::useDarkAppearance const):
775         (WebKit::WebPageProxy::defaultAppearance const): Deleted.
776         * UIProcess/mac/WKPrintingView.mm:
777         (-[WKPrintingView drawRect:]):
778         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
779         (WebKit::InjectedBundleRangeHandle::renderedImage):
780         * WebProcess/Plugins/PDF/PDFPlugin.mm:
781         (WebKit::PDFPlugin::paintControlForLayerInContext):
782         * WebProcess/WebPage/WebPage.cpp:
783         (WebKit::m_credentialsMessenger):
784         (WebKit::WebPage::drawRect):
785         (WebKit::WebPage::setUseDarkAppearance):
786         (WebKit::WebPage::setDefaultAppearance): Deleted.
787         * WebProcess/WebPage/WebPage.h:
788         * WebProcess/WebPage/WebPage.messages.in:
789
790 2018-07-05  Brian Burg  <bburg@apple.com>
791
792         REGRESSION: ASSERT under WebAutomationSessionProxy::computeElementLayout when elementInViewClientCenterPoint returns nullopt
793         https://bugs.webkit.org/show_bug.cgi?id=187367
794         <rdar://problem/41861346>
795
796         Reviewed by Timothy Hatcher.
797
798         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
799         (WebKit::WebAutomationSessionProxy::computeElementLayout):
800         There's no reason to unwrap this optional, as the IPC argument type is std::optional<IntPoint>.
801
802 2018-07-05  Tim Horton  <timothy_horton@apple.com>
803
804         Upstream hover gesture implementation
805         https://bugs.webkit.org/show_bug.cgi?id=187366
806
807         Reviewed by Wenson Hsieh.
808
809         * UIProcess/ios/WKContentViewInteraction.h:
810         * UIProcess/ios/WKContentViewInteraction.mm:
811         (-[WKContentView setupInteraction]):
812         (-[WKContentView cleanupInteraction]):
813         (-[WKContentView _removeDefaultGestureRecognizers]):
814         (-[WKContentView _addDefaultGestureRecognizers]):
815         (-[WKContentView _hoverGestureRecognizerChanged:]):
816
817 2018-07-05  Tim Horton  <timothy_horton@apple.com>
818
819         Fix some -Wdocumentation warnings in WebKit
820         https://bugs.webkit.org/show_bug.cgi?id=187318
821
822         Reviewed by Dan Bernstein.
823
824         Fix most of the -Wdocumentation warnings in WebKit. The remaining
825         ones are slightly mysterious, so we can't turn the warning on yet.
826
827         * Configurations/BaseTarget.xcconfig:
828         Define U_HIDE_DEPRECATED_API. It's defined in all other WebKit projects,
829         and the doc comments in the deprecated ICU API have some errors.
830
831         * UIProcess/API/Cocoa/WKUIDelegate.h:
832         * UIProcess/API/Cocoa/WKWebView.h:
833         * UIProcess/API/Cocoa/WKWebsiteDataStore.h:
834         Adjust comments or parameter names to be consistent with each other.
835
836 2018-07-05  Chris Dumez  <cdumez@apple.com>
837
838         Regression(r232886): WebsiteDataStore objects may get destroyed on a background thread
839         https://bugs.webkit.org/show_bug.cgi?id=187356
840         <rdar://problem/41854555>
841
842         Reviewed by Geoffrey Garen.
843
844         As of r232886, CallbackAggregators in WebsiteDataStore hold a Ref<> to their WebsiteDataStore. This
845         is an issue because CallbackAggregator objects can get destroyed on a background thread and may be
846         the last ones holding a ref to the data store. When this happens, the WebsiteDataStore would get
847         destroyed on a background store and potentially cause crashes. Note that even if the callback
848         aggregator would not be the last one to hold a ref to the store, it still would not be safe to deref
849         the store on the background thread since WebsiteDataStore is not ThreadSafeRefCounted.
850
851         To address the issue, this patch updates the CallbackAggregators' destructor to deref their data
852         store member on the main thread. Note that we could also have WebsiteDataStore subclass
853         ThreadSafeRefCounted<T, DestructionThread::Main> but the data store technically does not need to
854         be ThreadSafeRefCounted at the moment.
855
856         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
857         (WebKit::WebsiteDataStore::WebsiteDataStore):
858         (WebKit::WebsiteDataStore::~WebsiteDataStore):
859         (WebKit::WebsiteDataStore::fetchDataAndApply):
860         (WebKit::WebsiteDataStore::removeData):
861
862 2018-07-05  Dan Bernstein  <mitz@apple.com>
863
864         [macOS] REGRESSION: Development WebContent service has restricted entitlements, rendering it useless for development
865         https://bugs.webkit.org/show_bug.cgi?id=187355
866
867         Reviewed by Anders Carlsson.
868
869         * Configurations/WebContentService.Development.xcconfig: Set WK_USE_RESTRICTED_ENTITLEMENTS
870           to NO for the Development service.
871
872 2018-07-05  Rob Buis  <rbuis@igalia.com>
873
874         [GTK] Remove soup/DownloadSoupErrors.h
875         https://bugs.webkit.org/show_bug.cgi?id=187339
876
877         This header is not used anymore.
878
879         Reviewed by Frédéric Wang.
880
881         * NetworkProcess/Downloads/soup/DownloadSoupErrors.h: Removed.
882         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
883         * PlatformGTK.cmake:
884
885 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
886
887         REGRESSION(r233325): [GTK] Broke 40 animations tests
888         https://bugs.webkit.org/show_bug.cgi?id=187264
889
890         Reviewed by Žan Doberšek.
891
892         Use a different PlatformDisplayID for compositing in the GTK port. This way, when entering AC a window screen
893         changed is emitted and the GTK default display refresh monitor is destroyed, ensuring the one created by the
894         threaded compositor is used.
895
896         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
897         (WebKit::ThreadedCompositor::create): Remove unused WebPage parameter and add PlatformDisplayID.
898         (WebKit::ThreadedCompositor::ThreadedCompositor): Create the display refresh monitor with the given displayID.
899         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
900         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
901         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor): Pass the given displayID to the parent constructor.
902         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
903         (WebKit::ThreadedDisplayRefreshMonitor::create): Add PlatformDisplayID parameter.
904         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
905         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): Use compositingDisplayID when
906         creating the threaded compositor and notify about the window screen change.
907         (WebKit::ThreadedCoordinatedLayerTreeHost::setIsDiscardable): Use primaryDisplayID when leaving AC and
908         compositingDisplayID when re-entering.
909
910 2018-07-04  Olivia Barnett  <obarnett@apple.com>
911
912         A WKWebView in a UIViewController that is presented modally and uses a file picker will be incorrectly dismissed by the system
913         https://bugs.webkit.org/show_bug.cgi?id=185257
914         <rdar://problem/40819252>
915
916         Reviewed by Tim Horton.
917
918         Call to dismiss the presented modal was being called on the parent and not the child, which caused the file picker to be incorrectly dismissed along with the modal. A test for this bug-fix could not be completed without additional tools as TestWebKitAPI is not a UI application.
919
920         * UIProcess/ios/forms/WKFileUploadPanel.mm:
921         (-[WKFileUploadPanel _dismissDisplayAnimated:]):
922
923 2018-07-04  Tim Horton  <timothy_horton@apple.com>
924
925         Introduce PLATFORM(IOSMAC)
926         https://bugs.webkit.org/show_bug.cgi?id=187315
927
928         Reviewed by Dan Bernstein.
929
930         * Configurations/Base.xcconfig:
931         * Configurations/FeatureDefines.xcconfig:
932         * Configurations/NetworkService.xcconfig:
933         * Configurations/WebContentService.xcconfig:
934         * Configurations/WebKit.xcconfig:
935         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
936         (WebKit::NetworkProcess::sourceApplicationAuditData const):
937         * NetworkProcess/ios/NetworkProcessIOS.mm:
938         * NetworkProcess/mac/NetworkProcessMac.mm:
939         (WebKit::NetworkProcess::initializeProcessName):
940         (WebKit::overrideSystemProxies):
941         * Platform/mac/LayerHostingContext.mm:
942         (WebKit::LayerHostingContext::createForExternalHostingProcess):
943         * Platform/spi/ios/UIKitSPI.h:
944         * Shared/ios/ChildProcessIOS.mm:
945         (WebKit::ChildProcess::initializeSandbox):
946         * Shared/ios/InteractionInformationAtPosition.h:
947         * Shared/ios/InteractionInformationAtPosition.mm:
948         (WebKit::InteractionInformationAtPosition::encode const):
949         (WebKit::InteractionInformationAtPosition::decode):
950         * Shared/mac/ChildProcessMac.mm:
951         (WebKit::ChildProcess::setApplicationIsDaemon):
952         (WebKit::enableSandboxStyleFileQuarantine):
953         * Shared/mac/CodeSigning.mm:
954         * UIProcess/API/Cocoa/WKWebView.mm:
955         (-[WKWebView _webViewPrintFormatter]):
956         * UIProcess/API/Cocoa/WKWebViewInternal.h:
957         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
958         (WebKit::RemoteLayerTreeHost::updateLayerTree):
959         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
960         (-[WKRemoteView initWithFrame:contextID:]):
961         * UIProcess/_WKWebViewPrintFormatter.mm:
962         * UIProcess/_WKWebViewPrintFormatterInternal.h:
963         * UIProcess/ios/WKContentView.mm:
964         (-[WKContentView _didExitStableState]):
965         * UIProcess/ios/WKContentViewInteraction.mm:
966         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
967         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
968         (-[WKContentView canPerformActionForWebView:withSender:]):
969         (-[WKContentView _defineForWebView:]):
970         (-[WKContentView setSelectedTextRange:]):
971         (-[WKContentView closestPositionToPoint:]):
972         (-[WKContentView _updateChangedSelection:]):
973         * UIProcess/ios/WKLegacyPDFView.mm:
974         * UIProcess/ios/WKPDFView.mm:
975         * WebKit.xcodeproj/project.pbxproj:
976         * WebProcess/WebPage/ios/WebPageIOS.mm:
977         (WebKit::WebPage::selectWithGesture):
978         (WebKit::WebPage::getPositionInformation):
979         * WebProcess/cocoa/WebProcessCocoa.mm:
980         (WebKit::WebProcess::initializeSandbox):
981         * config.h:
982
983 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
984
985         50 failing WebDriver tests after r233417
986         https://bugs.webkit.org/show_bug.cgi?id=187263
987
988         Reviewed by Frédéric Wang.
989
990         A std::optional value is used while being std::nullopt. This is because the wrong input source is used when
991         transitioning keyboard input states.
992
993         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
994         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
995
996 2018-07-03  Youenn Fablet  <youenn@apple.com>
997
998         Remove quarantine for Webex plugin
999         https://bugs.webkit.org/show_bug.cgi?id=187050
1000         rdar://problem/41478189
1001
1002         Reviewed by Brent Fulgham.
1003
1004         Update the Plugin Info.plist to not do quarantine of downloaded files by default.
1005         Update PluginProcess implementation to reenable quarantine for all plug-ins except cisco webex plug-in.
1006
1007         * Platform/spi/mac/QuarantineSPI.h: Add qtn_proc_init.
1008         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
1009         * PluginProcess/PluginProcess.h:
1010         * PluginProcess/mac/PluginProcessMac.mm:
1011         (WebKit::PluginProcess::shouldOverrideQuarantine):
1012         * Shared/ChildProcess.h:
1013         (WebKit::ChildProcess::shouldOverrideQuarantine):
1014         * Shared/mac/ChildProcessMac.mm:
1015         (WebKit::ChildProcess::initializeSandbox):
1016
1017 2018-07-03  Youenn Fablet  <youenn@apple.com>
1018
1019         Crash in  WebKit::CacheStorage::Cache::toRecordInformation when running http/tests/cache-storage/cache-persistency.https.html
1020         https://bugs.webkit.org/show_bug.cgi?id=187243
1021
1022         Reviewed by Chris Dumez.
1023
1024         In case a caches object has an engine, it uses the engine to get the salt.
1025         In case engine/caches are non persistent, no salt was set for the engine, hence the crashes.
1026         Add an empty salt whenever initializing a non-persistent engine to remove the crash.
1027
1028         Covered by updated expectations for two tests.
1029
1030         * NetworkProcess/cache/CacheStorageEngine.cpp:
1031         (WebKit::CacheStorage::Engine::initialize):
1032
1033 2018-07-03  Youenn Fablet  <youenn@apple.com>
1034
1035         Fix regression introduced in r233335
1036         https://bugs.webkit.org/show_bug.cgi?id=187282
1037
1038         Reviewed by Chris Dumez.
1039
1040         When checking for navigation loads, we need to return whether the request URL matches the service worker URL.
1041         Before this patch, if the request URL was not matching the service worker URL, we were using the origin/referrer
1042         which should only be used for subresource loads.
1043
1044         Covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https.html
1045         being no longer flaky.
1046
1047         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1048         (WebKit::isValidFetch):
1049
1050 2018-07-03  Chris Dumez  <cdumez@apple.com>
1051
1052         Make CallbackMap::invalidate() safe to re-enter
1053         https://bugs.webkit.org/show_bug.cgi?id=187298
1054         <rdar://problem/41057167>
1055
1056         Reviewed by Geoffrey Garen.
1057
1058         Made it safe to re-enter CallbackMap::invalidate(), GenericCallback::performCallbackWithReturnValue(),
1059         GenericCallback::invalidate() & invalidateCallbackMap() since those execute client blocks which may
1060         re-enter WebKit.
1061
1062         * UIProcess/GenericCallback.h:
1063         (WebKit::GenericCallback::performCallbackWithReturnValue):
1064         (WebKit::invalidateCallbackMap):
1065
1066 2018-07-03  Brent Fulgham  <bfulgham@apple.com>
1067
1068         [iOS] Clean up sandbox warnings found during Public Beta
1069         https://bugs.webkit.org/show_bug.cgi?id=187308
1070         <rdar://problem/41203914>
1071
1072         Reviewed by Eric Carlson.
1073
1074         I made our sandbox overly restrictive during our iOS 12.0 development cycle, and have found a number of missing items.
1075
1076         This patch adds the missing IOKit properties, and removes a duplicate call to (play-media).
1077
1078         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1079
1080 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1081
1082         [Curl] Embed certificate information into ResourceResponse.
1083         https://bugs.webkit.org/show_bug.cgi?id=187102
1084
1085         Reviewed by Youenn Fablet.
1086
1087         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
1088         (WebKit::NetworkDataTaskCurl::curlDidComplete):.
1089
1090 2018-07-03  Simon Fraser  <simon.fraser@apple.com>
1091
1092         [iOS WK2] We fail to make surfaces volatile when suspending, increasing memory impact
1093         https://bugs.webkit.org/show_bug.cgi?id=187285
1094         rdar://problem/41732391
1095
1096         Reviewed by Tim Horton.
1097         
1098         The "Mach port as layer contents" code path used in iOS WK2 relies on replacing the 
1099         Mach port layer contents with the actual IOSurface on suspension (otherwise the
1100         live Mach port will keep the surface in use). However, we were never hitting this
1101         RemoteLayerTreeHost::mapAllIOSurfaceBackingStore() code path on iOS 11 and later
1102         because UIKit stopped firing the notification we relied on.
1103         
1104         To fix this, use the _UIApplicationDidFinishSuspensionSnapshotNotification notification
1105         which is fired on UIApp.
1106
1107         * Platform/spi/ios/UIKitSPI.h:
1108         * UIProcess/ApplicationStateTracker.mm:
1109         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
1110
1111 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
1112
1113         Clean up the layer volatility code and logging
1114         https://bugs.webkit.org/show_bug.cgi?id=187286
1115
1116         Reviewed by Tim Horton.
1117         
1118         Fix the layer volatility logging so it doesn't say "succeeded" when it actually failed
1119         and gave up.
1120         
1121         Use a couple of lambda functions in RemoteLayerBackingStore::setBufferVolatility() to
1122         make the code easier to read.
1123
1124         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
1125         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1126         (WebKit::RemoteLayerBackingStore::setBufferVolatility):
1127         * WebProcess/WebPage/WebPage.cpp:
1128         (WebKit::WebPage::callVolatilityCompletionHandlers):
1129         (WebKit::WebPage::layerVolatilityTimerFired):
1130         (WebKit::WebPage::markLayersVolatile):
1131         * WebProcess/WebPage/WebPage.h:
1132         (WebKit::WebPage::markLayersVolatile):
1133         * WebProcess/WebProcess.cpp:
1134         (WebKit::WebProcess::actualPrepareToSuspend):
1135         (WebKit::WebProcess::markAllLayersVolatile):
1136         * WebProcess/WebProcess.h:
1137
1138 2018-07-03  John Wilander  <wilander@apple.com>
1139
1140         Resource Load Statistics: Make WebsiteDataStore::getAllStorageAccessEntries() call the right network process instead of iterating over the process pools
1141         https://bugs.webkit.org/show_bug.cgi?id=187277
1142         <rdar://problem/41745510>
1143
1144         Reviewed by Chris Dumez.
1145
1146         Existing tests use this code. The change is for correctness.
1147
1148         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1149         (-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
1150             Now receives a WKWebView from its caller and gets the page ID from it.
1151         (-[WKWebsiteDataStore _getAllStorageAccessEntries:]): Deleted.
1152         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1153         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1154         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
1155             Now gets a page ID from its caller and gets the right network process
1156             through it.
1157         * UIProcess/WebsiteData/WebsiteDataStore.h:
1158
1159 2018-07-03  Jonathan Bedard  <jbedard@apple.com>
1160
1161         Unreviewed, rolling out r233461.
1162
1163         Assertions triggered during iOS 11 debug layout and API tests
1164
1165         Reverted changeset:
1166
1167         "[iOS] Add assert to catch improper use of WebCore::Timer in
1168         UI Process"
1169         https://bugs.webkit.org/show_bug.cgi?id=185330
1170         https://trac.webkit.org/changeset/233461
1171
1172 2018-07-03  Youenn Fablet  <youenn@apple.com>
1173
1174         Update com.cmbchina.CMBSecurity.sb to make it functional
1175         https://bugs.webkit.org/show_bug.cgi?id=187278
1176
1177         Reviewed by Brent Fulgham.
1178
1179         * Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb:
1180
1181 2018-07-03  Jer Noble  <jer.noble@apple.com>
1182
1183         Update Fullscreen anti-phishing alert text
1184         https://bugs.webkit.org/show_bug.cgi?id=187199
1185         <rdar://problem/41162543>
1186
1187         Reviewed by Brent Fulgham.
1188
1189         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1190         (-[WKFullScreenViewController _showPhishingAlert]):
1191
1192 2018-07-03  David Kilzer  <ddkilzer@apple.com>
1193
1194         [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
1195         <https://webkit.org/b/185330>
1196         <rdar://problem/32816079>
1197
1198         Reviewed by Darin Adler.
1199
1200         * NetworkProcess/NetworkProcess.cpp:
1201         (WebKit::NetworkProcess::NetworkProcess):
1202         * StorageProcess/StorageProcess.cpp:
1203         (WebKit::StorageProcess::StorageProcess):
1204         * WebProcess/WebProcess.cpp:
1205         (WebKit::m_nonVisibleProcessCleanupTimer):
1206         - Call setWebKitProcessType() to se the global for the current
1207           process.
1208
1209 2018-07-03  Frederic Wang  <fred.wang@free.fr>
1210
1211         [iOS] Animations with Bézier timing function not suspended on UI process when animation-play-state is set to "paused"
1212         https://bugs.webkit.org/show_bug.cgi?id=170784
1213
1214         Reviewed by Antoine Quint.
1215
1216         In order to pause a running animation, GraphicsLayerCA::pauseCAAnimationOnLayer calls
1217         PlatformCALayer::addAnimationForKey, assuming it will replace the current animation.
1218         This patch fixes PlatformCALayerRemote::addAnimationForKey to ensure this assumption holds.
1219
1220         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1221         (WebKit::PlatformCALayerRemote::addAnimationForKey): If the animation was already sent to
1222         the UI process, make sure it is properly updated.
1223
1224 2018-07-02  Youenn Fablet  <youenn@apple.com>
1225
1226         Add sandbox to microdone plugin
1227         https://bugs.webkit.org/show_bug.cgi?id=187149
1228         <rdar://problem/41538057>
1229
1230         Unreviewed.
1231
1232         * Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.sb: Renamed from Source/WebKit/Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.
1233         * WebKit.xcodeproj/project.pbxproj:
1234
1235 2018-07-02  Tim Horton  <timothy_horton@apple.com>
1236
1237         Adjust now-incorrect animated resize logging after r232544
1238         https://bugs.webkit.org/show_bug.cgi?id=187281
1239         <rdar://problem/41645347>
1240
1241         Reviewed by Simon Fraser.
1242
1243         * UIProcess/API/Cocoa/WKWebView.mm:
1244         (-[WKWebView _didCommitLayerTree:]):
1245         (-[WKWebView _didCompleteAnimatedResize]):
1246         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1247         _beginAnimatedResizeWithUpdate: and _didCompleteAnimatedResize are
1248         not strictly paired; we could instead track the SPI, but it's a bit
1249         tricky since resizeWithContentHidden has an implicit endAnimatedResize.
1250         Instead, just log if we still have a resizeAnimationView when we're
1251         committing outside of an animated resize, which seems to be the original concern,
1252         and point toward the possibility of unpaired begin/end.
1253         Also fix logging that has the wrong method name.
1254
1255 2018-07-02  Youenn Fablet  <youenn@apple.com>
1256
1257         Update com.apple.NPSafeInput.sb to make it functional
1258         https://bugs.webkit.org/show_bug.cgi?id=187276
1259
1260         Reviewed by Brent Fulgham.
1261
1262         * Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb:
1263
1264 2018-07-02  Youenn Fablet  <youenn@apple.com>
1265
1266         Update com.cfca.npSecEditCtl.MAC.BOC.plugin.sb to make it functional
1267         https://bugs.webkit.org/show_bug.cgi?id=187261
1268
1269         Reviewed by Brent Fulgham.
1270
1271         * Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb:
1272
1273 2018-07-02  Brady Eidson  <beidson@apple.com>
1274
1275         Crash notifying observers of responsiveness state change
1276         <rdar://problem/41267796> and https://bugs.webkit.org/show_bug.cgi?id=187262
1277
1278         Reviewed by Tim Horton.
1279
1280         * UIProcess/PageLoadState.cpp:
1281         (WebKit::PageLoadState::callObserverCallback): Copy the container ahead of time.
1282
1283 2018-07-02  Sihui Liu  <sihui_liu@apple.com>
1284
1285         Remove InitWebCoreThreadSystemInterface() in WKProcessPool _initWithConfiguration
1286         https://bugs.webkit.org/show_bug.cgi?id=187252
1287
1288         Reviewed by Dan Bernstein.
1289
1290         Clean up after <rdar://problem/15256572>.
1291
1292         * UIProcess/API/Cocoa/WKProcessGroup.mm:
1293         (-[WKProcessGroup initWithInjectedBundleURL:]):
1294         * UIProcess/API/Cocoa/WKProcessPool.mm:
1295         (-[WKProcessPool _initWithConfiguration:]):
1296
1297 2018-07-02  Zan Dobersek  <zdobersek@igalia.com>
1298
1299         REGRESSION(r233381): Double WebResourceLoadStatisticsStore destructor invocation
1300         https://bugs.webkit.org/show_bug.cgi?id=187247
1301
1302         Reviewed by Chris Dumez.
1303
1304         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1305         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1306         Don't call postTask() to dispatch this task, as that keeps a reference
1307         to this WebResourceLoadStatisticsStore object and thus causes problems
1308         when invoked from the destructor in the form of a second destructor
1309         invocation that ends up crashing the process. Blocking nature of this
1310         call should be enough to avoid WebResourceLoadStatisticsStore lifetime
1311         issues.
1312
1313 2018-07-02  Per Arne Vollan  <pvollan@apple.com>
1314
1315         Delete display link when closing page or the WebContent process has crashed.
1316         https://bugs.webkit.org/show_bug.cgi?id=186895
1317
1318         Reviewed by Brent Fulgham.
1319
1320         If there is a running display link in the UI process, there is no need to keep it around if the
1321         page is being closed or the WebContent process has crashed.
1322
1323         * UIProcess/WebPageProxy.cpp:
1324         (WebKit::WebPageProxy::close):
1325         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1326
1327 2018-06-23  Darin Adler  <darin@apple.com>
1328
1329         [Cocoa] Improve ARC compatibility of more code in JavaScriptCore
1330         https://bugs.webkit.org/show_bug.cgi?id=186973
1331
1332         Reviewed by Dan Bernstein.
1333
1334         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1335         (WebKit::XPCServiceInitializerDelegate::hasEntitlement): Use WTF::hasEntitlement.
1336
1337         * Shared/mac/SandboxUtilities.h: Removed connectedProcessHasEntitlement since
1338         we can now use WTF::hasEntitlement instead.
1339         * Shared/mac/SandboxUtilities.mm: Ditto.
1340
1341         * StorageProcess/ios/StorageProcessIOS.mm:
1342         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement): Use
1343         WTF::hasEntitlement.
1344         * WebProcess/WebPage/ios/WebPageIOS.mm:
1345         (WebKit::WebPage::parentProcessHasServiceWorkerEntitlement): Ditto.
1346
1347 2018-06-30  David Kilzer  <ddkilzer@apple.com>
1348
1349         Fix clang static analyzer warnings: Garbage return value
1350         <https://webkit.org/b/187224>
1351
1352         Reviewed by Eric Carlson.
1353
1354         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1355         (WebKit::WebPlatformStrategies::changeCount):
1356         (WebKit::WebPlatformStrategies::addTypes):
1357         (WebKit::WebPlatformStrategies::setTypes):
1358         (WebKit::WebPlatformStrategies::setBufferForType):
1359         (WebKit::WebPlatformStrategies::setPathnamesForType):
1360         (WebKit::WebPlatformStrategies::setStringForType):
1361         (WebKit::WebPlatformStrategies::getNumberOfFiles):
1362         (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
1363         (WebKit::WebPlatformStrategies::writeCustomData):
1364         * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
1365         (WebKit::WebEditorClient::substitutionsPanelIsShowing):
1366         - Use brace initialization for local variables.
1367
1368 2018-06-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1369
1370         Unreviewed, add missing PLATFORM(COCOA) guard after r233207
1371         https://bugs.webkit.org/show_bug.cgi?id=186788
1372         <rdar://problem/41094167>
1373
1374         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1375         (WKBundleExtendClassesForParameterCoder):
1376
1377 2018-06-30  Dan Bernstein  <mitz@apple.com>
1378
1379         Added a missing availability attribute.
1380
1381         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
1382
1383 2018-06-29  John Wilander  <wilander@apple.com>
1384
1385         Resource Load Statistics: Make network process calls only for the process pool that the page belongs to
1386         https://bugs.webkit.org/show_bug.cgi?id=187206
1387         <rdar://problem/41659160>
1388
1389         Reviewed by Chris Dumez.
1390
1391         Instead of iterating over all process pools, we should resolve which
1392         process pool the page belongs to and call the network process only for
1393         that pool. This is especially important since we use WTFMove for the
1394         completion handlers.
1395
1396         This patch also renames "callback" to "completionHandler" for
1397         the functions touched.
1398
1399         A FIXME comment is added to WebsiteDataStore::getAllStorageAccessEntries()
1400         where we currently don't have a page ID to do the lookup with.
1401
1402         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1403         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
1404         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
1405         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
1406         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
1407         (WebKit::WebsiteDataStore::hasStorageAccess):
1408         (WebKit::WebsiteDataStore::requestStorageAccess):
1409         (WebKit::WebsiteDataStore::grantStorageAccess):
1410
1411 2018-06-29  Chris Dumez  <cdumez@apple.com>
1412
1413         Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads
1414         https://bugs.webkit.org/show_bug.cgi?id=187200
1415
1416         Reviewed by Brent Fulgham.
1417
1418         Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads,
1419         in order the simplify the code a little bit.
1420
1421         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1422         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1423         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1424         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1425         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1426         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1427         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1428         (WebKit::WebResourceLoadStatisticsStore::postTask):
1429         (WebKit::WebResourceLoadStatisticsStore::postTaskReply):
1430         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1431         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1432         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
1433         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1434         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1435         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1436         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1437         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1438         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
1439         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
1440         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
1441         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1442         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
1443         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1444         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1445         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1446         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1447         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1448         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1449         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
1450         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
1451         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
1452         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1453         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1454         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1455         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1456         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1457         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1458         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
1459         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
1460         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
1461         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
1462         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
1463         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
1464         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
1465         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
1466         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1467         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1468         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
1469         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1470         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1471         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
1472         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
1473         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
1474         * UIProcess/WebResourceLoadStatisticsStore.h:
1475
1476 2018-06-29  Aditya Keerthi  <akeerthi@apple.com>
1477
1478         [macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
1479         https://bugs.webkit.org/show_bug.cgi?id=187183
1480
1481         Reviewed by Wenson Hsieh.
1482
1483         r210683 introduced logic to prevent file URLs from being copied to the clipboard
1484         in unexpected cases. The current logic always crashes the WebProcess if
1485         webProcessProxy->checkURLReceivedFromWebProcess returns false. Instead of
1486         crashing, we can fail silently and not copy anything to the clipboard.
1487
1488         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1489         (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType): Removed call to markCurrentlyDispatchedMessageAsInvalid() which was causing the process to crash.
1490
1491 2018-06-29  Chris Dumez  <cdumez@apple.com>
1492
1493         Regression(r233359): Caused ITP tests to be flaky
1494         https://bugs.webkit.org/show_bug.cgi?id=187189
1495
1496         Reviewed by Youenn Fablet.
1497
1498         r233359 started using m_resolvedConfiguration.resourceLoadStatisticsDirectory instead of
1499         m_configuration.resourceLoadStatisticsDirectory for the ITP path. This is consistent
1500         with what we do for other database paths so that things like '~' in paths get resolved.
1501
1502         This introduced flakiness because the resourceLoadStatisticsDirectory was never getting
1503         resolved and m_resolvedConfiguration.resourceLoadStatisticsDirectory was not set.
1504         Update the WebsiteDataStore so that m_resolvedConfiguration.resourceLoadStatisticsDirectory
1505         properly gets set to the resolved version of m_configuration.resourceLoadStatisticsDirectory.
1506
1507         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1508         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary):
1509         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1510
1511 2018-06-29  John Wilander  <wilander@apple.com>
1512
1513         Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral sessions
1514         https://bugs.webkit.org/show_bug.cgi?id=187154
1515         <rdar://problem/41487250>
1516
1517         Reviewed by Brent Fulgham and Chris Dumez.
1518
1519         Most of the changes in this patch remove the boolean parameter for tracking
1520         ephemeral sessions and the IsReadOnly enum.
1521
1522         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1523         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
1524             Now returns early for ephemeral sessions.
1525         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1526         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1527         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
1528         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1529         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
1530         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1531         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1532         * UIProcess/WebResourceLoadStatisticsStore.h:
1533         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1534         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1535             Now returns early for ephemeral sessions.
1536         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1537
1538 2018-06-29  Chris Dumez  <cdumez@apple.com>
1539
1540         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore
1541         https://bugs.webkit.org/show_bug.cgi?id=187165
1542
1543         Reviewed by Brent Fulgham.
1544
1545         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore. Instead,
1546         WebResourceLoadStatisticsStore now holds a weak pointer to its WebsiteDataStore and is able to call
1547         methods on it directly. Reducing the indirection makes the code less complex and more understandable.
1548
1549         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1550         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1551         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1552         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
1553         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1554         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
1555         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
1556         * UIProcess/WebResourceLoadStatisticsStore.h:
1557         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1558         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1559
1560 2018-06-29  Miguel Gomez  <magomez@igalia.com>
1561
1562         [WPE] Some frames are dropped when using rAF to animate an element
1563         https://bugs.webkit.org/show_bug.cgi?id=187175
1564
1565         Always call renderNextFrame in ThreadedCompositor::requestDisplayRefreshMonitorUpdate()
1566         so we have to process any pending layer flush request.
1567
1568         Reviewed by Žan Doberšek.
1569
1570         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1571         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
1572
1573 2018-06-28  Chris Dumez  <cdumez@apple.com>
1574
1575         Make sure the WebResourceLoadStatisticsStore gets destroyed on the main thread
1576         https://bugs.webkit.org/show_bug.cgi?id=187143
1577
1578         Reviewed by Youenn Fablet.
1579
1580         Have WebResourceLoadStatisticsStore subclass ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>
1581         instead of IPC::Connection::WorkQueueMessageReceiver. This makes sure that the WebResourceLoadStatisticsStore
1582         objects get destroyed on the main thread, even if the last ref was held by a background thread.
1583
1584         Also, methods called by IPC are now called on the main thread instead of the background queue. I think it is clearer for all
1585         of WebResourceLoadStatisticsStore usage to be on the main thread. Expensive work is still done on the background queue, inside
1586         the persistent / memory store classes.
1587
1588         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1589         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1590         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1591         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1592         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1593         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
1594         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection):
1595         * UIProcess/WebResourceLoadStatisticsStore.h:
1596
1597 2018-06-28  Jiewen Tan  <jiewen_tan@apple.com>
1598
1599         Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
1600         https://bugs.webkit.org/show_bug.cgi?id=187110
1601         <rdar://problem/41536815>
1602
1603         Reviewed by Brent Fulgham.
1604
1605         In some rare cases as shown by crash tracers that the passed xpc_connection_t object could be nullptr,
1606         and xpc_connection_set_event_handler won't do the nullptr check on its parameters. Therefore, we should
1607         do it by ourselves.
1608
1609         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1610         (WebKit::AuthenticationManager::initializeConnection):
1611         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
1612         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
1613
1614 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1615
1616         [iOS] DataTransfer.getData always returns the empty string when dropping text
1617         https://bugs.webkit.org/show_bug.cgi?id=187130
1618         <rdar://problem/41014117>
1619
1620         Reviewed by Ryosuke Niwa.
1621
1622         Add plumbing to grab information for each item in the pasteboard. See WebCore ChangeLog for more detail.
1623
1624         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1625         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
1626         * UIProcess/WebPasteboardProxy.h:
1627         * UIProcess/WebPasteboardProxy.messages.in:
1628         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1629         (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
1630         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1631
1632 2018-06-28  Youenn Fablet  <youenn@apple.com>
1633
1634         Early return when handling fetch event in case service worker origin does not match origin of a subresource load
1635         https://bugs.webkit.org/show_bug.cgi?id=187153
1636         <rdar://problem/41329832>
1637
1638         Reviewed by Chris Dumez.
1639
1640         Stop crashing the service worker process in case a subresource load origin is not matching a service worker origin.
1641         Instead, just return early so that the load will be handled by the network process.
1642
1643         Keep crashing in case a navigation load is not matching its service worker origin.
1644         Add more logging to help with the debugging.
1645
1646         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1647         (WebKit::logValidFetchError):
1648         (WebKit::isValidFetch):
1649         (WebKit::WebSWContextManagerConnection::startFetch):
1650
1651 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
1652
1653         Fullscreen exits when placeholder is removed then added during a single runloop.
1654         https://bugs.webkit.org/show_bug.cgi?id=187079
1655
1656         Reviewed by Jer Noble.
1657
1658         Instead of closing fullscreen as soon as the placeholder is removed from the view hierarchy,
1659         give the placeholder until the next runloop to be re-added to the view hierarchy.
1660
1661         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1662         (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]):
1663
1664 2018-06-28  Youenn Fablet  <youenn@apple.com>
1665
1666         Handle the case of registerMDNSNameCallback called several times
1667         https://bugs.webkit.org/show_bug.cgi?id=187150
1668         <rdar://problem/41329832>
1669
1670         Reviewed by Eric Carlson.
1671
1672         This is a speculative fix on the basis that registerMDNSNameCallback may be called several times.
1673         In that case, we would have freed the context after the first call and would reuse it for the second call.
1674
1675         Instead, keep a map of pending requests and pass to registerMDNSNameCallback an identifier to that map.
1676         If the map has no value for that identifier, return early.
1677
1678         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
1679         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
1680         (WebKit::pendingRegistrationRequests):
1681         (WebKit::registerMDNSNameCallback):
1682         (WebKit::NetworkMDNSRegister::clearPendingRequests):
1683         (WebKit::NetworkMDNSRegister::registerMDNSName):
1684         * NetworkProcess/webrtc/NetworkMDNSRegister.h:
1685         (): Deleted.
1686
1687 2018-06-28  Chris Dumez  <cdumez@apple.com>
1688
1689         Unreviewed attempt to fix Win Cairo build after r233310.
1690
1691         * UIProcess/WebResourceLoadStatisticsStore.h:
1692
1693 2018-06-28  Chris Dumez  <cdumez@apple.com>
1694
1695         Unreviewed attempt to fix Win Cairo build after r233310.
1696
1697         * UIProcess/WebResourceLoadStatisticsStore.h:
1698
1699 2018-06-28  Chris Dumez  <cdumez@apple.com>
1700
1701         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
1702         https://bugs.webkit.org/show_bug.cgi?id=187055
1703         <rdar://problem/41584026>
1704
1705         Unreviewed, temporarily disable main thread assertion added to flushAndDestroyPersistentStore()
1706         in r233310, until Bug 187143 is fixed.
1707
1708         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1709         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1710
1711 2018-06-28  Youenn Fablet  <youenn@apple.com>
1712
1713         Add sandbox to microdone plugin
1714         https://bugs.webkit.org/show_bug.cgi?id=187149
1715         rdar://problem/41538057
1716
1717         Reviewed by Brent Fulgham.
1718
1719         * Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari: Added.
1720         * WebKit.xcodeproj/project.pbxproj:
1721
1722 2018-06-28  Brian Burg  <bburg@apple.com>
1723
1724         Web Inspector: REGRESSION(r223770): "Open Link" context menu action on a linkified URL doesn't work
1725         https://bugs.webkit.org/show_bug.cgi?id=187146
1726         <rdar://problem/41369591>
1727
1728         Reviewed by Joseph Pecoraro.
1729
1730         When Web Inspector's page receives a navigation request, it's supposed to redirect any
1731         non-Inspector navigations to be loaded in the inspected page. When I refactored to use
1732         modern a policy delegate, the one line that redirects the loads was left out.
1733
1734         No new tests, because inspector tests can't navigate the inspector or inspected pages.
1735
1736         * UIProcess/mac/WKInspectorViewController.mm:
1737         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
1738
1739 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
1740
1741         Crash when _topConstraint is null in element fullscreen.
1742         https://bugs.webkit.org/show_bug.cgi?id=187075
1743
1744         Reviewed by Eric Carlson.
1745
1746         NSArray can't contain a null pointer, so check for null before creating an array from a pointer.
1747         Use the recommended +deactivateConstraints: instead of -removeConstraints:.
1748
1749         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1750         (-[WKFullScreenViewController showUI]):
1751         (-[WKFullScreenViewController hideUI]):
1752
1753 2018-06-28  Chris Dumez  <cdumez@apple.com>
1754
1755         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
1756         https://bugs.webkit.org/show_bug.cgi?id=187055
1757         <rdar://problem/41584026>
1758
1759         Reviewed by Brent Fulgham.
1760
1761         Split memory store logic out of WebResourceLoadStatisticsStore and into a ResourceLoadStatisticsMemoryStore class
1762         to clarify the threading model. Previously, some of the methods of the WebResourceLoadStatisticsStore had to be
1763         called on the main thread and some of them on the background queue, which was confusing and error prone. Now,
1764         all WebResourceLoadStatisticsStore methods (except for IPC ones which will be addressed in a follow-up) are called
1765         on the main thread. The ResourceLoadStatisticsMemoryStore objects is constructed / used and destroyed on the
1766         background queue, similarly to the ResourceLoadStatisticsPersistentStore. The WebResourceLoadStatisticsStore
1767         objects merely proxies calls from WebKit to those persistent / memory stores and takes care of hopping back and
1768         forth between the background thread and the work queue.
1769
1770         While spliting code code, I found several instances where we were calling completion handlers on the wrong thread.
1771         I fixed those in this patch now that the model is clearer.
1772
1773         We can likely clean up (organize the code a bit better) in a follow-up). This patch takes care of splitting the
1774         code as it was. Code that was called on the background queue was moved to ResourceLoadStatisticsMemoryStore class
1775         and code that was called on the main thread stays in WebResourceLoadStatisticsStore.
1776
1777         * CMakeLists.txt:
1778         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm.
1779         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
1780         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: Added.
1781         (WebKit::appendWithDelimiter):
1782         (WebKit::OperatingDate::fromWallTime):
1783         (WebKit::OperatingDate::today):
1784         (WebKit::OperatingDate::secondsSinceEpoch const):
1785         (WebKit::OperatingDate::operator== const):
1786         (WebKit::OperatingDate::operator< const):
1787         (WebKit::OperatingDate::operator<= const):
1788         (WebKit::OperatingDate::OperatingDate):
1789         (WebKit::mergeOperatingDates):
1790         (WebKit::pruneResources):
1791         (WebKit::computeImportance):
1792         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
1793         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore):
1794         (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage):
1795         (WebKit::ResourceLoadStatisticsMemoryStore::calculateAndSubmitTelemetry):
1796         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned):
1797         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1798         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry):
1799         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1800         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain):
1801         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
1802         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
1803         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
1804         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1805         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1806         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
1807         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
1808         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
1809         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
1810         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
1811         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest):
1812         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
1813         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
1814         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction):
1815         (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
1816         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
1817         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
1818         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
1819         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
1820         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder):
1821         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo):
1822         (WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
1823         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
1824         (WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
1825         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
1826         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
1827         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
1828         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
1829         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
1830         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
1831         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction):
1832         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree):
1833         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval):
1834         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime):
1835         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
1836         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved):
1837         (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain):
1838         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
1839         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
1840         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
1841         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction):
1842         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
1843         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies):
1844         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies):
1845         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
1846         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
1847         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains):
1848         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains):
1849         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState):
1850         (WebKit::ResourceLoadStatisticsMemoryStore::processStatistics const):
1851         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
1852         (WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
1853         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary):
1854         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const):
1855         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries):
1856         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo):
1857         (WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
1858         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues):
1859         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent):
1860         (WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
1861         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
1862         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
1863         * UIProcess/ResourceLoadStatisticsMemoryStore.h: Added.
1864         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
1865         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled):
1866         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled):
1867         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1868         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1869         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
1870         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
1871         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1872         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
1873         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1874         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1875         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1876         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
1877         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1878         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1879         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1880         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
1881         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
1882         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1883         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1884         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1885         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
1886         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
1887         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1888         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
1889         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
1890         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
1891         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1892         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
1893         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1894         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1895         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1896         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1897         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1898         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
1899         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
1900         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
1901         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
1902         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1903         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
1904         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
1905         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
1906         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
1907         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
1908         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
1909         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
1910         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
1911         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
1912         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
1913         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
1914         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
1915         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
1916         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1917         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
1918         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
1919         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
1920         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
1921         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
1922         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
1923         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
1924         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
1925         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
1926         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
1927         * UIProcess/WebResourceLoadStatisticsStore.h:
1928         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1929         (WebKit::sortedPrevalentResourceTelemetry):
1930         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1931         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
1932         * WebKit.xcodeproj/project.pbxproj:
1933
1934 2018-06-28  Michael Catanzaro  <mcatanzaro@igalia.com>
1935
1936         [GTK] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) when dragging file into webview
1937         https://bugs.webkit.org/show_bug.cgi?id=175602
1938
1939         Reviewed by Carlos Garcia Campos.
1940
1941         We check using the GdkDragContext to ensure the DroppingContext is still alive (present in
1942         m_droppingContexts), but access it via the pointer to the DroppingContext that could be
1943         dangling. This happens on every drag. I can't actually reproduce the original assertion
1944         since I'm currently working with an asan build, but I imagine it's probably the same issue
1945         that I'm fixing here.
1946
1947         * UIProcess/gtk/DragAndDropHandler.cpp:
1948         (WebKit::DragAndDropHandler::dragLeave):
1949
1950 2018-06-27  Timothy Hatcher  <timothy@apple.com>
1951
1952         Don't expose new semantic -apple-system color keywords on iOS.
1953         https://bugs.webkit.org/show_bug.cgi?id=187080
1954         rdar://problem/41505699
1955
1956         Reviewed by Tim Horton.
1957
1958         * DerivedSources.make: Use gnu++14, since gnu++17 is giving errors on macOS 10.12.
1959
1960 2018-06-27  Megan Gardner  <megan_gardner@apple.com>
1961
1962         Fix IBeam issues with iPad apps on Mac
1963         https://bugs.webkit.org/show_bug.cgi?id=186900
1964
1965         Reviewed by Wenson Hsieh.
1966
1967         * Shared/ios/InteractionInformationAtPosition.h:
1968         * Shared/ios/InteractionInformationAtPosition.mm:
1969         (WebKit::InteractionInformationAtPosition::encode const):
1970         (WebKit::InteractionInformationAtPosition::decode):
1971
1972         Add functionality to determine what a caret rect should be, but as it is
1973         expensive, it should only be done for this platform.
1974         
1975         * Shared/ios/InteractionInformationRequest.cpp:
1976         (WebKit::InteractionInformationRequest::isApproximateForRequest):
1977         * Shared/ios/InteractionInformationRequest.h:
1978
1979         As there is no way to premptively request information on hover, we need to use 
1980         the last cached information, but only if it is close to the point we are about
1981         to request information for. So having a way to determine if a point is very close
1982         to a previous point is a good idea.
1983
1984         * UIProcess/ios/WKContentViewInteraction.mm:
1985         (-[WKContentView _currentPositionInformationIsApproximateForRequest:]):
1986         (-[WKContentView closestPositionToPoint:]):
1987
1988         UIKit is using this function to determine if we should show an Ibeam or not.
1989         So we need to implement it, at least for this platform. 
1990
1991         * WebProcess/WebPage/ios/WebPageIOS.mm:
1992         (WebKit::WebPage::getPositionInformation):
1993
1994         Pass up the calculated caret rect, but only for iPad apps on Mac.
1995
1996 2018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1997
1998         [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
1999         https://bugs.webkit.org/show_bug.cgi?id=187089
2000
2001         Reviewed by Michael Catanzaro.
2002
2003         Use LazyNeverDestroyed<XErrorTrapper> instead of global std::unique_ptr<XErrorTrapper>.
2004         Since this variable's exit time destructor is not important in this code, using
2005         LazyNeverDestroyed<XErrorTrapper> is fine. This removes the last static initializer
2006         of libwebkit2gtk.so.
2007
2008         * PluginProcess/unix/PluginProcessMainUnix.cpp:
2009
2010 2018-06-27  Youenn Fablet  <youenn@apple.com>
2011
2012         Add a sandbox profile for some additional bank plugins
2013         https://bugs.webkit.org/show_bug.cgi?id=187105
2014
2015         Reviewed by Brent Fulgham.
2016
2017         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Added.
2018         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Added.
2019         * Resources/PlugInSandboxProfiles/com.apple.BocomSubmitCtrl.sb: Added.
2020         * Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb: Added.
2021         * Resources/PlugInSandboxProfiles/com.apple.NPSafeSubmit.sb: Added.
2022         * Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb: Added.
2023         * Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb: Added.
2024         * Resources/PlugInSandboxProfiles/com.ftsafe.NPAPI-Core-Safe-SoftKeybaord.plugin.rfc1034identifier.sb: Added.
2025         * WebKit.xcodeproj/project.pbxproj:
2026
2027 2018-06-27  Youenn Fablet  <youenn@apple.com>
2028
2029         NetworkLoadChecker should not need to hard ref NetworkConnectionToWebProcess
2030         https://bugs.webkit.org/show_bug.cgi?id=186551
2031
2032         Reviewed by Daniel Bates.
2033
2034         Removed the need for NetworkLoadChecker to reference a NetworkConnectionToWebProcess.
2035         Instead a CSP client is given to NetworkLoadChecker when needed.
2036
2037         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2038         (WebKit::NetworkConnectionToWebProcess::loadPing):
2039         * NetworkProcess/NetworkLoadChecker.cpp:
2040         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2041         (WebKit::NetworkLoadChecker::check):
2042         (WebKit::NetworkLoadChecker::checkRedirection):
2043         (WebKit::NetworkLoadChecker::checkRequest):
2044         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
2045         (WebKit::NetworkLoadChecker::addConsoleMessage): Deleted.
2046         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Deleted.
2047         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Deleted.
2048         * NetworkProcess/NetworkLoadChecker.h:
2049         * NetworkProcess/NetworkResourceLoader.cpp:
2050         (WebKit::NetworkResourceLoader::start):
2051         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2052         * NetworkProcess/PingLoad.cpp:
2053         (WebKit::PingLoad::PingLoad):
2054         (WebKit::PingLoad::willPerformHTTPRedirection):
2055         * NetworkProcess/PingLoad.h:
2056
2057 2018-06-27  Stephan Szabo  <stephan.szabo@sony.com>
2058
2059         [Wincairo] Add support for context menus to non-legacy minibrowser
2060         https://bugs.webkit.org/show_bug.cgi?id=186815.
2061
2062         Reviewed by Ryosuke Niwa.
2063
2064         * UIProcess/WebPageProxy.h:
2065         * UIProcess/win/PageClientImpl.cpp:
2066         (WebKit::PageClientImpl::viewWidget):
2067         * UIProcess/win/PageClientImpl.h:
2068         * UIProcess/win/WebContextMenuProxyWin.cpp:
2069         (WebKit::WebContextMenuProxyWin::show):
2070         (WebKit::createMenu):
2071         (WebKit::createMenuItem):
2072         (WebKit::populate):
2073         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
2074         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
2075         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
2076         * UIProcess/win/WebContextMenuProxyWin.h:
2077         * UIProcess/win/WebPageProxyWin.cpp:
2078         (WebKit::WebPageProxy::viewWidget):
2079         * UIProcess/win/WebView.cpp:
2080         (WebKit::WebView::wndProc):
2081         (WebKit::WebView::onMenuCommand):
2082         * UIProcess/win/WebView.h:
2083
2084 2018-06-27  Youenn Fablet  <youenn@apple.com>
2085
2086         Disable content blockers in NetworkLoadChecker except for ping loads
2087         https://bugs.webkit.org/show_bug.cgi?id=187083
2088         <rdar://problem/41440083>
2089
2090         Reviewed by Chris Dumez.
2091
2092         * NetworkProcess/NetworkLoadChecker.cpp:
2093         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2094         * NetworkProcess/NetworkLoadChecker.h:
2095         (WebKit::NetworkLoadChecker::enableContentExtensionsCheck):
2096         * NetworkProcess/PingLoad.cpp:
2097
2098 2018-06-27  Simon Fraser  <simon.fraser@apple.com>
2099
2100         https://hackernoon.com/ uses lots of layer backing store
2101         https://bugs.webkit.org/show_bug.cgi?id=186909
2102         rdar://problem/40257540
2103
2104         Reviewed by Tim Horton.
2105         
2106         PlatformCALayerRemote was actually holding onto backing stores for layers with
2107         backing store detached, which could increase memory use. When told that backing stores
2108         are not attached, explicitly throw away the backing, and re-create it (via setNeedsDisplay)
2109         when attached. This is now similar to what PlatformLayerCACocoa does.
2110
2111         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2112         (WebKit::PlatformCALayerRemote::setNeedsDisplayInRect):
2113         (WebKit::PlatformCALayerRemote::setNeedsDisplay):
2114         (WebKit::PlatformCALayerRemote::hasContents const):
2115         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2116
2117 2018-06-27  Jonathan Bedard  <jbedard@apple.com>
2118
2119         Enable WebKit iOS 12 build
2120         https://bugs.webkit.org/show_bug.cgi?id=187024
2121         <rdar://problem/39759057>
2122
2123         Reviewed by David Kilzer.
2124
2125         * Platform/spi/ios/PDFKitSPI.h: Added PDFKit SPI.
2126         * Platform/spi/ios/UIKitSPI.h: Add new UIKit SPI and UICompositingMode enumeration.
2127         * UIProcess/ios/WKPDFView.mm: Use PDFKitSPI header.
2128         * UIProcess/ios/WKSystemPreviewView.mm: Use CoreGraphicsSPI.h.
2129         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Use QuartzCoreSPI.h.
2130
2131 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
2132
2133         CSS Animation Triggers is not an experimental feature, should be globally off by default
2134
2135         Reviewed by Dean Jackson.
2136
2137         * Shared/WebPreferences.yaml:
2138
2139 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
2140
2141         Promote the Secure Context API feature from experimental-yet-on-by-default to always-on
2142
2143         Reviewed by Dan Bates.
2144
2145         * Shared/WebPreferences.yaml:
2146         Secure Context API is on by default, it's not experimental anymore.
2147
2148 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
2149
2150         Make Link Preload an on-by-default feature
2151         https://bugs.webkit.org/show_bug.cgi?id=187104
2152
2153         Reviewed by Ryosuke Niwa.
2154
2155         * Shared/WebPreferences.yaml:
2156         This should be on, not experimental. It already shipped on in the past.
2157
2158 2018-06-27  Chris Dumez  <cdumez@apple.com>
2159
2160         Regression(r233208): Completion handler does not get called on GTK port
2161         https://bugs.webkit.org/show_bug.cgi?id=187099
2162
2163         Reviewed by Antti Koivisto.
2164
2165         Make sure UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler's completion handler
2166         gets called on non-COCOA ports.
2167
2168         * UIProcess/WebResourceLoadStatisticsStore.h:
2169
2170 2018-06-27  Tim Horton  <timothy_horton@apple.com>
2171
2172         When trying to print a very long email on iOS, the print preview is blank
2173         https://bugs.webkit.org/show_bug.cgi?id=187077
2174         <rdar://problem/41107013>
2175
2176         Reviewed by Timothy Hatcher.
2177
2178         * UIProcess/ios/WebPageProxyIOS.mm:
2179         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
2180         ChildProcessProxy::sendSync has a (surprising) default timeout of 1 second,
2181         (as opposed to Connection::sendSync's default timeout of ∞ seconds).
2182         The printing path already waits ∞ seconds for the final PDF, but currently
2183         uses the default 1 second timeout for page count computation. If page
2184         count computation takes more than 1 second, the preview will be blank.
2185         Since the print preview is generated asynchronously, we really want
2186         to wait until it's done, and not give up after 1 second.
2187
2188 2018-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2189
2190         [iPad apps on macOS] Unable to interact with video elements that have started playing
2191         https://bugs.webkit.org/show_bug.cgi?id=187073
2192         <rdar://problem/40591107>
2193
2194         Reviewed by Tim Horton.
2195
2196         On iOS, we currently force remote hosting contexts to be non-interactive by passing in `kCAContextIgnoresHitTest`
2197         when creating the CAContext. However, this flag is not respected by CoreAnimation when running iOS apps on macOS.
2198         This means all HID events dispatched over a video that has been played (which causes WebKit to insert a
2199         CALayerHost-backed WKRemoteView in the view hierarchy) will be routed to the context ID of the video's CAContext
2200         rather than the context ID of the key window containing the WKWebView.
2201
2202         This subsequently causes all gesture recognizers (hover, touch, tap, long press) to fail recognition when
2203         running iOS apps on macOS. To address this, we set a flag on WKRemoteView's CALayerHost to prevent hit-testing
2204         to the remote layer. This allows us to avoid routing HID events to the wrong context, and instead target the
2205         main UIWindow.
2206
2207         Manually verified that click, touch, and mouseenter/mouseleave events are dispatched when interacting over a
2208         video element.
2209
2210         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2211         (-[WKRemoteView initWithFrame:contextID:]):
2212
2213 2018-06-26  Commit Queue  <commit-queue@webkit.org>
2214
2215         Unreviewed, rolling out r233232.
2216         https://bugs.webkit.org/show_bug.cgi?id=187081
2217
2218         "This is breaking launching some plugins" (Requested by youenn
2219         on #webkit).
2220
2221         Reverted changeset:
2222
2223         "Remove quarantine for Webex plugin"
2224         https://bugs.webkit.org/show_bug.cgi?id=187050
2225         https://trac.webkit.org/changeset/233232
2226
2227 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
2228
2229         Rearrange some WebPreferences; move two experimental prefs into the experimental section
2230
2231         * Shared/WebPreferences.yaml:
2232
2233 2018-06-26  Chris Dumez  <cdumez@apple.com>
2234
2235         Deal better with the network process crashing on startup
2236         https://bugs.webkit.org/show_bug.cgi?id=187065
2237         <rdar://problem/41451622>
2238
2239         Reviewed by Geoffrey Garen.
2240
2241         When a network process crashes on startup, we would not attempt to relaunch it. If there were web
2242         processes waiting for a connection to this network process, we would send them an invalid connection
2243         identifier which would cause them to forcefully crash.
2244
2245         Instead, we now apply the same policy whether a network process crashes on startup or later:
2246         - We attempt to relaunch the network process
2247         - If there were pending connections from WebContent processes, we ask the new Network process instead.
2248
2249         As a result, WebContent processes no longer crash in this case. Instead, they wait for a valid
2250         connection to the network process.
2251
2252         * UIProcess/API/Cocoa/WKProcessPool.mm:
2253         (-[WKProcessPool _makeNextNetworkProcessLaunchFailForTesting]):
2254         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2255         * UIProcess/Network/NetworkProcessProxy.cpp:
2256         (WebKit::NetworkProcessProxy::getLaunchOptions):
2257         (WebKit::NetworkProcessProxy::didFinishLaunching):
2258         * UIProcess/Network/NetworkProcessProxy.h:
2259         * UIProcess/WebProcessPool.cpp:
2260         (WebKit::WebProcessPool::networkProcessCrashed):
2261         * UIProcess/WebProcessPool.h:
2262
2263 2018-06-26  Daniel Bates  <dabates@apple.com>
2264
2265         REGRESSION (r231479): Unable to buy Odeon cinema tickets in STP (bogus 'X-Frame-Options' to 'SAMEORIGIN')
2266         https://bugs.webkit.org/show_bug.cgi?id=186090
2267         <rdar://problem/40692595>
2268
2269         Reviewed by Andy Estes.
2270
2271         Fixes an issue where a page P delivered with "X-Frame-Options: SAMEORIGIN" loaded in a sub-
2272         frame would be blocked if we were redirected to it in response to the cross-origin POST
2273         request regardless of whether P is same-origin with its parent document.
2274
2275         * NetworkProcess/NetworkResourceLoader.cpp:
2276         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Compare the origin
2277         of the top frame's document as opposed to the source origin. The latter represents the
2278         origin of the document that initiated the navigation, which can be cross-origin, and
2279         should not be considered when applying "X-Frame-Options: SAMEORIGIN". This check exists
2280         as a performance optimization to avoid traversing over all frame ancestors only to find
2281         out that the innermost frame (the one that made this request) is cross-origin with the
2282         top-most frame.
2283         * NetworkProcess/NetworkResourceLoader.h:
2284         * WebProcess/Network/WebLoaderStrategy.cpp:
2285         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Exclude the origin of the
2286         frame that is making the load request from the list of ancestor origins. This makes the
2287         X-Frame-Options algorithm in WebKit2 match the logic we do in FrameLoader::shouldInterruptLoadForXFrameOptions().
2288
2289 2018-06-26  Youenn Fablet  <youenn@apple.com>
2290
2291         Remove quarantine for Webex plugin
2292         https://bugs.webkit.org/show_bug.cgi?id=187050
2293         rdar://problem/41478189
2294
2295         Reviewed by Brent Fulgham.
2296
2297         Update the Plugin Info.plist to not do quarantine of downloaded files by default.
2298         Update PluginProcess implementation to reenable quarantine for all plug-ins except cisco webex plug-in.
2299
2300         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
2301         * PluginProcess/PluginProcess.h:
2302         * PluginProcess/mac/PluginProcessMac.mm:
2303         (WebKit::PluginProcess::shouldOverrideQuarantine):
2304         * Shared/ChildProcess.h:
2305         (WebKit::ChildProcess::shouldOverrideQuarantine):
2306         * Shared/mac/ChildProcessMac.mm:
2307         (WebKit::ChildProcess::initializeSandbox):
2308
2309 2018-06-26  Jeremy Jones  <jeremyj@apple.com>
2310
2311         Ensure element fullscreen animation is always visible.
2312         https://bugs.webkit.org/show_bug.cgi?id=187068
2313         rdar://problem/36187369
2314
2315         Reviewed by Eric Carlson.
2316
2317         The fullscreen animation is important for communicating to users that they are no longer in inline mode.
2318         If fullscreen animation's inline rect is not visible, animate from a point in the middle of the screen.
2319
2320         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2321         (WebKit::safeInlineRect):
2322         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2323         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2324
2325 2018-06-26  Youenn Fablet  <youenn@apple.com>
2326
2327         Add a sandbox profile for com.google.o1dbrowserplugin plugin
2328         https://bugs.webkit.org/show_bug.cgi?id=187067
2329
2330         Reviewed by Brent Fulgham.
2331
2332         * Resources/PlugInSandboxProfiles/com.google.o1dbrowserplugin.sb: Added.
2333         * WebKit.xcodeproj/project.pbxproj:
2334
2335 2018-06-26  Tim Horton  <timothy_horton@apple.com>
2336
2337         Promote two more experimental features to traditional features
2338         https://bugs.webkit.org/show_bug.cgi?id=187063
2339
2340         Reviewed by Dean Jackson.
2341
2342         * Shared/WebPreferences.yaml:
2343         Promote some shipped/default-on features to non-experimental.
2344
2345 2018-06-26  Jiewen Tan  <jiewen_tan@apple.com>
2346
2347         Rollout macOS sandbox change in r232276
2348         https://bugs.webkit.org/show_bug.cgi?id=186904
2349         <rdar://problem/41350969>
2350
2351         Reviewed by Brent Fulgham.
2352
2353         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
2354
2355 2018-06-26  Aditya Keerthi  <akeerthi@apple.com>
2356
2357         Tap highlight displayed when tapping a field that is already focussed
2358         https://bugs.webkit.org/show_bug.cgi?id=187004
2359         <rdar://problem/41428008>
2360         Reviewed by Tim Horton.
2361
2362         In the case where fast-clicking is enabled, _singleTapCommited: could be invoked
2363         before the tap highlight request, causing _potentialTapInProgress to be set to NO.
2364         This results in the early return for preventing multiple tap highlights on an
2365         assisted node to be skipped. Since a tap highlight should never be shown for an
2366         input field that is already focussed, _potentialTapInProgress can be removed from
2367         the early return condition.
2368
2369         * UIProcess/ios/WKContentViewInteraction.mm:
2370         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
2371
2372 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
2373
2374         Rearrange some WebPreferences; move two non-experimental prefs out of the experimental section
2375
2376         * Shared/WebPreferences.yaml:
2377
2378 2018-06-26  Tim Horton  <timothy_horton@apple.com>
2379
2380         Promote some experimental features to traditional features
2381         https://bugs.webkit.org/show_bug.cgi?id=187047
2382
2383         Reviewed by Simon Fraser.
2384
2385         * Shared/WebPreferences.yaml:
2386         Reindent.
2387         Promote some shipped/default-on features to non-experimental.
2388
2389 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
2390
2391         [Mac] AirPlay picker uses incorrect theme in Dark mode
2392         https://bugs.webkit.org/show_bug.cgi?id=187054
2393         <rdar://problem/41291093>
2394
2395         Reviewed by Timothy Hatcher.
2396
2397         * UIProcess/WebPageProxy.cpp:
2398         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass m_defaultAppearance.
2399
2400 2018-06-26  Chris Dumez  <cdumez@apple.com>
2401
2402         Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback
2403         https://bugs.webkit.org/show_bug.cgi?id=186903
2404         <rdar://problem/41350182>
2405
2406         Reviewed by Brady Eidson.
2407
2408         Follow-up fix after r233180 to address an API test crash. We need to keep the
2409         NetworkProcessProxy alive during the async updatePrevalentDomainsToPartitionOrBlockCookies
2410         request to make sure it completes.
2411
2412         * UIProcess/Network/NetworkProcessProxy.cpp:
2413         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies):
2414
2415 2018-06-26  Brent Fulgham  <bfulgham@apple.com>
2416
2417         Provide a way for Injected Bundles to indicate classes approved for NSSecureCoding
2418         https://bugs.webkit.org/show_bug.cgi?id=186788
2419         <rdar://problem/41094167>
2420
2421         Reviewed by Chris Dumez.
2422
2423         InjectedBundles support a mechanism to serialize data between the UIProcess and the
2424         WebContent process hosting the bundle. In some cases, we want to be able to serialize
2425         a custom data object that is not part of WebKit's native data types.
2426
2427         After switching to strict NSSecureCoding, WebKit clients attempting to serialize these
2428         custom objects trigger a failure.
2429
2430         This patch makes it possible for the InjectedBundle author to specify one (or more) data
2431         classes that are allowed to be serialized between the two processes.
2432         
2433         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2434         (WKBundleExtendClassesForParameterCoder): Added.
2435         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
2436         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2437         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
2438         (createWKArray): Added.
2439         (-[WKWebProcessPlugInController extendClassesForParameterCoder:]): Added.
2440         * WebProcess/InjectedBundle/InjectedBundle.h:
2441         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2442         (WebKit::InjectedBundle::extendClassesForParameterCoder): Added.
2443         (WebKit::InjectedBundle::classesForCoder): New helper function.
2444         (WebKit::InjectedBundle::setBundleParameter): Modified to use the new set of valid
2445         classes for NSSecureCoding.
2446
2447 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
2448
2449         Enable mock capture devices on the iOS simulator
2450         https://bugs.webkit.org/show_bug.cgi?id=186846
2451         <rdar://problem/41289134>
2452
2453         Reviewed by Youenn Fablet.
2454
2455         * Shared/WebPreferences.yaml: Use DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED.
2456         * Shared/WebPreferencesDefaultValues.h: Define DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED, set to
2457         true in the iOS simulator only.
2458
2459 2018-06-26  Fujii Hironori  <Hironori.Fujii@sony.com>
2460
2461         [Win] 'deref': is not a member of 'WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains::<lambda_9d761a6dc12d95db7fa2d6f3f5aa26fa>'
2462         https://bugs.webkit.org/show_bug.cgi?id=187035
2463
2464         Unreviewed build fix.
2465
2466         MSVC can't compile the code using `this` in a generalized lambda
2467         capture in another lambda.
2468
2469         In this case, there is no need to copy `protectedThis` for the
2470         inner lambda. Move `protectedThis` of the outer lambda to the
2471         inner as well as `completionHandler`.
2472
2473         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2474         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2475         Moved `protectedThis` from the outer lambda to the inner.
2476         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2477         Ditto.
2478
2479 2018-06-26  Miguel Gomez  <magomez@igalia.com>
2480
2481         [GTK] Many webpages can crash the browser in WebCore::CoordinatedGraphicsLayer::transformedVisibleRect
2482         https://bugs.webkit.org/show_bug.cgi?id=179304
2483
2484         Reviewed by Michael Catanzaro.
2485
2486         Add a way to attach to the CompositingCoordinator layers that were not created by it.
2487
2488         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2489         (WebKit::CompositingCoordinator::attachLayer):
2490         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2491
2492 2018-06-25  Tim Horton  <timothy_horton@apple.com>
2493
2494         WKThumbnailView fallback background is blindingly bright in Dark Mode
2495         https://bugs.webkit.org/show_bug.cgi?id=187017
2496         <rdar://problem/41036209>
2497
2498         Reviewed by Simon Fraser.
2499
2500         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
2501         (-[_WKThumbnailView initWithFrame:]):
2502         (-[_WKThumbnailView wantsUpdateLayer]):
2503         (-[_WKThumbnailView updateLayer]):
2504         Use a semantic color for the WKThumbnailView background color
2505         instead of flat white.
2506
2507 2018-06-25  John Wilander  <wilander@apple.com>
2508
2509         Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback
2510         https://bugs.webkit.org/show_bug.cgi?id=186903
2511         <rdar://problem/41350182>
2512
2513         Reviewed by Chris Dumez.
2514
2515         This patch stores the callback sent to
2516         WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(),
2517         sets up a context ID, and sends that ID to the network process when
2518         asking it to update cookie partitioning and blocking. The network
2519         process then tells the UI process when it's done, at which point the
2520         callback is called.
2521
2522         This change is meant to address layout test flakiness.
2523
2524         * NetworkProcess/NetworkProcess.cpp:
2525         (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies):
2526         * NetworkProcess/NetworkProcess.h:
2527         * NetworkProcess/NetworkProcess.messages.in:
2528         * UIProcess/Network/NetworkProcessProxy.cpp:
2529         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies):
2530         (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies):
2531         * UIProcess/Network/NetworkProcessProxy.h:
2532         * UIProcess/Network/NetworkProcessProxy.messages.in:
2533         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2534         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2535         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
2536         * UIProcess/WebResourceLoadStatisticsStore.h:
2537         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2538         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
2539         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2540         * UIProcess/WebsiteData/WebsiteDataStore.h:
2541
2542 2018-06-25  Brent Fulgham  <bfulgham@apple.com>
2543
2544         Allow access to APTDevice in iOS WebContent process
2545         https://bugs.webkit.org/show_bug.cgi?id=187021
2546         <rdar://problem/41339769>
2547
2548         Reviewed by Youenn Fablet.
2549
2550         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2551
2552 2018-06-25  Keith Rollin  <krollin@apple.com>
2553         Unreviewed, rolling out r233087.
2554
2555         Causes 5% Mac PLT regression.
2556
2557         Reverted changeset:
2558
2559         "Recalc styles every time defaultAppearance changes."
2560         https://bugs.webkit.org/show_bug.cgi?id=186866
2561         https://trac.webkit.org/changeset/233087
2562
2563 2018-06-25  Youenn Fablet  <youenn@apple.com>
2564
2565         Add a sandbox profile to Hangout plug-in
2566         https://bugs.webkit.org/show_bug.cgi?id=187005
2567         <rdar://problem/41428391>
2568
2569         Reviewed by Brent Fulgham.
2570
2571         Add a sandbox profile so that this plug-in can be run when UIProcess is sandboxed.
2572
2573         * Resources/PlugInSandboxProfiles/com.google.googletalkbrowserplugin.sb: Added.
2574         * WebKit.xcodeproj/project.pbxproj:
2575
2576 2018-06-25  Youenn Fablet  <youenn@apple.com>
2577
2578         NetworkLoadChecker should not check CORS for 304 responses triggered by WebProcess revalidation
2579         https://bugs.webkit.org/show_bug.cgi?id=186939
2580         <rdar://problem/40941725>
2581
2582         Reviewed by Chris Dumez.
2583
2584         * NetworkProcess/NetworkLoadChecker.cpp:
2585         (WebKit::NetworkLoadChecker::validateResponse):
2586
2587 2018-06-25  Keith Rollin  <krollin@apple.com>
2588
2589         Adjust UNEXPORTED_SYMBOL_LDFLAGS for LTO
2590         https://bugs.webkit.org/show_bug.cgi?id=186949
2591         <rdar://problem/41386438>
2592
2593         Reviewed by David Kilzer.
2594
2595         When building with LTO, WebKit's
2596         'check-for-weak-vtables-and-externals' script reports weak external
2597         symbols:
2598
2599         ERROR: WebKit has a weak external symbol in it (.../OpenSource/WebKitBuild/Release/WebKit.framework/Versions/A/WebKit)
2600         ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
2601         ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
2602         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE
2603         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE
2604         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE
2605         ERROR: symbol __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
2606         ERROR: symbol __ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE
2607         ERROR: symbol __ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
2608         Command /bin/sh failed with exit code 1
2609
2610         Address these by adding those symbols to UNEXPORTED_SYMBOL_LDFLAGS in
2611         WebKit.xcconfig.
2612
2613         * Configurations/WebKit.xcconfig:
2614
2615 2018-06-25  Chris Dumez  <cdumez@apple.com>
2616
2617         Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called
2618         https://bugs.webkit.org/show_bug.cgi?id=187007
2619         <rdar://problem/41293989>
2620
2621         Reviewed by Brady Eidson.
2622
2623         Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called by
2624         switching its type to WTF::CompletionHandler instead of WTF::Function. This also has the benefit
2625         of destroying our captured objects when the completion handler gets called by the client on the
2626         main thread instead of whatever thread the ObjC block gets released on.
2627
2628         * UIProcess/API/APIIconLoadingClient.h:
2629         (API::IconLoadingClient::getLoadDecisionForIcon):
2630         * UIProcess/API/glib/WebKitIconLoadingClient.cpp:
2631         * UIProcess/API/mac/WKView.mm:
2632         (-[WKView maybeInstallIconLoadingClient]):
2633         * UIProcess/Cocoa/IconLoadingDelegate.h:
2634         * UIProcess/Cocoa/IconLoadingDelegate.mm:
2635         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
2636
2637 2018-06-25  Youenn Fablet  <youenn@apple.com>
2638
2639         Add API to control mock media devices
2640         https://bugs.webkit.org/show_bug.cgi?id=186958
2641
2642         Reviewed by Eric Carlson.
2643
2644         Add API to clear, set, remove and reset mock media devices.
2645         The mock media center of UIProcess and all WebProcesses are updated.
2646
2647         * CMakeLists.txt:
2648         * UIProcess/API/C/WKMockMediaDevice.cpp: Added.
2649         (typeFromString):
2650         (WKAddMockMediaDevice):
2651         (WKClearMockMediaDevices):
2652         (WKRemoveMockMediaDevice):
2653         (WKResetMockMediaDevices):
2654         * UIProcess/API/C/WKMockMediaDevice.h: Added.
2655         * UIProcess/WebProcessPool.cpp:
2656         (WebKit::WebProcessPool::addMockMediaDevice):
2657         (WebKit::WebProcessPool::clearMockMediaDevices):
2658         (WebKit::WebProcessPool::removeMockMediaDevice):
2659         (WebKit::WebProcessPool::resetMockMediaDevices):
2660         * UIProcess/WebProcessPool.h:
2661         * WebKit.xcodeproj/project.pbxproj:
2662         * WebProcess/WebProcess.cpp:
2663         (WebKit::WebProcess::addMockMediaDevice):
2664         (WebKit::WebProcess::clearMockMediaDevices):
2665         (WebKit::WebProcess::removeMockMediaDevice):
2666         (WebKit::WebProcess::resetMockMediaDevices):
2667         * WebProcess/WebProcess.h:
2668         * WebProcess/WebProcess.messages.in:
2669
2670 2018-06-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2671
2672         [iPad apps on macOS] Click events are broken in WKWebView
2673         https://bugs.webkit.org/show_bug.cgi?id=186964
2674         <rdar://problem/41369145>
2675
2676         Reviewed by Tim Horton.
2677
2678         Tapping in WKWebView currently does not dispatch click events to the page. This is because the long press loupe
2679         gesture (in the text interaction assistant) has a delay of 0 when running iOS apps on macOS, but on iOS, it's
2680         0.5. The zero delay on macOS means that the loupe gesture will be recognized before the synthetic click gesture;
2681         this, in turn, causes the synthetic click gesture to be excluded by the loupe gesture. To address this, we
2682         simply allow the click and loupe gesture to recognize simultaneously.
2683
2684         Additionally, a new hover gesture was added recently to handle macOS cursor types when hovering over selectable
2685         text. This patch also allows other gestures to recognize alongside hover gestures, which matches macOS behavior.
2686
2687         We don't have the capacity to write automated tests for this yet; I manually tested text selection, editing in
2688         some text form controls, as well as clicking on links, buttons, and other elements with click event handlers.
2689
2690         * UIProcess/ios/WKContentViewInteraction.mm:
2691         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2692
2693 2018-06-23  Brian Burg  <bburg@apple.com>
2694
2695         [Mac] Web Automation: include correct key code with synthesized NSEvents used for keystrokes
2696         https://bugs.webkit.org/show_bug.cgi?id=186937
2697
2698         Reviewed by Timothy Hatcher.
2699
2700         In some cases, a missing keyCode for an ASCII letter/number can cause synthesized
2701         NSEvents to not be converted into a key equivalent action like copy: or paste:.
2702
2703         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2704         Drive by, always initialize keyCode.
2705
2706         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2707         (WebKit::keyCodeForCharKey): Compute the keyCode as defined by HLTB headers.
2708         This only needs to be computed for characters with physical keys, excluding the
2709         number pad and some traditional virtual keys that do not usually have glyphs.
2710
2711 2018-06-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2712
2713         Unreviewed, fix GTK debug build after r233131
2714         https://bugs.webkit.org/show_bug.cgi?id=186899
2715         <rdar://problem/38222248>
2716
2717         This assertion was intended to be removed.
2718
2719         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2720         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2721
2722 2018-06-21  Brian Burg  <bburg@apple.com>
2723
2724         Web Automation: key actions should support multiple pressed virtual keys
2725         https://bugs.webkit.org/show_bug.cgi?id=186899
2726         <rdar://problem/38222248>
2727
2728         Reviewed by Timothy Hatcher.
2729
2730         This patch changes the protocol to allow multiple virtual keys per input source state.
2731         Chords like Cmd-Shift-A and Shift-F12 must be represented this way as they are encoded
2732         in the VirtualKey enum rather than as an ASCII char.
2733
2734         * UIProcess/Automation/Automation.json:
2735         * UIProcess/Automation/SimulatedInputDispatcher.h:
2736         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
2737         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2738         * UIProcess/Automation/WebAutomationSession.cpp:
2739         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
2740         (WebKit::WebAutomationSession::performKeyboardInteractions):
2741         (WebKit::WebAutomationSession::performInteractionSequence):
2742
2743         * UIProcess/Automation/WebAutomationSession.h:
2744         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2745         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2746         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
2747         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2748         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2749         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2750         Also clean up the signature of WebAutomationSession::platformSimulateKeyboardInteraction
2751         to use a variant instead of mutually exclusive optional values with different types.
2752
2753 2018-06-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2754
2755         [WTF] Add user-defined literal for ASCIILiteral
2756         https://bugs.webkit.org/show_bug.cgi?id=186839
2757
2758         Reviewed by Darin Adler.
2759
2760         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2761         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
2762         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2763         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
2764         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
2765         * NetworkProcess/NetworkDataTaskBlob.cpp:
2766         (WebKit::NetworkDataTaskBlob::suggestedFilename const):
2767         * NetworkProcess/NetworkLoadChecker.cpp:
2768         (WebKit::NetworkLoadChecker::checkRedirection):
2769         (WebKit::NetworkLoadChecker::checkRequest):
2770         * NetworkProcess/NetworkResourceLoader.cpp:
2771         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2772         * NetworkProcess/PingLoad.cpp:
2773         (WebKit::PingLoad::willPerformHTTPRedirection):
2774         (WebKit::PingLoad::didReceiveChallenge):
2775         (WebKit::PingLoad::timeoutTimerFired):
2776         * NetworkProcess/PreconnectTask.cpp:
2777         (WebKit::PreconnectTask::PreconnectTask):
2778         * NetworkProcess/cache/CacheStorageEngine.cpp:
2779         (WebKit::CacheStorage::Engine::initialize):
2780         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
2781         (WebKit::CacheStorage::Cache::toRecordInformation):
2782         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
2783         (WebKit::CacheStorage::cachesListFilename):
2784         (WebKit::CacheStorage::cachesOriginFilename):
2785         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2786         (WebKit::NetworkCache::Statistics::initialize):
2787         (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache):
2788         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
2789         (WebKit::NetworkCache::Statistics::clear):
2790         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
2791         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
2792         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
2793         (WebKit::XPCServiceInitializer):
2794         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2795         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2796         * Shared/Plugins/Netscape/PluginInformation.cpp:
2797         (WebKit::pluginInformationBundleIdentifierKey):
2798         (WebKit::pluginInformationBundleVersionKey):
2799         (WebKit::pluginInformationBundleShortVersionKey):
2800         (WebKit::pluginInformationPathKey):
2801         (WebKit::pluginInformationDisplayNameKey):
2802         (WebKit::pluginInformationDefaultLoadPolicyKey):
2803         (WebKit::pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey):
2804         (WebKit::pluginInformationHasSandboxProfileKey):
2805         (WebKit::pluginInformationFrameURLKey):
2806         (WebKit::pluginInformationMIMETypeKey):
2807         (WebKit::pluginInformationPageURLKey):
2808         (WebKit::pluginInformationPluginspageAttributeURLKey):
2809         (WebKit::pluginInformationPluginURLKey):
2810         (WebKit::plugInInformationReplacementObscuredKey):
2811         * Shared/ios/WebIOSEventFactory.mm:
2812         (WebIOSEventFactory::createWebKeyboardEvent):
2813         * Shared/linux/WebMemorySamplerLinux.cpp:
2814         (WebKit::WebMemorySampler::sampleWebKit const):
2815         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
2816         (debuggableTypeString):
2817         * UIProcess/API/glib/WebKitWebContext.cpp:
2818         (webkit_web_context_set_preferred_languages):
2819         * UIProcess/Automation/WebAutomationSession.cpp:
2820         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
2821         (WebKit::WebAutomationSession::addSingleCookie):
2822         (WebKit::WebAutomationSession::setSessionPermissions):
2823         (WebKit::WebAutomationSession::performMouseInteraction):
2824         (WebKit::WebAutomationSession::performKeyboardInteractions):
2825         (WebKit::WebAutomationSession::performInteractionSequence):
2826         * UIProcess/Automation/WebAutomationSession.h:
2827         * UIProcess/ChildProcessProxy.cpp:
2828         (WebKit::ChildProcessProxy::getLaunchOptions):
2829         * UIProcess/Cocoa/DownloadClient.mm:
2830         (WebKit::DownloadClient::didStart):
2831         * UIProcess/Cocoa/WebViewImpl.mm:
2832         (WebKit::selectorExceptionMap):
2833         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
2834         (WebKit::WebCredentialsMessengerProxy::makeCredential):
2835         (WebKit::WebCredentialsMessengerProxy::getAssertion):
2836         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2837         (WebKit::PluginInfoStore::pluginsDirectories):
2838         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
2839         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
2840         * UIProcess/ServiceWorkerProcessProxy.cpp:
2841         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
2842         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
2843         * UIProcess/UserMediaProcessManager.cpp:
2844         (WebKit::UserMediaProcessManager::willCreateMediaStream):
2845         (WebKit::UserMediaProcessManager::endedCaptureSession):
2846         * UIProcess/WebBackForwardList.cpp:
2847         (WebKit::WebBackForwardList::goToItem):
2848         * UIProcess/WebPageProxy.cpp:
2849         (WebKit::WebPageProxy::loadFile):
2850         (WebKit::WebPageProxy::loadHTMLString):
2851         (WebKit::WebPageProxy::loadPlainTextString):
2852         (WebKit::WebPageProxy::loadWebArchiveData):
2853         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
2854         * UIProcess/WebProcessProxy.cpp:
2855         (WebKit::WebProcessProxy::getLaunchOptions):
2856         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2857         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
2858         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
2859         (WebKit::notifyPages):
2860         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2861         * UIProcess/ios/WKContentViewInteraction.mm:
2862         (-[WKContentView copyForWebView:]):
2863         (-[WKContentView cutForWebView:]):
2864         (-[WKContentView pasteForWebView:]):
2865         (-[WKContentView selectAllForWebView:]):
2866         (-[WKContentView deleteBackward]):
2867         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2868         * UIProcess/ios/WKLegacyPDFView.mm:
2869         (-[WKLegacyPDFView _URLForLinkAnnotation:]):
2870         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2871         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
2872         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
2873         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
2874         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2875         (WebKit::WebIDBConnectionToServer::connectionToServerLost):
2876         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
2877         (webkit_dom_document_get_ready_state):
2878         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
2879         (WebKit::uniqueWorldName):
2880         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
2881         (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
2882         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2883         (WebKit::PDFPlugin::pluginInfo):
2884         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2885         (WebKit::ServiceWorkerClientFetch::validateResponse):
2886         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2887         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
2888         (WebKit::WebContextMenuClient::searchWithGoogle):
2889         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2890         (WebKit::WebInspectorClient::showPaintRect):
2891         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2892         (WebKit::RemoteWebInspectorUI::initialize):
2893         (WebKit::RemoteWebInspectorUI::didSave):
2894         (WebKit::RemoteWebInspectorUI::didAppend):
2895         (WebKit::RemoteWebInspectorUI::frontendLoaded):
2896         * WebProcess/WebPage/WebInspector.cpp:
2897         (WebKit::WebInspector::openInNewTab):
2898         * WebProcess/WebPage/WebInspectorUI.cpp:
2899         (WebKit::WebInspectorUI::setDockSide):
2900         (WebKit::WebInspectorUI::setDockingUnavailable):
2901         (WebKit::WebInspectorUI::setIsVisible):
2902         (WebKit::WebInspectorUI::showConsole):
2903         (WebKit::WebInspectorUI::showResources):
2904         (WebKit::WebInspectorUI::showTimelines):
2905         (WebKit::WebInspectorUI::showMainResourceForFrame):
2906         (WebKit::WebInspectorUI::startPageProfiling):
2907         (WebKit::WebInspectorUI::stopPageProfiling):
2908         (WebKit::WebInspectorUI::startElementSelection):
2909         (WebKit::WebInspectorUI::stopElementSelection):
2910         (WebKit::WebInspectorUI::didSave):
2911         (WebKit::WebInspectorUI::didAppend):
2912         * WebProcess/WebPage/WebPage.cpp:
2913         (WebKit::WebPage::loadStringImpl):
2914         (WebKit::WebPage::loadAlternateHTMLString):
2915         * WebProcess/WebPage/ios/WebPageIOS.mm:
2916         (WebKit::computeAutocorrectionContext):
2917         * WebProcess/WebProcess.cpp:
2918         (WebKit::getWebCoreMemoryCacheStatistics):
2919         (WebKit::WebProcess::getWebCoreStatistics):
2920         * WebProcess/cocoa/WebProcessCocoa.mm:
2921         (WebKit::WebProcess::initializeProcessName):
2922
2923 2018-06-22  Chris Dumez  <cdumez@apple.com>
2924
2925         Regression(r230211): Crash under WebInspectorClient::~WebInspectorClient()
2926         https://bugs.webkit.org/show_bug.cgi?id=186950
2927         <rdar://problem/40602069>
2928
2929         Reviewed by Darin Adler.
2930
2931         Re-introduce null-check that was accidentally dropped in r230211.
2932
2933         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2934         (WebKit::WebInspectorClient::~WebInspectorClient):
2935
2936 2018-06-22  Timothy Hatcher  <timothy@apple.com>
2937
2938         Corner of two scroll bars is white with dark mode enabled.
2939         https://bugs.webkit.org/show_bug.cgi?id=186819
2940         rdar://problem/40434350
2941
2942         Reviewed by Tim Horton.
2943
2944         * UIProcess/mac/WKPrintingView.mm:
2945         (-[WKPrintingView drawRect:]): Added LocalDefaultSystemAppearance.
2946         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2947         (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
2948         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2949         (WebKit::PDFPlugin::paintControlForLayerInContext): Ditto. Dropped ScrollView argument.
2950         * WebProcess/WebPage/WebPage.cpp:
2951         (WebKit::WebPage::drawRect): Added LocalDefaultSystemAppearance.
2952
2953 2018-06-22  Tim Horton  <timothy_horton@apple.com>
2954
2955         Make it possible to add a border around loading or failed-to-load images
2956         https://bugs.webkit.org/show_bug.cgi?id=186614
2957         <rdar://problem/39050152>
2958
2959         Reviewed by Zalan Bujtas.
2960
2961         * Shared/WebPreferences.yaml:
2962         * UIProcess/API/Cocoa/WKWebView.mm:
2963         (-[WKWebView _initializeWithConfiguration:]):
2964         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2965         (-[WKWebViewConfiguration init]):
2966         (-[WKWebViewConfiguration copyWithZone:]):
2967         (-[WKWebViewConfiguration _setColorFilterEnabled:]):
2968         (-[WKWebViewConfiguration _incompleteImageBorderEnabled]):
2969         (-[WKWebViewConfiguration _setIncompleteImageBorderEnabled:]):
2970         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2971         Plumb the setting to WebKit2.
2972
2973 2018-06-22  Brady Eidson  <beidson@apple.com>
2974
2975         WKURLSchemeHandler doesn't handle sync XHR.
2976         <rdar://problem/40955884> and https://bugs.webkit.org/show_bug.cgi?id=186902
2977
2978         Reviewed by Chris Dumez.
2979
2980         This patch allows WebProcesses to block on sync loads to a custom scheme,
2981         and teaches WebURLSchemeTasks how to buffer up data and the response if 
2982         operating synchronously.
2983
2984         * Shared/WebErrors.cpp:
2985         (WebKit::failedCustomProtocolSyncLoad):
2986         * Shared/WebErrors.h:
2987
2988         * UIProcess/WebPageProxy.cpp:
2989         (WebKit::WebPageProxy::startURLSchemeTask):
2990         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
2991         * UIProcess/WebPageProxy.h:
2992         * UIProcess/WebPageProxy.messages.in:
2993
2994         * UIProcess/WebURLSchemeHandler.cpp:
2995         (WebKit::WebURLSchemeHandler::startTask):
2996         * UIProcess/WebURLSchemeHandler.h:
2997
2998         * UIProcess/WebURLSchemeTask.cpp:
2999         (WebKit::WebURLSchemeTask::create):
3000         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
3001         (WebKit::WebURLSchemeTask::didPerformRedirection):
3002         (WebKit::WebURLSchemeTask::didReceiveResponse):
3003         (WebKit::WebURLSchemeTask::didReceiveData):
3004         (WebKit::WebURLSchemeTask::didComplete):
3005         (WebKit::WebURLSchemeTask::pageDestroyed):
3006         (WebKit::WebURLSchemeTask::stop):
3007         * UIProcess/WebURLSchemeTask.h:
3008         (WebKit::WebURLSchemeTask::isSync const):
3009
3010         * WebProcess/Network/WebLoaderStrategy.cpp:
3011         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
3012         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3013         * WebProcess/Network/WebLoaderStrategy.h:
3014
3015         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
3016         (WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
3017         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
3018
3019 2018-06-22  Chris Dumez  <cdumez@apple.com>
3020
3021         Implement IPC throttling to keep the main thread responsive when a process misbehaves
3022         https://bugs.webkit.org/show_bug.cgi?id=186607
3023         <rdar://problem/41073205>
3024
3025         Reviewed by Geoff Garen and Brady Eidson.
3026
3027         Implement IPC throttling to keep the main thread responsive when a process misbehaves.
3028         Instead of doing one main runloop dispatch per incoming message, we now do a single
3029         runloop dispatch and process incoming messages in batch. We put a limit on the number
3030         of messages to be processed in a batch (600). If the queue is larger that this limit,
3031         we'll schedule a 0-timer to process remaining messages, giving the main runloop a chance
3032         to process other events. Additionally, if an IPC connection keeps hitting this maximum
3033         batch size limit, we implement back off and we'll further decrease the number of messages
3034         we process in each batch (going as low as 60). This keeps Safari responsive enough to
3035         allow the user to close the bad tab (even on older devices such as iPhone 5s).
3036
3037         Finally, if the incoming message queue becomes too large (50000), we go one step further
3038         and kill the IPC connection in order to maintain performance / battery life.
3039
3040         Every time we apply throttling or terminate a connection due to throttling, we do a
3041         RELEASE_LOG_ERROR() with useful information in order to help diagnose potential issues
3042         in the future.
3043
3044         For now, incoming IPC messages throttling is only enabled on the UIProcess' connections
3045         to the WebProcesses.
3046
3047         * Platform/IPC/Connection.cpp:
3048         (IPC::Connection::Connection):
3049         (IPC::Connection::enqueueIncomingMessage):
3050         (IPC::Connection::MessagesThrottler::MessagesThrottler):
3051         (IPC::Connection::MessagesThrottler::scheduleMessagesDispatch):
3052         (IPC::Connection::MessagesThrottler::numberOfMessagesToProcess):
3053         (IPC::Connection::dispatchIncomingMessages):
3054         * Platform/IPC/Connection.h:
3055         * Platform/IPC/mac/ConnectionMac.mm:
3056         (IPC::Connection::kill):
3057
3058 2018-06-22  Sihui Liu  <sihui_liu@apple.com>
3059
3060         REGRESSION (r231850): Cookie file cannot be read or written by network process
3061         https://bugs.webkit.org/show_bug.cgi?id=186806
3062         <rdar://problem/41113791>
3063
3064         Unreviewed. Fix failure after r233084 by adding missing initialization.
3065
3066         * UIProcess/WebProcessPool.cpp:
3067         (WebKit::WebProcessPool::ensureNetworkProcess):
3068
3069 2018-06-22  Jer Noble  <jer.noble@apple.com>
3070
3071         [Fullscreen] Home indicator should show and hide with status bar
3072         https://bugs.webkit.org/show_bug.cgi?id=186942
3073         <rdar://problem/41302190>
3074
3075         Reviewed by Tim Horton.
3076
3077         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
3078         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3079         (-[WKFullScreenViewController showUI]):
3080         (-[WKFullScreenViewController hideUI]):
3081         (-[WKFullScreenViewController setPrefersHomeIndicatorAutoHidden:]):
3082
3083 2018-06-22  Jer Noble  <jer.noble@apple.com>
3084
3085         [Fullscreen] Add a pinch-to-exit gesture
3086         https://bugs.webkit.org/show_bug.cgi?id=186821
3087
3088         Reviewed by Tim Horton.
3089
3090         Add a pinch gesture recognizer that overrides the pan gesture recognizer when active. Hide the
3091         WKFullscreenViewController's controls while a dismiss gesture is active.
3092
3093         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
3094         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3095         (-[WKFullScreenViewController setAnimating:]):
3096         (-[WKFullScreenViewController prefersStatusBarHidden]):
3097         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
3098         (-[WKFullScreenViewController _touchDetected:]):
3099         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3100         (-[WKFullscreenAnimationController context]):
3101         (-[WKFullscreenAnimationController updateWithProgress:scale:translation:anchor:]):
3102         (-[WKFullScreenInteractiveTransition animator]):
3103         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withScale:andTranslation:]):
3104         (-[WKFullScreenWindowController enterFullScreen]):
3105         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
3106         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
3107         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
3108         (-[WKFullScreenWindowController _dismissFullscreenViewController]):
3109         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
3110         (-[WKFullScreenWindowController _interactivePinchDismissChanged:]):
3111
3112 2018-06-22  Brian Burg  <bburg@apple.com>
3113
3114         [Cocoa] REGRESSION(W3C): actions for key equivalents are not respected
3115         https://bugs.webkit.org/show_bug.cgi?id=186936
3116
3117         Reviewed by Timothy Hatcher.
3118
3119         * UIProcess/Automation/WebAutomationSession.cpp:
3120         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
3121         This erroneously reported false unless there was both a mouse and key interaction
3122         being dispatched, which is not possible in the current serial event simulation model.
3123         As a result, Safari could not tell whether the action came from a simulated event
3124         or the user, and thus rejected all key equivalents like Cmd-A,V,C,X.
3125
3126 2018-06-22  Jer Noble  <jer.noble@apple.com>
3127
3128         [Fullscreen] Exit fullscreen when opening a new tab
3129         https://bugs.webkit.org/show_bug.cgi?id=186826
3130         <rdar://problem/40853211>
3131
3132         Reviewed by Brent Fulgham.
3133
3134         Make the fullscreen placeholder view a custom UIView, and exit fullscreen when the
3135         placeholder is removed from its superview.
3136
3137         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3138         (-[WKFullScreenPlaceholderView willMoveToSuperview:]):
3139         (-[WKFullScreenWindowController enterFullScreen]):
3140         (-[WKFullScreenWindowController _completedExitFullScreen]):
3141         (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]):
3142         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
3143
3144 2018-06-22  Timothy Horton  <timothy_horton@apple.com>
3145
3146         Fix the build after r233089
3147
3148         * UIProcess/API/Cocoa/WKPreferences.mm:
3149         (-[WKPreferences _setColorFilterEnabled:]):
3150         (-[WKPreferences _colorFilterEnabled]):
3151
3152 2018-06-22  Chris Dumez  <cdumez@apple.com>
3153
3154         Crash under WebResourceLoadStatisticsStore::mergeStatistics(WTF::Vector<WebCore::ResourceLoadStatistics, 0ul, WTF::CrashOnOverflow, 16ul>&&)
3155         https://bugs.webkit.org/show_bug.cgi?id=186905
3156         <rdar://problem/41266775>
3157
3158         Reviewed by Brent Fulgham.
3159
3160         I believe the crash was caused by the WebResourceLoadStatisticsStore object being dead
3161         when mergeStatistics() is called. In particular, the crash was happening when the
3162         ResourceLoadStatisticsPersistentStorage's FileMonitor would detect a file change and
3163         we would re-sync statistics from the disk. The FileMonitor's lambda function was
3164         capturing |this| without ref'ing it, and the FileMonitor monitors the disk and
3165         calls the lambda on the background queue, while it gets destroyed on the main thread.
3166
3167         To make lifetime management less complex, the following changes were made:
3168         - The ResourceLoadStatisticsPersistentStorage object is now always constructed / used
3169           and destroyed on the background queue. We no longer have to worry about being on
3170           the right thread in a given method.
3171         - Now that ResourceLoadStatisticsPersistentStorage is always used from the background
3172           queue and no longer needs to be thread-safe, drop its ref() / deref() methods and
3173           use weak pointers instead to make sure the ResourceLoadStatisticsPersistentStorage
3174           is still alive when a lamdba gets called on the background queue.
3175         - For write scheduling use WorkQueue::dispatchAfter() and a WeakPtr instead of a
3176           RunLoop::Timer. This is more convenient to use as the RunLoop::Timer has to be used
3177           on the main thread.
3178
3179         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
3180         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
3181         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
3182         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
3183         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
3184         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
3185         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
3186         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3187         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3188         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
3189         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
3190         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
3191         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
3192         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
3193         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3194         * UIProcess/WebResourceLoadStatisticsStore.h:
3195
3196 2018-06-21  Jer Noble  <jer.noble@apple.com>
3197
3198         CRASH in WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac()
3199         https://bugs.webkit.org/show_bug.cgi?id=186892
3200
3201         Reviewed by Eric Carlson.
3202
3203         Protect against m_contentMap being mutated while its contents are being invalidated
3204         by moving the map into a local variable and iterating over it instead.
3205
3206         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3207         (WebKit::PlaybackSessionManagerProxy::invalidate):
3208         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3209         (WebKit::VideoFullscreenManagerProxy::invalidate):
3210
3211 2018-06-22  Luming Yin  <luming_yin@apple.com>
3212
3213         Expose colorFilterEnabled SPI in WKPreferencesPrivate.h
3214         https://bugs.webkit.org/show_bug.cgi?id=186935
3215         <rdar://problem/41109387>
3216
3217         Reviewed by Tim Horton.
3218
3219         * UIProcess/API/Cocoa/WKPreferences.mm:
3220         (-[WKPreferences _setColorFilterEnabled:]):
3221         (-[WKPreferences _colorFilterEnabled]):
3222         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3223
3224 2018-06-22  Timothy Hatcher  <timothy@apple.com>
3225
3226         Recalc styles every time defaultAppearance changes.
3227         https://bugs.webkit.org/show_bug.cgi?id=186866
3228         rdar://problem/41309805
3229
3230         Reviewed by Tim Horton.
3231
3232         * UIProcess/WebPageProxy.cpp:
3233         (WebKit::WebPageProxy::setDefaultAppearance):
3234         * WebProcess/WebPage/WebPage.cpp:
3235         (WebKit::WebPage::setDefaultAppearance):
3236
3237 2018-06-22  Sihui Liu  <sihui_liu@apple.com>
3238
3239         REGRESSION (r231850): Cookie file cannot be read or written by network process
3240         https://bugs.webkit.org/show_bug.cgi?id=186806
3241         <rdar://problem/41113791>
3242
3243         Reviewed by Geoffrey Garen.
3244
3245         Add defaultSessionPendingCookies to NetworkProcessCreationParameters, so pending cookies of default session 
3246         can be added right after default session is set. This improves the fix r231850 as it does not send additional 
3247         message and avoids the regression.
3248
3249         * NetworkProcess/NetworkProcess.cpp:
3250         (WebKit::NetworkProcess::initializeNetworkProcess):
3251         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3252         (WebKit::NetworkProcessCreationParameters::encode const):
3253         (WebKit::NetworkProcessCreationParameters::decode):
3254         * NetworkProcess/NetworkProcessCreationParameters.h:
3255         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3256         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3257         * UIProcess/Network/NetworkProcessProxy.cpp:
3258         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
3259         * UIProcess/WebProcessPool.cpp:
3260         (WebKit::WebProcessPool::ensureNetworkProcess):
3261
3262 2018-06-22  Brent Fulgham  <bfulgham@apple.com>
3263
3264         [iOS Debug] Multiple resourceLoadStatistics redirect tests are flaky timeouts
3265         https://bugs.webkit.org/show_bug.cgi?id=183216
3266         <rdar://problem/37992317>
3267
3268         Reviewed by Chris Dumez.
3269
3270         Improve consistency of test results by make sure that completion handlers written to run
3271         on the main thread are only called on the main thread. Add additional assertions to help
3272         catch any cases where this invariant is not being honored.
3273
3274         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3275         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Use Completion handler and assert
3276         we are on the right thread.
3277         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Ditto.
3278         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): Ditto.
3279         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
3280         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Ditto.
3281         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
3282         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
3283         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
3284         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
3285         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
3286         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
3287         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
3288         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
3289         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
3290         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
3291         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
3292         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
3293         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
3294         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
3295         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
3296         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
3297         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
3298         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): 
3299         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
3300         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
3301         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
3302         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Update to perform callbacks
3303         on the main thread (as intended). This function was doing them on a work queue.
3304         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Ditto.
3305         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Ditto.
3306         (WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains): Ditto.
3307         * UIProcess/WebResourceLoadStatisticsStore.h:
3308
3309 2018-06-22  Michael Catanzaro  <mcatanzaro@igalia.com>
3310
3311         REGRESSION(r230950): [GTK] WebKit::CoordinatedBackingStoreTile::setBackBuffer(): WebKitWebProcess killed by SIGSEGV (ASSERTION FAILED: it != m_tiles.end())
3312         https://bugs.webkit.org/show_bug.cgi?id=186206
3313
3314         Unreviewed manual rollout of r230950
3315
3316         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3317         (WebKit::layerShouldHaveBackingStore):
3318
3319 2018-06-20  Darin Adler  <darin@apple.com>
3320
3321         [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity
3322         https://bugs.webkit.org/show_bug.cgi?id=186875
3323
3324         Reviewed by Anders Carlsson.
3325
3326         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
3327         (API::WebsiteDataStore::tempDirectoryFileSystemRepresentation): Use isDirectory:YES to create a URL
3328         to the temporary directory.
3329         * UIProcess/Cocoa/WebViewImpl.mm:
3330         (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination): Use isDirectory:NO to create a URL
3331         pointing to the write location.
3332         * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
3333         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const): Use isDirectory:YES to
3334         create a URL for the local storage directory.
3335         * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm:
3336         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup const): Use isDirectory:NO to
3337         create a URL for the storage directory.
3338         * UIProcess/ios/WKContentViewInteraction.mm:
3339         (-[WKContentView _prepareToDragPromisedBlob:]): Use isDirectory:NO to create a URL for the temporary
3340         file location.
3341         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3342         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]): Use isDirectory:NO
3343         to create a URL for the image file to upload.
3344         * UIProcess/mac/WebInspectorProxyMac.mm:
3345         (WebKit::WebInspectorProxy::inspectorPageURL): Use isDirectory:NO to create a URL for the HTML file.
3346         (WebKit::WebInspectorProxy::inspectorTestPageURL): Ditto.
3347         (WebKit::WebInspectorProxy::inspectorBaseURL): Ditto.
3348         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
3349         (WebKit::WebChromeClient::createIconForFiles): Use isDirectory:NO to create a URL for the image file.
3350         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
3351         (WebKit::webInspectorUILocalizedStringsURL): Use isDirectory:NO to create a URL for the localized
3352         strings file.
3353
3354 2018-06-21  Chris Dumez  <cdumez@apple.com>
3355
3356         Unreviewed, rolling out r232995.
3357
3358         Seems to have caused flakiness
3359
3360         Reverted changeset:
3361
3362         "Implement IPC throttling to keep the main thread responsive
3363         when a process misbehaves"
3364         https://bugs.webkit.org/show_bug.cgi?id=186607
3365         https://trac.webkit.org/changeset/232995
3366
3367 2018-06-15  Jer Noble  <jer.noble@apple.com>
3368
3369         Address fullscreen api CSS env feedback
3370         https://bugs.webkit.org/show_bug.cgi?id=186684
3371
3372         Reviewed by Simon Fraser.
3373
3374         + Update the phishing alert text to be more explicit about the specific threats
3375           phishing sites represent.
3376         + Make the top inset static, rather than dynamic.
3377         + Add bottom, left, and right insets for completeness.
3378         + Set the fullscreen animation duration as well as delay.
3379         + Notify the page when the controls show and hide.
3380
3381         * UIProcess/WebFullScreenManagerProxy.cpp:
3382         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
3383         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideTiming):
3384         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
3385         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop): Deleted.
3386         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay): Deleted.
3387         * UIProcess/WebFullScreenManagerProxy.h:
3388         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3389         (-[WKFullScreenViewController showUI]):
3390         (-[WKFullScreenViewController hideUI]):
3391         (-[WKFullScreenViewController viewWillAppear:]):
3392         (-[WKFullScreenViewController _effectiveFullscreenInsets]):
3393         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
3394         (-[WKFullScreenViewController _showPhishingAlert]):
3395         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]): Deleted.
3396         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3397         (WebKit::WebFullScreenManager::didExitFullScreen):
3398         (WebKit::WebFullScreenManager::setFullscreenInsets):
3399         (WebKit::WebFullScreenManager::setFullscreenAutoHideTiming):
3400         (WebKit::WebFullScreenManager::setFullscreenControlsHidden):
3401         (WebKit::WebFullScreenManager::setFullscreenInsetTop): Deleted.
3402         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay): Deleted.
3403         * WebProcess/FullScreen/WebFullScreenManager.h:
3404         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
3405
3406 2018-06-21  Commit Queue  <commit-queue@webkit.org>
3407
3408         Unreviewed, rolling out r232884.
3409         https://bugs.webkit.org/show_bug.cgi?id=186891
3410
3411         "Introduced assertion failure in ~DisplayRefreshMonitorMac()."
3412         (Requested by perarne on #webkit).
3413
3414         Reverted changeset:
3415
3416         "DisplayRefreshMonitorMac should hold a weak pointer to
3417         WebPage."
3418         https://bugs.webkit.org/show_bug.cgi?id=186683
3419         https://trac.webkit.org