[Wi-Fi Assertions] Pass a ResumptionReason to resumeWiFiAssertions
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-07-28  Andy Estes  <aestes@apple.com>
2
3         [Wi-Fi Assertions] Pass a ResumptionReason to resumeWiFiAssertions
4         https://bugs.webkit.org/show_bug.cgi?id=188142
5         <rdar://problem/42628842>
6
7         Reviewed by Darin Adler.
8
9         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
10         (WebKit::NetworkProcess::platformProcessDidResume):
11         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
12
13 2018-07-28  Darin Adler  <darin@apple.com>
14
15         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
16         https://bugs.webkit.org/show_bug.cgi?id=188140
17
18         Reviewed by Sam Weinig.
19
20         * UIProcess/mac/WKFullScreenWindowController.mm:
21         (-[WKFullScreenWindowController enterFullScreen:]): Removed the call to
22         setAction: since the full screen placeholder view now always uses the
23         cancelOperation: method.
24
25         * WebProcess/Plugins/PDF/PDFPlugin.mm:
26         (WebKit::PDFPlugin::lookupTextAtLocation): Updated to use the new
27         DictionaryLookup function that returns a tuple instead of using an out argument.
28         * WebProcess/WebPage/mac/WebPageMac.mm:
29         (WebKit::WebPage::performDictionaryLookupAtLocation): Ditto.
30         (WebKit::WebPage::performDictionaryLookupForSelection): Ditto.
31
32 2018-07-27  Chris Dumez  <cdumez@apple.com>
33
34         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
35         https://bugs.webkit.org/show_bug.cgi?id=188097
36         <rdar://problem/42558823>
37
38         Reviewed by Eric Carlson.
39
40         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
41
42 2018-07-27  Alex Christensen  <achristensen@webkit.org>
43
44         Don't include WebPageProxy.h just for UndoOrRedo
45         https://bugs.webkit.org/show_bug.cgi?id=188086
46
47         Reviewed by Saam Barati.
48
49         * Shared/UndoOrRedo.h: Added.
50         * UIProcess/Cocoa/WebViewImpl.h:
51         * UIProcess/Cocoa/WebViewImpl.mm:
52         (WebKit::WebViewImpl::registerEditCommand):
53         * UIProcess/PageClient.h:
54         * UIProcess/WebEditCommandProxy.cpp:
55         (WebKit::WebEditCommandProxy::unapply):
56         (WebKit::WebEditCommandProxy::reapply):
57         * UIProcess/WebPageProxy.cpp:
58         (WebKit::WebPageProxy::registerEditCommandForUndo):
59         (WebKit::WebPageProxy::canUndoRedo):
60         (WebKit::WebPageProxy::executeUndoRedo):
61         (WebKit::WebPageProxy::canUndo):
62         (WebKit::WebPageProxy::canRedo):
63         * UIProcess/WebPageProxy.h:
64         * UIProcess/WebPageProxy.messages.in:
65         * UIProcess/ios/PageClientImplIOS.h:
66         * UIProcess/ios/PageClientImplIOS.mm:
67         (WebKit::PageClientImpl::registerEditCommand):
68         (WebKit::PageClientImpl::canUndoRedo):
69         (WebKit::PageClientImpl::executeUndoRedo):
70         * UIProcess/mac/PageClientImplMac.h:
71         * UIProcess/mac/PageClientImplMac.mm:
72         (WebKit::PageClientImpl::registerEditCommand):
73         (WebKit::PageClientImpl::canUndoRedo):
74         (WebKit::PageClientImpl::executeUndoRedo):
75         * UIProcess/mac/WebContextMenuProxyMac.mm:
76         * WebKit.xcodeproj/project.pbxproj:
77         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
78         (WebKit::WebEditorClient::canUndo const):
79         (WebKit::WebEditorClient::canRedo const):
80         (WebKit::WebEditorClient::undo):
81         (WebKit::WebEditorClient::redo):
82
83 2018-07-27  Alex Christensen  <achristensen@webkit.org>
84
85         Make CompletionHandler more const correct
86         https://bugs.webkit.org/show_bug.cgi?id=186543
87
88         Reviewed by Saam Barati.
89
90         * NetworkProcess/PingLoad.cpp:
91         (WebKit::PingLoad::willPerformHTTPRedirection):
92         * NetworkProcess/cache/CacheStorageEngine.cpp:
93         (WebKit::CacheStorage::Engine::clearAllCaches):
94         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
95         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
96         * UIProcess/Automation/WebAutomationSession.cpp:
97         (WebKit::WebAutomationSession::simulateMouseInteraction):
98         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
99         * UIProcess/Cocoa/AutomationSessionClient.mm:
100         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
101         (WebKit::AutomationSessionClient::requestSwitchToPage):
102         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
103         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
104         * UIProcess/Cocoa/UIDelegate.mm:
105         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
106         (WebKit::UIDelegate::UIClient::createNewPage):
107         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
108         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
109         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
110         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
111         (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
112         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
113         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
114         (WebKit::UIDelegate::UIClient::runOpenPanel):
115         * UIProcess/WebPageProxy.cpp:
116         (WebKit::WebPageProxy::createNewPage):
117         (WebKit::WebPageProxy::webGLPolicyForURL):
118         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
119         (WebKit::WebPageProxy::getWindowFrame):
120         * UIProcess/WebResourceLoadStatisticsStore.cpp:
121         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
122         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
123         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
124         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
125
126 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
127
128         Be more conservative with compositing layer creation when memory is low
129         https://bugs.webkit.org/show_bug.cgi?id=187866
130         rdar://problem/42366345
131
132         Reviewed by Zalan Bujtas.
133         
134         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
135         compositing layers. We avoid compositing for these situations:
136         1. Layers with 3D transforms which are affine (like translateZ(0)).
137         2. Layers with will-change
138         3. Layers for canvases (other than WebGL/WebGPU)
139         
140         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
141         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
142         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
143         
144         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
145         flakily falling into a different mode, and so that we can impose the conservative
146         mode for testing.
147
148         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
149         (WKBundlePageSetCompositingPolicyOverride):
150         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
151
152 2018-07-27  Alex Christensen  <achristensen@webkit.org>
153
154         Add RefCounted CompletionHandler wrapping abstraction for sending policy decisions back to WebProcess
155         https://bugs.webkit.org/show_bug.cgi?id=188089
156
157         Reviewed by Geoffrey Garen.
158
159         This will be necessary for when I add an asynchronous parallel step to decidePolicyForNavigationAction.
160         We will want to wait for that asynchronous step for decidePolicyForNavigationActionSync but not for a client.
161
162         No change in behavior.
163
164         * UIProcess/WebPageProxy.cpp:
165         (WebKit::WebPageProxy::PolicyDecisionSender::create):
166         (WebKit::WebPageProxy::PolicyDecisionSender::operator()):
167         (WebKit::WebPageProxy::PolicyDecisionSender::PolicyDecisionSender):
168         (WebKit::WebPageProxy::receivedPolicyDecision):
169         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
170         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
171         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
172         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
173         (WebKit::WebPageProxy::decidePolicyForResponse):
174         * UIProcess/WebPageProxy.h:
175         * UIProcess/WebPageProxy.messages.in:
176         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
177         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
178
179 2018-07-27  Saam Barati  <sbarati@apple.com>
180
181         Use SPI to compute the jetsam limit on iOS instead of hardcoding 840MB
182         https://bugs.webkit.org/show_bug.cgi?id=188091
183         <rdar://problem/42647697>
184
185         Reviewed by Simon Fraser.
186
187         Give the Network/Storage/WebContent process the com.apple.private.memorystatus
188         entitlement. This allows them to read the process jetsam limit.
189
190         * Configurations/Databases-iOS.entitlements:
191         * Configurations/Network-iOS.entitlements:
192         * Configurations/WebContent-iOS.entitlements:
193
194 2018-07-03  David Fenton  <david_fenton@apple.com>
195
196         Unreviewed, rolling out r233461.
197
198         assertions triggered on ios11 Debug wk2
199
200         Reverted changeset:
201
202         "[iOS] Add assert to catch improper use of WebCore::Timer in
203         UI Process"
204         https://bugs.webkit.org/show_bug.cgi?id=185330
205         https://trac.webkit.org/changeset/233461
206
207 2018-07-27  Alex Christensen  <achristensen@webkit.org>
208
209         Remove unused WKNavigationDelegatePrivate decidePolicyForNavigationAction SPI
210         https://bugs.webkit.org/show_bug.cgi?id=188077
211
212         Reviewed by Darin Adler.
213
214         The one client has moved to the version with userInfo, and it never used the SPI
215         on old operating systems.
216
217         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
218         * UIProcess/Cocoa/NavigationState.h:
219         * UIProcess/Cocoa/NavigationState.mm:
220         (WebKit::NavigationState::setNavigationDelegate):
221         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
222
223 2018-07-27  Alex Christensen  <achristensen@webkit.org>
224
225         Begin making WKWebViewConfiguration a wrapper around an API::PageConfiguration
226         https://bugs.webkit.org/show_bug.cgi?id=188030
227
228         Reviewed by Sam Weinig.
229
230         Eventually WKWebViewConfiguration should become just a API::ObjectStorage<API::PageConfiguration>.
231         The transition includes adding fields that exist in WKWebViewConfiguration to API::PageConfiguration
232         and making WKWebViewConfiguration's getters and setters just call API::PageConfiguration's corresponding methods
233         instead of having an ivar for each value then copying it to an API::PageConfiguration we construct in
234         the WKWebView constructor.  To transition incrementally, I've added a RefPtr<API::PageConfiguration> ivar to
235         WKWebViewConfiguration and moved a few ivars to use the values stored in that API::PageConfiguration instead.
236         I've arbitrarily chosen _treatsSHA1SignedCertificatesAsInsecure and _urlSchemeHandlers as the first two 
237         properties to transition, and I'll continue transitioning each ivar in small, easy-to-review bunches.
238
239         * UIProcess/API/APIPageConfiguration.cpp:
240         (API::PageConfiguration::copy const):
241         (API::PageConfiguration::urlSchemeHandlerForURLScheme):
242         (API::PageConfiguration::setURLSchemeHandlerForURLScheme):
243         * UIProcess/API/APIPageConfiguration.h:
244         (API::PageConfiguration::urlSchemeHandlers):
245         * UIProcess/API/Cocoa/WKWebView.mm:
246         (-[WKWebView _initializeWithConfiguration:]):
247         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
248         (-[WKWebViewConfiguration init]):
249         (-[WKWebViewConfiguration copyWithZone:]):
250         (-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
251         (-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
252         (-[WKWebViewConfiguration copyPageConfiguration]):
253         (-[WKWebViewConfiguration _treatsSHA1SignedCertificatesAsInsecure]):
254         (-[WKWebViewConfiguration _setTreatsSHA1SignedCertificatesAsInsecure:]):
255         (-[WKWebViewConfiguration _urlSchemeHandlers]): Deleted.
256         * UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:
257
258 2018-07-27  Chris Dumez  <cdumez@apple.com>
259
260         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
261         https://bugs.webkit.org/show_bug.cgi?id=188078
262         <rdar://problem/42562493>
263
264         Unreviewed, follow-up fix after r234290 to address assertion hits on the bots. Make the fix
265         specific to reloads as we know the existing provisional sandbox extension is for the same
266         URL then.
267
268         * WebProcess/WebPage/WebPage.cpp:
269         (WebKit::WebPage::reload):
270         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
271         (WebKit::WebPage::SandboxExtensionTracker::beginReload):
272         * WebProcess/WebPage/WebPage.h:
273
274 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
275
276         [INTL] Remove INTL sub-feature compile flags
277         https://bugs.webkit.org/show_bug.cgi?id=188081
278
279         Reviewed by Michael Catanzaro.
280
281         * Configurations/FeatureDefines.xcconfig:
282
283 2018-07-26  Chris Dumez  <cdumez@apple.com>
284
285         Loading a file URL and then issuing a reload right away causes the load to fail due to sandboxing
286         https://bugs.webkit.org/show_bug.cgi?id=188078
287         <rdar://problem/42562493>
288
289         Reviewed by Geoff Garen.
290
291         When WebPageProxy::loadFile() is called, we create a SandboxExtension::Handle for the resource path provided
292         by the caller and pass it to the WebProcess. WebPage::loadRequest() then calls SandboxExtensionTracker::beginLoad()
293         to store this handle in m_provisionalSandboxExtension for later consumption.
294
295         If a reload is issued before this sandbox extension has been consumed, then the following happens:
296         1. WebPageProxy::reload() does NOT create a SandboxExtension::Handle because it has already issued one earlier.
297            maybeInitializeSandboxExtensionHandle() returns early due to m_process->hasAssumedReadAccessToURL(url) check.
298         2. WebPage::reload() then calls SandboxExtensionTracker::beginLoad() with a null handle, which overwrites the
299            previous m_provisionalSandboxExtension its needs.
300         3. The load fails because the WebContent process is missing the sandbox extension.
301
302         To address the issue, SandboxExtensionTracker::beginLoad() is updated to only overwrite m_provisionalSandboxExtension
303         if the new handle is not null. This avoids inadvertently clearing a valid sandbox extension we may need for the load,
304         since the UIProcess sends us a null handle if it previously sent us a sandbox extension for the path in question.
305
306         * WebProcess/WebPage/WebPage.cpp:
307         (WebKit::WebPage::SandboxExtensionTracker::beginLoad):
308
309 2018-07-26  Chris Dumez  <cdumez@apple.com>
310
311         It should be possible to use WTF::CallbackAggregator from a background thread
312         https://bugs.webkit.org/show_bug.cgi?id=188084
313
314         Reviewed by Alex Christensen.
315
316         This code was passing CallbackAggregator objects for background thread and not being
317         careful on which thread the CallbackAggregator gets destroyed. This patch fixes this
318         since the CallbackAggregator destructor no longer takes care of dispatching to the
319         main thread.
320
321         * NetworkProcess/cache/CacheStorageEngine.cpp:
322         (WebKit::CacheStorage::Engine::clearAllCaches):
323         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
324
325 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
326
327         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
328         https://bugs.webkit.org/show_bug.cgi?id=187963
329
330         Reviewed by Alex Christensen.
331
332         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
333         (WebKit::CacheStorage::updateVaryInformation):
334         * NetworkProcess/capture/NetworkCaptureManager.cpp:
335         (WebKit::NetworkCapture::Manager::fuzzyMatchURLs):
336         * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
337         (WebKit::getPluginInfoFromPropertyLists):
338         (WebKit::PluginVersion::parse):
339         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
340         (WebKit::NetscapePluginModule::parseMIMEDescription):
341         * Shared/Plugins/unix/PluginSearchPath.cpp:
342         (WebKit::pluginsDirectories):
343         * Shared/mac/ChildProcessMac.mm:
344         (WebKit::ChildProcess::initializeSandbox):
345         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
346         * UIProcess/Automation/WebAutomationSession.cpp:
347         (WebKit::fileCanBeAcceptedForUpload):
348         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
349         (WebKit::ProcessLauncher::launchProcess):
350         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
351         (WebKit::ProcessLauncher::launchProcess):
352         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
353         (WebKit::PluginProcessProxy::scanPlugin):
354         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
355         (WebKit::isTransparentSilverlightBackgroundValue):
356         Update split/splitAllowingEmptyEntries usage.
357
358 2018-07-26  Alex Christensen  <achristensen@webkit.org>
359
360         Fix assertions introduced in r234210
361         https://bugs.webkit.org/show_bug.cgi?id=188074
362
363         Reviewed by Chris Dumez.
364
365         There is a client that uses WKFramePolicyListenerUseWithPolicies to send website policies as
366         a response to the WKPageNavigationClient's decidePolicyForNavigationResponse.  That is wasting
367         effort to generate policies that don't change anything. Once that client adopts WKWebView
368         they won't be able to do this any more, so temporarily remove the assertion.
369         Also, make the assertion about process swapping a release assert to prevent that client
370         from adopting WKFramePolicyListenerUseInNewProcessWithPolicies for navigation responses.
371         It should only be used for navigation actions.
372
373         * UIProcess/WebPageProxy.cpp:
374         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
375         (WebKit::WebPageProxy::decidePolicyForResponse):
376
377 2018-07-26  Commit Queue  <commit-queue@webkit.org>
378
379         Unreviewed, rolling out r234181 and r234189.
380         https://bugs.webkit.org/show_bug.cgi?id=188075
381
382         These are not needed right now (Requested by thorton on
383         #webkit).
384
385         Reverted changesets:
386
387         "Enable Web Content Filtering on watchOS"
388         https://bugs.webkit.org/show_bug.cgi?id=187979
389         https://trac.webkit.org/changeset/234181
390
391         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
392         https://bugs.webkit.org/show_bug.cgi?id=187985
393         https://trac.webkit.org/changeset/234189
394
395 2018-07-26  Chris Dumez  <cdumez@apple.com>
396
397         ERROR: Unhandled web process message 'WebPage:SetUseDarkAppearance' when browsing in dark mode
398         https://bugs.webkit.org/show_bug.cgi?id=188028
399
400         Reviewed by Wenson Hsieh.
401
402         The issue was that the WebViewImpl constructor was calling setUseDarkAppearance() *before* calling
403         initializeWebPage(), which would cause us to send IPC the WebContent process for a pageID that does
404         not exist on WebProcess side yet.
405
406         To address the issue, the WebViewImpl constructor no longer calls setUseDarkAppearance() and WebPageProxy
407         no longer holds a flag indicates is dark appearance is used. Instead, the WebPageProxy asks the WebView
408         for the value whenever it needs to, via the PageClient.
409
410         * UIProcess/Cocoa/WebViewImpl.h:
411         * UIProcess/Cocoa/WebViewImpl.mm:
412         (WebKit::WebViewImpl::WebViewImpl):
413         (WebKit::WebViewImpl::effectiveAppearanceDidChange):
414         (WebKit::WebViewImpl::setUseDarkAppearance): Deleted.
415         * UIProcess/PageClient.h:
416         * UIProcess/WebPageProxy.cpp:
417         (WebKit::WebPageProxy::creationParameters):
418         (WebKit::WebPageProxy::useDarkAppearance const):
419         (WebKit::WebPageProxy::effectiveAppearanceDidChange):
420         (WebKit::WebPageProxy::showPlaybackTargetPicker):
421         (WebKit::WebPageProxy::setUseDarkAppearance): Deleted.
422         * UIProcess/WebPageProxy.h:
423         (WebKit::WebPageProxy::useDarkAppearance const): Deleted.
424         * UIProcess/mac/PageClientImplMac.h:
425         * UIProcess/mac/PageClientImplMac.mm:
426         (WebKit::PageClientImpl::effectiveAppearanceIsDark const):
427
428 2018-07-26  Sihui Liu  <sihui_liu@apple.com>
429
430         Remove a forward protocol declaration of '_WKWebViewPrintProvider'
431         https://bugs.webkit.org/show_bug.cgi?id=188012
432         <rdar://problem/42309526>
433
434         Reviewed by Darin Adler.
435
436         @procotol() expressions emit invalid protocol metadata when used with forward @protocol declarations. 
437         Clang is going to make it an error for using a forward-declared protocol in a @protocol expression, so
438         we need to stop doing this.
439
440         * UIProcess/API/Cocoa/WKWebViewInternal.h:
441
442 2018-07-26  Chris Dumez  <cdumez@apple.com>
443
444         Disable Dark Mode in the Plugin process to avoid rendering issues
445         https://bugs.webkit.org/show_bug.cgi?id=188059
446         <rdar://problem/42369281>
447
448         Reviewed by Tim Horton.
449
450         Plugins generally do not support dark mode and this causes rendering issues so
451         disable dark mode in the plugin process.
452
453         * PluginProcess/mac/PluginProcessMac.mm:
454         (WebKit::PluginProcess::platformInitializePluginProcess):
455
456 2018-07-26  Chris Dumez  <cdumez@apple.com>
457
458         WebSiteData-related methods should take in CompletionHandlers instead of Functions
459         https://bugs.webkit.org/show_bug.cgi?id=188027
460
461         Reviewed by Alex Christensen.
462
463         WebSiteData-related methods should take in CompletionHandlers instead of Functions since
464         they are need to be called and are only called once.
465
466         * UIProcess/Network/NetworkProcessProxy.cpp:
467         (WebKit::NetworkProcessProxy::fetchWebsiteData):
468         (WebKit::NetworkProcessProxy::deleteWebsiteData):
469         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
470         * UIProcess/Network/NetworkProcessProxy.h:
471         * UIProcess/Plugins/PluginProcessProxy.cpp:
472         (WebKit::PluginProcessProxy::fetchWebsiteData):
473         (WebKit::PluginProcessProxy::deleteWebsiteData):
474         (WebKit::PluginProcessProxy::deleteWebsiteDataForHostNames):
475         * UIProcess/Plugins/PluginProcessProxy.h:
476         * UIProcess/Storage/StorageProcessProxy.cpp:
477         (WebKit::StorageProcessProxy::fetchWebsiteData):
478         (WebKit::StorageProcessProxy::deleteWebsiteData):
479         (WebKit::StorageProcessProxy::deleteWebsiteDataForOrigins):
480         * UIProcess/Storage/StorageProcessProxy.h:
481         * UIProcess/WebProcessProxy.cpp:
482         (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
483         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
484         (WebKit::WebProcessProxy::fetchWebsiteData):
485         (WebKit::WebProcessProxy::deleteWebsiteData):
486         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
487         * UIProcess/WebProcessProxy.h:
488
489 2018-07-26  Miguel Gomez  <magomez@igalia.com>
490
491         [GTK][WPE] Improve the way request displayRefresh notifications
492         https://bugs.webkit.org/show_bug.cgi?id=188005
493
494         Reviewed by Žan Doberšek.
495
496         Add a new interface ThreadedDisplayRefreshMonitor::Client and use it to pipe the the
497         requestDisplayRefreshMonitorUpdate and handleDisplayRefreshMonitorUpdate to the
498         ThreadedCoordinatedLayerTreeHost.
499
500         In response to requestDisplayRefreshMonitorUpdate, the LayerTreeHost will force a layer
501         flush that in the end causes a repaint, which generates the requested display refresh
502         event.
503
504         In response to handleDisplayRefreshMonitorUpdate, the call to renderNextFrame will happen,
505         and if the DisplayRefreshMonitor has been rescheduled, renderNextFrame will also force
506         a new layer flush, causing the repaint that will generate the display refreh event.
507
508         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
509         (WebKit::ThreadedCompositor::create):
510         (WebKit::ThreadedCompositor::ThreadedCompositor):
511         (WebKit::m_displayRefreshMonitor):
512         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
513         (WebKit::ThreadedCompositor::requestDisplayRefreshMonitorUpdate): Deleted.
514         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
515         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
516         (WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
517         (WebKit::ThreadedDisplayRefreshMonitor::requestRefreshCallback):
518         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
519         (WebKit::ThreadedDisplayRefreshMonitor::invalidate):
520         (WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
521         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
522         (WebKit::ThreadedDisplayRefreshMonitor::create):
523         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
524         (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
525         (WebKit::CoordinatedLayerTreeHost::flushLayersAndForceRepaint):
526         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
527         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
528         (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
529         (WebKit::ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate):
530         (WebKit::ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate):
531         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
532
533 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
534
535         [macOS] Update sandboxes for revised OpenCL calls and streaming media
536         https://bugs.webkit.org/show_bug.cgi?id=188013
537         <rdar://problem/42594262>
538
539         Reviewed by Eric Carlson.
540
541         Testing logs from recent Mojave builds shows that OpenCL is checking more CPU-specific values as part of WebKit
542         painting operations. We need to allow these checks in the sandbox to support these more optimized drawing operations.
543
544         I also corrected some sandbox violations I found while investigating streaming media issues.
545
546         * WebProcess/com.apple.WebProcess.sb.in:
547
548 2018-07-25  Jeremy Jones  <jeremyj@apple.com>
549
550         Mask AVBackgroundView to the corner radius.
551         https://bugs.webkit.org/show_bug.cgi?id=187976
552         rdar://problem/41810866
553
554         Reviewed by Jon Lee.
555
556         This changes sets the appropriate mask to the layer so the corners look correct.
557
558         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
559         (-[WKFullscreenStackView init]):
560
561 2018-07-25  Zalan Bujtas  <zalan@apple.com>
562
563         REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes
564         https://bugs.webkit.org/show_bug.cgi?id=188018
565         <rdar://problem/42517520>
566
567         Reviewed by Dean Jackson.
568
569         * WebProcess/WebPage/WebPage.cpp:
570         (WebKit::m_credentialsMessenger):
571
572 2018-07-25  Tim Horton  <timothy_horton@apple.com>
573
574         Fix the build.
575
576         * UIProcess/mac/ServicesController.mm:
577         (WebKit::hasCompatibleServicesForItems):
578         I can't even.
579
580 2018-07-25  Tim Horton  <timothy_horton@apple.com>
581
582         Crashing on some builds that don't have async NSSharingService API
583         https://bugs.webkit.org/show_bug.cgi?id=188015
584         <rdar://problem/42593935>
585
586         Reviewed by Eric Carlson.
587
588         * UIProcess/mac/ServicesController.mm:
589         (WebKit::hasCompatibleServicesForItems):
590
591 2018-07-25  Chris Dumez  <cdumez@apple.com>
592
593         navigator.userAgent may return outdated value after webView.customUserAgent is set
594         https://bugs.webkit.org/show_bug.cgi?id=188009
595         <rdar://problem/42566456>
596
597         Reviewed by Alex Christensen.
598
599         Let the page know when the user agent changes.
600
601         * WebProcess/WebPage/WebPage.cpp:
602         (WebKit::WebPage::setUserAgent):
603
604 2018-07-25  Alex Christensen  <achristensen@webkit.org>
605
606         Use CompletionHandler for policy decisions
607         https://bugs.webkit.org/show_bug.cgi?id=187975
608
609         Reviewed by Chris Dumez.
610
611         * UIProcess/WebFramePolicyListenerProxy.cpp:
612         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
613         (WebKit::WebFramePolicyListenerProxy::use):
614         (WebKit::WebFramePolicyListenerProxy::download):
615         (WebKit::WebFramePolicyListenerProxy::ignore):
616         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
617         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
618         * UIProcess/WebFramePolicyListenerProxy.h:
619         (WebKit::WebFramePolicyListenerProxy::create):
620         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
621         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
622         (): Deleted.
623         * UIProcess/WebFrameProxy.cpp:
624         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
625         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
626         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
627         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
628         * UIProcess/WebFrameProxy.h:
629         * UIProcess/WebPageProxy.cpp:
630         (WebKit::WebPageProxy::receivedPolicyDecision):
631         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
632         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
633         (WebKit::WebPageProxy::decidePolicyForResponse):
634         * UIProcess/WebPageProxy.h:
635
636 2018-07-25  Commit Queue  <commit-queue@webkit.org>
637
638         Unreviewed, rolling out r234196.
639         https://bugs.webkit.org/show_bug.cgi?id=188011
640
641         broke API tests (Requested by alexchristensen on #webkit).
642
643         Reverted changeset:
644
645         "Use CompletionHandler for policy decisions"
646         https://bugs.webkit.org/show_bug.cgi?id=187975
647         https://trac.webkit.org/changeset/234196
648
649 2018-07-25  Alex Christensen  <achristensen@webkit.org>
650
651         Use CompletionHandler for policy decisions
652         https://bugs.webkit.org/show_bug.cgi?id=187975
653
654         Reviewed by Chris Dumez.
655
656         * UIProcess/WebFramePolicyListenerProxy.cpp:
657         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
658         (WebKit::WebFramePolicyListenerProxy::use):
659         (WebKit::WebFramePolicyListenerProxy::download):
660         (WebKit::WebFramePolicyListenerProxy::ignore):
661         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision): Deleted.
662         (WebKit::WebFramePolicyListenerProxy::setNavigation): Deleted.
663         * UIProcess/WebFramePolicyListenerProxy.h:
664         (WebKit::WebFramePolicyListenerProxy::create):
665         (WebKit::WebFramePolicyListenerProxy::policyListenerType const): Deleted.
666         (WebKit::WebFramePolicyListenerProxy::listenerID const): Deleted.
667         (): Deleted.
668         * UIProcess/WebFrameProxy.cpp:
669         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
670         (WebKit::WebFrameProxy::receivedPolicyDecision): Deleted.
671         (WebKit::WebFrameProxy::activePolicyListenerProxy): Deleted.
672         (WebKit::WebFrameProxy::changeWebsiteDataStore): Deleted.
673         * UIProcess/WebFrameProxy.h:
674         * UIProcess/WebPageProxy.cpp:
675         (WebKit::WebPageProxy::receivedPolicyDecision):
676         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
677         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
678         (WebKit::WebPageProxy::decidePolicyForResponse):
679         * UIProcess/WebPageProxy.h:
680
681 2018-07-25  Brent Fulgham  <bfulgham@apple.com>
682
683         [macOS] PluginProcess needs TCC entitlements for media capture
684         https://bugs.webkit.org/show_bug.cgi?id=187981
685         <rdar://problem/42433634>
686
687         Reviewed by Chris Dumez.
688
689         The changes needed in Bug 185526 are also needed for the plugin process, or else the UIProcess
690         (e.g., Safari) is not able to pass the user's camera/microphone access permission to the plugin process.
691
692         This patch has the following changes:
693
694         1. Rename "WebContent-OSX-restricted.entitlements" to "WebContent-or-Plugin-OSX-restricted.entitlements"
695         2. Rename "process-webcontent-entitlements.sh" to "process-webcontent-or-plugin-entitlements.sh"
696         3. Add a run-script step to the Plugin.64 and Plugin.32 builds to add the relevant entitlements.
697         4. Silence some Flash plugin sandbox exceptions triggered after activating the camera.
698
699         * Configurations/WebContent-or-Plugin-OSX-restricted.entitlements: Renamed from Source/WebKit/Configurations/WebContent-OSX-restricted.entitlements.
700         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player ESR.plugin.sb: Address sandbox violations needed by camera use.
701         * Resources/PlugInSandboxProfiles/com.macromedia.Flash Player.plugin.sb: Ditto.
702         * Scripts/process-webcontent-or-plugin-entitlements.sh: Renamed from Source/WebKit/Scripts/process-webcontent-entitlements.sh.
703         * WebKit.xcodeproj/project.pbxproj: Update for renaming, and perform entitlement steps on Plugin process.
704
705 2018-07-24  Tim Horton  <timothy_horton@apple.com>
706
707         Enable Web Content Filtering on watchOS
708         https://bugs.webkit.org/show_bug.cgi?id=187979
709         <rdar://problem/42559346>
710
711         Reviewed by Wenson Hsieh.
712
713         * Configurations/FeatureDefines.xcconfig:
714
715 2018-07-24  Aditya Keerthi  <akeerthi@apple.com>
716
717         [Datalist][macOS] Display suggestions for input[type=color]
718         https://bugs.webkit.org/show_bug.cgi?id=187794
719
720         Reviewed by Tim Horton.
721
722         An input[type=color] element that has an associated datalist element should
723         display the color values provided. We now support 1-12 suggested colors, that
724         will be displayed at the top of the color selection popover. If no suggestions
725         are specified we keep the existing default colors.
726
727         Created an NSPopoverColorWell subclass that allows custom colors to be specified
728         in the form of an NSColorList.
729
730         Also fixed a bug where an additional color well was displayed when clicking on
731         the input element.
732
733         * Shared/WebCoreArgumentCoders.cpp:
734         (IPC::ArgumentCoder<Color>::decode):
735         * Shared/WebCoreArgumentCoders.h:
736         * UIProcess/API/gtk/PageClientImpl.cpp:
737         (WebKit::PageClientImpl::createColorPicker):
738         * UIProcess/API/gtk/PageClientImpl.h:
739         * UIProcess/PageClient.h:
740         * UIProcess/WebPageProxy.cpp:
741         (WebKit::WebPageProxy::showColorPicker):
742         * UIProcess/WebPageProxy.h:
743         * UIProcess/WebPageProxy.messages.in:
744         * UIProcess/ios/PageClientImplIOS.h:
745         * UIProcess/ios/PageClientImplIOS.mm:
746         (WebKit::PageClientImpl::createColorPicker):
747         * UIProcess/mac/PageClientImplMac.h:
748         * UIProcess/mac/PageClientImplMac.mm:
749         (WebKit::PageClientImpl::createColorPicker):
750         * UIProcess/mac/WebColorPickerMac.h:
751         * UIProcess/mac/WebColorPickerMac.mm:
752         (WebKit::WebColorPickerMac::create):
753         (WebKit::WebColorPickerMac::WebColorPickerMac):
754         (WebKit::WebColorPickerMac::showColorPicker):
755         (+[WKPopoverColorWell _colorPopoverCreateIfNecessary:]):
756         (-[WKPopoverColorWell _showPopover]):
757         (-[WKPopoverColorWell setSuggestedColors:]):
758         (-[WKColorPopoverMac initWithFrame:inView:]):
759         (-[WKColorPopoverMac setAndShowPicker:withColor:suggestions:]):
760         (-[WKColorPanelMac setAndShowPicker:withColor:suggestions:]):
761         * WebProcess/WebCoreSupport/WebColorChooser.cpp:
762         (WebKit::WebColorChooser::WebColorChooser):
763         (WebKit::WebColorChooser::reattachColorChooser):
764
765 2018-07-24  Alex Christensen  <achristensen@webkit.org>
766
767         Modernize NavigationState
768         https://bugs.webkit.org/show_bug.cgi?id=187966
769
770         Reviewed by Andy Estes.
771
772         Don't ignore switch warnings any more.
773         Use BlockPtr.
774
775         * UIProcess/Cocoa/NavigationState.mm:
776         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
777         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
778
779 2018-07-24  Alex Christensen  <achristensen@webkit.org>
780
781         Remove WebFramePolicyListenerProxy::changeWebsiteDataStore
782         https://bugs.webkit.org/show_bug.cgi?id=187967
783
784         Reviewed by Andy Estes.
785
786         We need to call WebFrameProxy::changeWebsiteDataStore if the _WKWebsitePolicies has a WKWebsiteDataStore.
787         We're doing that in a weird way that is not in the right layer.  Inside the call to WebFramePolicyListenerProxy::use
788         we can inform the frame if there's a new WebsiteDataStore.
789         
790         No change in behavior, as verified by the WebKit.WebsitePoliciesDataStore API test.
791         This is a step towards using lambdas in WebFramePolicyListenerProxy.
792
793         * UIProcess/API/APINavigationClient.h:
794         (API::NavigationClient::decidePolicyForNavigationAction):
795         (API::NavigationClient::decidePolicyForNavigationResponse):
796         * UIProcess/API/APIPolicyClient.h:
797         (API::PolicyClient::decidePolicyForNavigationAction):
798         (API::PolicyClient::decidePolicyForNewWindowAction):
799         (API::PolicyClient::decidePolicyForResponse):
800         * UIProcess/API/C/WKFramePolicyListener.cpp:
801         (WKFramePolicyListenerUse):
802         (WKFramePolicyListenerUseInNewProcess):
803         (useWithPolicies):
804         * UIProcess/API/C/WKPage.cpp:
805         (WKPageSetPagePolicyClient):
806         (WKPageSetPageNavigationClient):
807         * UIProcess/Cocoa/NavigationState.mm:
808         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
809         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
810         * UIProcess/WebFramePolicyListenerProxy.cpp:
811         (WebKit::WebFramePolicyListenerProxy::use):
812         (WebKit::WebFramePolicyListenerProxy::changeWebsiteDataStore): Deleted.
813         * UIProcess/WebFramePolicyListenerProxy.h:
814         * UIProcess/WebPageProxy.cpp:
815         * UIProcess/mac/PageClientImplMac.mm:
816
817 2018-07-24  Ryan Haddad  <ryanhaddad@apple.com>
818
819         Unreviewed, rolling out r234121.
820
821         Caused perf test failures.
822
823         Reverted changeset:
824
825         "We should cache the compiled sandbox profile in a data vault"
826         https://bugs.webkit.org/show_bug.cgi?id=184991
827         https://trac.webkit.org/changeset/234121
828
829 2018-07-24  Jeff Miller  <jeffm@apple.com>
830
831         WKUIDelegate needs an alternate decideDatabaseQuotaForSecurityOrigin method that provides the database name and display name
832         https://bugs.webkit.org/show_bug.cgi?id=187567
833
834         Reviewed by Alex Christensen.
835
836         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
837         Declare alternate decideDatabaseQuotaForSecurityOrigin method, copying the existing FIXME comment
838         from the old method.
839         
840         * UIProcess/Cocoa/UIDelegate.h:
841         Add flag for new delegate method.
842         
843         * UIProcess/Cocoa/UIDelegate.mm:
844         (WebKit::UIDelegate::setDelegate):
845         Initialize new flag.
846         
847         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
848         Prefer the new UIDelegate method that takes the database name and display name, falling back to the
849         existing method if the client doesn't implement it.
850
851 2018-07-24  Stephan Szabo  <stephan.szabo@sony.com>
852
853         [WinCairo] Add support to WebView for setting tooltips
854         https://bugs.webkit.org/show_bug.cgi?id=187930
855
856         Reviewed by Fujii Hironori.
857
858         * UIProcess/win/PageClientImpl.cpp:
859         (WebKit::PageClientImpl::toolTipChanged): Set tooltip on WebView
860         * UIProcess/win/WebView.cpp:
861         (WebKit::WebView::setToolTip): Add support for updating the
862         tooltip text in Windows.
863         * UIProcess/win/WebView.h:
864
865 2018-07-24  Alex Christensen  <achristensen@webkit.org>
866
867         Reduce getters/setters in WebFramePolicyListenerProxy
868         https://bugs.webkit.org/show_bug.cgi?id=187830
869
870         Reviewed by Dean Jackson.
871
872         This is a step towards making it a lambda, which has no getters or setters.
873         No change in behavior.
874
875         setApplyPolicyInNewProcessIfPossible can be replaced by passing another parameter.
876         This bit was just piggy-backing on the WebFramePolicyListenerProxy.
877
878         isMainFrame was only used in an assert, which has a corresponding ObjC exception in
879         NavigationState::NavigationClient::decidePolicyForNavigationAction for the one relevant client.
880
881         * UIProcess/API/C/WKFramePolicyListener.cpp:
882         (WKFramePolicyListenerUseInNewProcess):
883         (useWithPolicies):
884         (WKFramePolicyListenerUseWithPolicies):
885         (WKFramePolicyListenerUseInNewProcessWithPolicies):
886         * UIProcess/Cocoa/NavigationState.mm:
887         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
888         * UIProcess/WebFramePolicyListenerProxy.cpp:
889         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision):
890         (WebKit::WebFramePolicyListenerProxy::use):
891         (WebKit::WebFramePolicyListenerProxy::download):
892         (WebKit::WebFramePolicyListenerProxy::ignore):
893         (WebKit::WebFramePolicyListenerProxy::isMainFrame const): Deleted.
894         * UIProcess/WebFramePolicyListenerProxy.h:
895         (WebKit::WebFramePolicyListenerProxy::setApplyPolicyInNewProcessIfPossible): Deleted.
896         (WebKit::WebFramePolicyListenerProxy::applyPolicyInNewProcessIfPossible const): Deleted.
897         * UIProcess/WebFrameProxy.cpp:
898         (WebKit::WebFrameProxy::receivedPolicyDecision):
899         * UIProcess/WebFrameProxy.h:
900         * UIProcess/WebPageProxy.cpp:
901         (WebKit::WebPageProxy::receivedPolicyDecision):
902         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
903         * UIProcess/WebPageProxy.h:
904         * UIProcess/WebProcessPool.cpp:
905         (WebKit::WebProcessPool::processForNavigation):
906         (WebKit::WebProcessPool::processForNavigationInternal):
907         * UIProcess/WebProcessPool.h:
908
909 2018-07-24  Alex Christensen  <achristensen@webkit.org>
910
911         Remove WebFramePolicyListenerProxy::invalidate
912         https://bugs.webkit.org/show_bug.cgi?id=187833
913
914         Reviewed by Dean Jackson.
915
916         When we're invalidating the listener, calling ignore instead will at worst cause
917         an ignored message to be sent.  The load will be cancelled either way.
918         Removing the invalidate method gets it closer to being a lambda.
919
920         * UIProcess/WebFramePolicyListenerProxy.cpp:
921         (WebKit::WebFramePolicyListenerProxy::invalidate): Deleted.
922         * UIProcess/WebFramePolicyListenerProxy.h:
923         * UIProcess/WebFrameProxy.cpp:
924         (WebKit::WebFrameProxy::webProcessWillShutDown):
925         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
926
927 2018-07-24  Chris Dumez  <cdumez@apple.com>
928
929         WebFullScreenManagerProxy does not need to be ref counted
930         https://bugs.webkit.org/show_bug.cgi?id=187928
931
932         Reviewed by Eric Carlson.
933
934         WebFullScreenManagerProxy does not need to be ref counted, it is owned by WebPageProxy.
935         It is also error-prone because WebFullScreenManagerProxy has a raw pointer to its WebPageProxy
936         and anybody could extend the lifetime of the WebFullScreenManagerProxy by refing it, which
937         would make the WebPageProxy pointer stale.
938
939         * UIProcess/WebFullScreenManagerProxy.cpp:
940         (WebKit::WebFullScreenManagerProxy::WebFullScreenManagerProxy):
941         (WebKit::WebFullScreenManagerProxy::willEnterFullScreen):
942         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
943         (WebKit::WebFullScreenManagerProxy::willExitFullScreen):
944         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
945         (WebKit::WebFullScreenManagerProxy::setAnimatingFullScreen):
946         (WebKit::WebFullScreenManagerProxy::requestExitFullScreen):
947         (WebKit::WebFullScreenManagerProxy::saveScrollPosition):
948         (WebKit::WebFullScreenManagerProxy::restoreScrollPosition):
949         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
950         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
951         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
952         (WebKit::WebFullScreenManagerProxy::invalidate):
953         * UIProcess/WebFullScreenManagerProxy.h:
954         * UIProcess/WebPageProxy.cpp:
955         (WebKit::m_resetRecentCrashCountTimer):
956         (WebKit::WebPageProxy::reattachToWebProcess):
957         * UIProcess/WebPageProxy.h:
958
959 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
960
961         [TextureMapper] Separate repaint counter state from debug visuals
962         https://bugs.webkit.org/show_bug.cgi?id=187946
963
964         Reviewed by Carlos Garcia Campos.
965
966         Instead of managing the repaint counter visibility along with the
967         debug border visuals, do that together with the repaint count value.
968
969         In the CoordinatedGraphicsScene class, remove the helper
970         setLayerRepaintCountIfNeeded() method that's only been called in one
971         place, and instead set the repaint count information on the
972         TextureMapperLayer object directly from setLayerState(). The repaint
973         counter visiblity and count value are gathered from the new struct
974         that's kept on the CoordinatedGraphicsLayerState object.
975
976         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
977         (WebKit::CoordinatedGraphicsScene::setLayerState):
978         (WebKit::CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded): Deleted.
979         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
980
981 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
982
983         [WPE][GTK] Implement WebRTC based on libwebrtc
984         https://bugs.webkit.org/show_bug.cgi?id=186932
985
986         Reviewed by Philippe Normand.
987
988         * WebProcess/Network/webrtc/LibWebRTCProvider.h: Use LibWebRTCProviderGlib when building WPE or GTK ports.
989
990 2018-07-23  Stephan Szabo  <stephan.szabo@sony.com>
991
992         [WinCairo] Add implementation for setting cursors
993         https://bugs.webkit.org/show_bug.cgi?id=187868
994
995         Reviewed by Fujii Hironori.
996
997         * UIProcess/win/PageClientImpl.cpp:
998         (WebKit::PageClientImpl::setCursor): Set cursor on the webview
999         * UIProcess/win/WebView.cpp:
1000         (WebKit::WebView::setCursor): Add implementation to set the
1001         web cursor to update the Windows cursor
1002         * UIProcess/win/WebView.h:
1003
1004 2018-07-23  Jeremy Jones  <jeremyj@apple.com>
1005
1006         Crash when loadViewIfRequired called while WKFullScreenViewController is being deallocated.
1007         https://bugs.webkit.org/show_bug.cgi?id=187920
1008         rdar://problem/41324023
1009
1010         Reviewed by Eric Carlson.
1011
1012         Clear dangling weak-ref.
1013         Prevent async playback state calls from instantiating the interface.
1014         Release WKFullScreenViewController when it is no longer needed.
1015
1016         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1017         (-[WKFullScreenViewController dealloc]):
1018         (-[WKFullScreenViewController setPlaying:]):
1019         (-[WKFullScreenViewController setAnimating:]):
1020         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1021         (-[WKFullScreenWindowController _completedExitFullScreen]):
1022
1023 2018-07-23  Timothy Horton  <timothy_horton@apple.com>
1024
1025         Try to fix the build.
1026
1027         * UIProcess/mac/ServicesController.mm:
1028         (WebKit::hasCompatibleServicesForItems):
1029
1030 2018-07-23  Ben Richards  <benton_richards@apple.com>
1031
1032         We should cache the compiled sandbox profile in a data vault
1033         https://bugs.webkit.org/show_bug.cgi?id=184991
1034
1035         Reviewed by Ryosuke Niwa.
1036
1037         This patch changes a few things (note: data vaults and sandbox entitlements are only used in internal builds):
1038         (1) Instead of compiling a sandbox every time a process is launched, processes now look for a cached sandbox
1039             in a process specific data vault on macOS platforms. (ChildProcessMac.mm)
1040         (2) If a valid cached sandbox is not found, a process will create the data vault (or ensure that it exists),
1041             compile a sandbox, and cache it.
1042         (3) In order to create process specific data vaults, each process now has their own <process name>-OSX-sandbox.entitlements
1043             file which contains an entitlement with a process specific "storage class" which ensures that each process
1044             can only ever access its own data vault. (See the article on confluence "Data Vaults and Restricted Files" for more info)
1045         (4) The sandbox entitlements file for the Network, WebContent and Plugin services are loaded dynamically
1046             through Scripts/<process name>-process-entitlements.sh which is triggered in a new build phase for each service.
1047             The Storage process sandbox entitlements are loaded directly in Configurations/StorageService.xcconfig.
1048             The reason that the sandbox entitlements are applied dynamically is so that these sandbox entitlements
1049             are only applied when WK_USE_RESTRICTED_ENTITLEMENTS is YES. This means that open source builds will still work.
1050
1051         * Configurations/Network-OSX-sandbox.entitlements: Added.
1052         * Configurations/Plugin-OSX-sandbox.entitlements: Added.
1053         * Configurations/Storage-OSX-sandbox.entitlements: Added.
1054         * Configurations/StorageService.xcconfig:
1055         * Configurations/WebContent-OSX-sandbox.entitlements: Added.
1056         * Configurations/WebKit.xcconfig:
1057         * NetworkProcess/NetworkProcess.h:
1058         * PluginProcess/PluginProcess.h:
1059         * Scripts/process-network-entitlements.sh: Added.
1060         * Scripts/process-plugin-entitlements.sh: Added.
1061         * Scripts/process-webcontent-entitlements.sh:
1062         * Shared/ChildProcess.h:
1063         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1064         (WebKit::XPCServiceInitializer):
1065         * Shared/SandboxInitializationParameters.h:
1066         (WebKit::SandboxInitializationParameters::setOverrideSandboxProfilePath):
1067         (WebKit::SandboxInitializationParameters::overrideSandboxProfilePath const):
1068         (WebKit::SandboxInitializationParameters::setSandboxProfile):
1069         (WebKit::SandboxInitializationParameters::sandboxProfile const):
1070         (): Deleted.
1071         * Shared/mac/ChildProcessMac.mm:
1072         (WebKit::SandboxProfileDeleter::operator()):
1073         (WebKit::SandboxParametersDeleter::operator()):
1074         (WebKit::SandboxInfo::SandboxInfo):
1075         (WebKit::fileContents):
1076         (WebKit::processStorageClass):
1077         (WebKit::setAndSerializeSandboxParameters):
1078         (WebKit::getUserCacheDirectory):
1079         (WebKit::sandboxDataVaultParentDirectory):
1080         (WebKit::sandboxDirectory):
1081         (WebKit::sandboxFilePath):
1082         (WebKit::ensureSandboxCacheDirectory):
1083         (WebKit::writeSandboxDataToCacheFile):
1084         (WebKit::compileAndCacheSandboxProfile):
1085         (WebKit::tryApplyCachedSandbox):
1086         (WebKit::webKit2Bundle):
1087         (WebKit::sandboxProfilePath):
1088         (WebKit::compileAndApplySandboxSlowCase):
1089         (WebKit::applySandbox):
1090         (WebKit::initializeSandboxParameters):
1091         (WebKit::ChildProcess::initializeSandbox):
1092         * Shared/mac/SandboxInitialiationParametersMac.mm:
1093         (WebKit::SandboxInitializationParameters::SandboxInitializationParameters):
1094         * StorageProcess/StorageProcess.h:
1095         * WebKit.xcodeproj/project.pbxproj:
1096         * WebProcess/WebProcess.h:
1097
1098 2018-07-23  Tim Horton  <timothy_horton@apple.com>
1099
1100         Creating and loading content in a WKWebView triggers Main Thread Checker warnings under ServicesController
1101         https://bugs.webkit.org/show_bug.cgi?id=186963
1102         <rdar://problem/41393682>
1103
1104         Reviewed by Timothy Hatcher.
1105
1106         * UIProcess/mac/ServicesController.h:
1107         * UIProcess/mac/ServicesController.mm:
1108         (WebKit::hasCompatibleServicesForItems):
1109         (WebKit::ServicesController::refreshExistingServices):
1110         Adopt async ShareKit SPI that is actually thread-safe instead of the not-quite-safe
1111         synchronous API. Request all three sets of services immediately, and dispatch
1112         to the Web Content processes when all three have returned.
1113
1114 2018-07-23  Chris Dumez  <cdumez@apple.com>
1115
1116         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
1117         https://bugs.webkit.org/show_bug.cgi?id=187910
1118         <rdar://problem/42356526>
1119
1120         Reviewed by Brent Fulgham.
1121
1122         The WebResourceLoadStatisticsStore was only removing itself as a MessageReceiver from the WebProcessProxy
1123         and that WebProcessProxy's connection was getting closed. However, it is possible for the
1124         WebResourceLoadStatisticsStore to get destroyed before this happens. This would lead to crashes such as
1125         the one in <rdar://problem/42356526>.
1126
1127         To address the issue, we let the WebsiteDataStore take care of registering / unregistering the
1128         WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy. This is more reliable since
1129         the WebsiteDataStore is the one that subclasses WebProcessLifetimeObserver. Make sure the
1130         WebResourceLoadStatisticsStore is removed as a MessageReceiver whenever the WebsiteDataStore is destroyed
1131         or WebsiteDataStore::m_resourceLoadStatistics gets cleared.
1132
1133         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1134         * UIProcess/WebResourceLoadStatisticsStore.h:
1135         Drop logic to add / remove the WebResourceLoadStatisticsStore as a receiver now that the
1136         WebsiteDataStore takes care of it.
1137
1138         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1139         (WebKit::WebsiteDataStore::~WebsiteDataStore):
1140         Make sure the WebResourceLoadStatisticsStore gets unregistered as a MessageReceiver from all associated
1141         WebProcessProxy objects when the WebsiteDataStore gets destroyed.
1142
1143         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
1144         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
1145         Register / Unregister the WebResourceLoadStatisticsStore as a MessageReceiver with the WebProcessProxy.
1146
1147         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
1148         Make sure we unregister the WebResourceLoadStatisticsStore as a MessageReceiver with all associated
1149         WebProcessProxy objects before we clear m_resourceLoadStatistics as this will causes the
1150         WebResourceLoadStatisticsStore to get destroyed.
1151
1152         (WebKit::WebsiteDataStore::unregisterWebResourceLoadStatisticsStoreAsMessageReceiver):
1153         (WebKit::WebsiteDataStore::registerWebResourceLoadStatisticsStoreAsMessageReceiver):
1154         Add utility functions to register / unregister WebResourceLoadStatisticsStore as a MessageReceiver with
1155         all associated WebProcessProxy objects.
1156
1157         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1158         Register the new WebResourceLoadStatisticsStore as a MessageReceiver with all associated WebProcessProxy
1159         objects in case setResourceLoadStatisticsEnabled(true) gets called *after* we've already started
1160         WebProcesses.
1161
1162         * UIProcess/WebsiteData/WebsiteDataStore.h:
1163
1164 2018-07-23  John Wilander  <wilander@apple.com>
1165
1166         Resource Load Statistics: Add logging of Storage Access API use in experimental debug mode
1167         https://bugs.webkit.org/show_bug.cgi?id=187918
1168         <rdar://problem/42509062>
1169
1170         Reviewed by Jiewen Tan.
1171
1172         Tested manually by looking at log output.
1173
1174         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1175         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1176             This is just a clean-up change.
1177         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
1178         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1179             Both these now log proper info in debug mode.
1180
1181 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
1182
1183         [iOS] Add support for input[type=color]
1184         https://bugs.webkit.org/show_bug.cgi?id=187871
1185
1186         Reviewed by Tim Horton.
1187
1188         Created WKFormColorControl to display a color picker once a color input gains
1189         focus. The control is presented as an inputView on iPhone and as a popover on
1190         iPad. The picker itself consists of two color matrices. The first is a set of 12
1191         default colors, displayed on the top row of the picker. In a subsequent patch,
1192         this top row will be made customizable through the use of the datalist element.
1193         The second matrix is a grid of 120 colors, provided by the system. Colors can be
1194         selected from either matrix by tapping or with a pan gesture.
1195
1196         WKColorMatrixView represents a single color matrix and is comprised of
1197         WKColorButtons that represent each color in the matrix.
1198
1199         * Shared/AssistedNodeInformation.h:
1200         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
1201         * UIProcess/ios/PageClientImplIOS.h:
1202         * UIProcess/ios/PageClientImplIOS.mm:
1203         (WebKit::PageClientImpl::createColorPicker):
1204         * UIProcess/ios/WKContentViewInteraction.mm:
1205         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
1206         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
1207         (-[WKContentView inputView]):
1208         (-[WKContentView requiresAccessoryView]):
1209         (isAssistableInputType):
1210         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1211         (-[WKContentView actionNameForFocusedFormControlView:]):
1212         * UIProcess/ios/forms/WKFormColorControl.h: Added.
1213         * UIProcess/ios/forms/WKFormColorControl.mm: Added.
1214         (-[WKColorPopover initWithView:]):
1215         (-[WKColorPopover controlView]):
1216         (-[WKColorPopover controlBeginEditing]):
1217         (-[WKColorPopover controlEndEditing]):
1218         (-[WKFormColorControl initWithView:]):
1219         (-[WKFormColorControl assistantView]):
1220         (-[WKFormColorControl beginEditing]):
1221         (-[WKFormColorControl endEditing]):
1222         * UIProcess/ios/forms/WKFormColorPicker.h: Added.
1223         * UIProcess/ios/forms/WKFormColorPicker.mm: Added.
1224         (+[WKColorButton colorButtonWithColor:]):
1225         (-[WKColorMatrixView initWithFrame:]):
1226         (-[WKColorMatrixView initWithFrame:colorMatrix:]):
1227         (-[WKColorMatrixView layoutSubviews]):
1228         (-[WKColorMatrixView colorButtonTapped:]):
1229         (+[WKColorPicker defaultTopColorMatrix]):
1230         (-[WKColorPicker initWithView:]):
1231         (-[WKColorPicker setControlValueFromUIColor:]):
1232         (-[WKColorPicker controlView]):
1233         (-[WKColorPicker controlBeginEditing]):
1234         (-[WKColorPicker controlEndEditing]):
1235         (-[WKColorPicker colorMatrixView:didTapColorButton:]):
1236         (-[WKColorPicker didPanColors:]):
1237         * WebKit.xcodeproj/project.pbxproj:
1238         * WebProcess/WebPage/ios/WebPageIOS.mm:
1239         (WebKit::isAssistableElement):
1240         (WebKit::WebPage::getAssistedNodeInformation):
1241
1242 2018-07-23  Stephan Szabo  <stephan.szabo@sony.com>
1243
1244         [WinCairo] Fix detection of held modifier keys for key events
1245         https://bugs.webkit.org/show_bug.cgi?id=187862
1246
1247         Reviewed by Fujii Hironori.
1248
1249         * Shared/win/WebEventFactory.cpp:
1250         (WebKit::IsKeyInDownState): Use requested modifier not VK_MENU
1251
1252 2018-07-20  Jer Noble  <jer.noble@apple.com>
1253
1254         REGRESSION(r233925): Can't go into PiP twice
1255         https://bugs.webkit.org/show_bug.cgi?id=187876
1256         <rdar://problem/42444520>
1257
1258         Reviewed by Jon Lee.
1259
1260         We fail to enter PiP the second time because the video fullscreen interface no longer has a
1261         model, and so gives a contentSize of 0x0. This happens because we disassociate the
1262         interface from the model in didCleanupFullscreen. However, the interface and model can still
1263         be re-used if they're kept alive by another client. We should delay disassociating the model
1264         from the interface until just before the model is destroyed in removeClientForContext.
1265
1266         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1267         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
1268         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
1269
1270 2018-07-20  John Wilander  <wilander@apple.com>
1271
1272         Resource Load Statistics: Enable basic functionality in experimental debug mode
1273         https://bugs.webkit.org/show_bug.cgi?id=187835
1274         <rdar://problem/42408590>
1275
1276         Reviewed by Chris Dumez.
1277
1278         This patch makes the experimental ITP Debug Mode feature work, at least
1279         to a basic level. This means:
1280         - Debug logging on the INFO level.
1281         - Permanently treat 3rdpartytestwebkit.org as a prevalent resource.
1282         - Support manual setting of a custom permanently prevalent resource through user
1283           defaults on Cocoa platforms.
1284
1285         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1286         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
1287         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
1288             Test infrastructure.
1289         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1290         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
1291         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
1292             Used to pick up custom set prevalent resource on Cocoa platforms (for debug mode).
1293         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1294         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
1295         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
1296             Now skips processing of debug mode prevalent resources so that they
1297             stay prevalent.
1298         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
1299             Convenience function to make 3rdpartytestwebkit.org and any custom domain
1300             set through ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
1301             be prevalent resources.
1302         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
1303         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
1304             Sets a custom domain to always be treated as prevalent in debug mode.
1305         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
1306             Now makes sure 3rdpartytestwebkit.org and any custom domain set through
1307             ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
1308             are prevalent resources even after a clear of the store.
1309         (WebKit::debugLogDomainsInBatches):
1310             We may have too many domain names to fit in a single log statement.
1311             This function logs them in batches of 50, if we have more than 50.
1312         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
1313             Now makes use of debugLogDomainsInBatches() in debug mode.
1314         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
1315         (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const):
1316         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1317         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1318             Now accepts a non-empty memory store in debug mode. This is to support a
1319             pre-populated store with 3rdpartytestwebkit.org and any custom domain already
1320             set as prevalent.
1321         (WebKit::ResourceLoadStatisticsPersistentStorage::setResourceLoadStatisticsDebugMode):
1322         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1323         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
1324         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
1325         * UIProcess/WebResourceLoadStatisticsStore.h:
1326         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1327         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
1328         * UIProcess/WebsiteData/WebsiteDataStore.h:
1329
1330 2018-07-20  Tim Horton  <timothy_horton@apple.com>
1331
1332         Occasional crash under -[WKFormInputSession setSuggestions:]
1333         https://bugs.webkit.org/show_bug.cgi?id=187869
1334         <rdar://problem/41357063>
1335
1336         Reviewed by Dean Jackson.
1337
1338         * UIProcess/ios/WKContentViewInteraction.h:
1339         * UIProcess/ios/WKContentViewInteraction.mm:
1340         (-[WKContentView inputDelegate]):
1341         Make inputDelegate weak.
1342
1343 2018-07-20  Brent Fulgham  <bfulgham@apple.com>
1344
1345         [macOS] Relax WebKit sandbox to permit proper App Store behavior
1346         https://bugs.webkit.org/show_bug.cgi?id=187831
1347         <rdar://problem/42047455>
1348
1349         Reviewed by Alexey Proskuryakov.
1350
1351         The Mac App Store is unable to perform some gift card redemption tasks on macOS due to missing sandbox permissions.
1352         This patch adds those permissions.
1353
1354         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1355
1356 2018-07-20  Brady Eidson  <beidson@apple.com>
1357
1358         Add WKNavigation/WKNavigationAction related SPI.
1359         https://bugs.webkit.org/show_bug.cgi?id=187826
1360
1361         Reviewed by Chris Dumez.
1362
1363         * UIProcess/API/APINavigationAction.h:
1364
1365         * UIProcess/API/C/mac/WKPagePrivateMac.h:
1366         * UIProcess/API/C/mac/WKPagePrivateMac.mm:
1367         (WKPageLoadURLRequestReturningNavigation):
1368
1369         * UIProcess/API/Cocoa/WKNavigationAction.mm:
1370         (-[WKNavigationAction _mainFrameNavigation]):
1371         * UIProcess/API/Cocoa/WKNavigationActionPrivate.h:
1372
1373         * UIProcess/API/glib/WebKitUIClient.cpp:
1374
1375         * UIProcess/WebPageProxy.cpp:
1376         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1377         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1378
1379 2018-07-20  Philippe Normand  <pnormand@igalia.com>
1380
1381         [GTK][WPE] enable-media-capabilities websetting
1382         https://bugs.webkit.org/show_bug.cgi?id=187847
1383
1384         Reviewed by Carlos Garcia Campos.
1385
1386         Add a new WebKitSetting for the MediaCapabilities spec defined in:
1387         https://wicg.github.io/media-capabilities/
1388
1389         * UIProcess/API/glib/WebKitSettings.cpp:
1390         (webKitSettingsSetProperty):
1391         (webKitSettingsGetProperty):
1392         (webkit_settings_class_init):
1393         (webkit_settings_get_enable_media_capabilities):
1394         (webkit_settings_set_enable_media_capabilities):
1395         * UIProcess/API/gtk/WebKitSettings.h:
1396         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1397         * UIProcess/API/wpe/WebKitSettings.h:
1398
1399 2018-07-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1400
1401         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.5 release.
1402
1403         * gtk/NEWS: Add release notes for 2.21.5.
1404         * webkitglib-symbols.map: Remove symbols.
1405
1406 2018-07-19  Chris Dumez  <cdumez@apple.com>
1407
1408         Null pointer dereference under WebPage::autofillLoginCredentials()
1409         https://bugs.webkit.org/show_bug.cgi?id=187823
1410         <rdar://problem/37152195>
1411
1412         Reviewed by David Kilzer.
1413
1414         Deal with m_assistedNode being null under WebPage::autofillLoginCredentials().
1415
1416         * WebProcess/WebPage/ios/WebPageIOS.mm:
1417         (WebKit::WebPage::autofillLoginCredentials):
1418
1419 2018-07-19  Chris Dumez  <cdumez@apple.com>
1420
1421         [ITP] Crash under ResourceLoadStatisticsMemoryStore::removeDataRecords()
1422         https://bugs.webkit.org/show_bug.cgi?id=187821
1423         <rdar://problem/42112693>
1424
1425         Reviewed by David Kilzer.
1426
1427         In two cases, ResourceLoadStatisticsMemoryStore (which lives on a background queue) needs to call WebPageProxy
1428         operations on the main thread and then dispatch back on the background queue when the operation completes.
1429         However, it is possible for the ResourceLoadStatisticsMemoryStore to get destroyed on the background queue
1430         during this time and we would then crash when trying to use m_workQueue to re-dispatch. To address the issue,
1431         I now ref the work queue in the lambda so that we're guaranteed to be able to re-dispatch to the background
1432         queue. When we're back on the background queue, we'll realize that weakThis in gone and we'll call the callback
1433         and return early.
1434
1435         Note that I am not checking weakThis on the main thread as this would not be safe. weakThis should only be
1436         used on the background queue.
1437
1438         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1439         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1440         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
1441
1442 2018-07-19  Fujii Hironori  <Hironori.Fujii@sony.com>
1443
1444         Move WebFrameListenerProxy to WebFramePolicyListenerProxy, its only subclass
1445         https://bugs.webkit.org/show_bug.cgi?id=187825
1446         <rdar://problem/42405081>
1447
1448         Unreviewed build fix for Windows port.
1449
1450         RefPtr.h(45): error C2027: use of undefined type 'API::Navigation'
1451
1452         * UIProcess/win/WebInspectorProxyWin.cpp: Include "APINavigation.h".
1453
1454 2018-07-19  Alex Christensen  <achristensen@webkit.org>
1455
1456         Move WebFrameListenerProxy to WebFramePolicyListenerProxy, its only subclass
1457         https://bugs.webkit.org/show_bug.cgi?id=187825
1458
1459         Reviewed by Brady Eidson.
1460
1461         * CMakeLists.txt:
1462         * UIProcess/API/C/WKPage.cpp:
1463         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1464         * UIProcess/Automation/WebAutomationSession.cpp:
1465         * UIProcess/Cocoa/WebViewImpl.mm:
1466         * UIProcess/RemoteWebInspectorProxy.cpp:
1467         * UIProcess/WebFormSubmissionListenerProxy.h:
1468         (WebKit::WebFormSubmissionListenerProxy::create):
1469         (WebKit::WebFormSubmissionListenerProxy::WebFormSubmissionListenerProxy):
1470         * UIProcess/WebFrameListenerProxy.cpp: Removed.
1471         * UIProcess/WebFrameListenerProxy.h: Removed.
1472         * UIProcess/WebFramePolicyListenerProxy.cpp:
1473         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
1474         (WebKit::WebFramePolicyListenerProxy::receivedPolicyDecision):
1475         (WebKit::WebFramePolicyListenerProxy::changeWebsiteDataStore):
1476         (WebKit::WebFramePolicyListenerProxy::invalidate):
1477         (WebKit::WebFramePolicyListenerProxy::isMainFrame const):
1478         (WebKit::WebFramePolicyListenerProxy::setNavigation):
1479         * UIProcess/WebFramePolicyListenerProxy.h:
1480         (WebKit::WebFramePolicyListenerProxy::listenerID const):
1481         (WebKit::WebFramePolicyListenerProxy::operator new): Deleted.
1482         * UIProcess/WebFrameProxy.cpp:
1483         (WebKit::WebFrameProxy::activePolicyListenerProxy):
1484         * UIProcess/WebFrameProxy.h:
1485         * UIProcess/WebInspectorProxy.cpp:
1486         * UIProcess/WebProcessPool.cpp:
1487         * UIProcess/ios/ViewGestureControllerIOS.mm:
1488         * UIProcess/mac/ViewGestureControllerMac.mm:
1489         * UIProcess/mac/WKInspectorViewController.mm:
1490         * WebKit.xcodeproj/project.pbxproj:
1491
1492 2018-07-19  Jon Lee  <jonlee@apple.com>
1493
1494         Update iOS fullscreen alert text again
1495         https://bugs.webkit.org/show_bug.cgi?id=187797
1496         rdar://problem/42373783
1497
1498         Reviewed by Jer Noble.
1499
1500         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1501         (-[WKFullScreenViewController _showPhishingAlert]):
1502
1503 2018-07-19  Brady Eidson  <beidson@apple.com>
1504
1505         Add an SPI policy action to allow clients to explicitly ask for a new process on a navigation.
1506         https://bugs.webkit.org/show_bug.cgi?id=187789
1507
1508         Reviewed by Andy Estes.
1509
1510         At navigation policy time, when a client says "use/allow", they can now say "use/allow in a new process if possible"
1511
1512         * UIProcess/API/C/WKFramePolicyListener.cpp:
1513         (WKFramePolicyListenerUseInNewProcess):
1514         (WKFramePolicyListenerUseInNewProcessWithPolicies):
1515         * UIProcess/API/C/WKFramePolicyListener.h:
1516
1517         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
1518
1519         * UIProcess/Cocoa/NavigationState.mm:
1520         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1521
1522         * UIProcess/WebFrameListenerProxy.h:
1523         (WebKit::WebFrameListenerProxy::setApplyPolicyInNewProcessIfPossible):
1524         (WebKit::WebFrameListenerProxy::applyPolicyInNewProcessIfPossible const):
1525
1526         * UIProcess/WebPageProxy.cpp:
1527         (WebKit::WebPageProxy::receivedPolicyDecision):
1528
1529         * UIProcess/WebProcessPool.cpp:
1530         (WebKit::WebProcessPool::processForNavigation):
1531         (WebKit::WebProcessPool::processForNavigationInternal):
1532         * UIProcess/WebProcessPool.h:
1533
1534 2018-07-19  Youenn Fablet  <youenn@apple.com>
1535
1536         Ensure experimentalPlugInSandboxProfilesEnabled is set on PluginProcess
1537         https://bugs.webkit.org/show_bug.cgi?id=187729
1538
1539         Reviewed by Ryosuke Niwa.
1540
1541         experimentalPlugInSandboxProfilesEnabled flag is used at initialization of the plugin process sandbox.
1542         This flag value should be set according to the value of this flag in the UIProcess.
1543         We set this value in the plugin process manager.
1544         At launch of the plugin process, this flag will also be passed to it so that it is set properly.
1545
1546         * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
1547         (WebKit::PluginServiceInitializerDelegate::getExtraInitializationData):
1548         * PluginProcess/mac/PluginProcessMac.mm:
1549         (WebKit::PluginProcess::platformInitializeProcess):
1550         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1551         * UIProcess/API/C/WKPreferences.cpp:
1552         (WKPreferencesSetPluginSandboxProfilesEnabledForAllPlugins):
1553         (WKPreferencesGetPluginSandboxProfilesEnabledForAllPlugins):
1554         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1555         * UIProcess/API/Cocoa/WKPreferences.mm:
1556         (-[WKPreferences _setExperimentalPlugInSandboxProfilesEnabled:]):
1557         (-[WKPreferences _experimentalPlugInSandboxProfilesEnabled]):
1558         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1559         * UIProcess/Plugins/PluginProcessManager.h:
1560         (WebKit::PluginProcessManager::experimentalPlugInSandboxProfilesEnabled const):
1561         * UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
1562         (WebKit::PluginProcessManager::setExperimentalPlugInSandboxProfilesEnabled):
1563         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1564         (WebKit::PluginProcessProxy::platformGetLaunchOptions):
1565
1566 2018-07-18  Ricky Mondello  <rmondello@apple.com>
1567
1568         Let clients override _WKThumbnailView's background color
1569
1570         https://bugs.webkit.org/show_bug.cgi?id=187788
1571
1572         Reviewed by Tim Horton.
1573
1574         * UIProcess/API/Cocoa/_WKThumbnailView.h: Declare a property.
1575         * UIProcess/API/Cocoa/_WKThumbnailView.mm: Define an ivar.
1576         (-[_WKThumbnailView updateLayer]): Consult the background color.
1577         (-[_WKThumbnailView setOverrideBackgroundColor:]): Notably, call -updateLayer.
1578         (-[_WKThumbnailView overrideBackgroundColor]): Added.
1579
1580 2018-07-18  Jer Noble  <jer.noble@apple.com>
1581
1582         CRASH at WebKit: WebKit::WebFullScreenManagerProxy::saveScrollPosition
1583         https://bugs.webkit.org/show_bug.cgi?id=187769
1584         <rdar://problem/42160666>
1585
1586         Reviewed by Tim Horton.
1587
1588         Null-check all uses of _page and _manager in WKFullScreenWindowControllerIOS.
1589
1590         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1591         (WebKit::WKWebViewState::applyTo):
1592         (WebKit::WKWebViewState::store):
1593         (-[WKFullScreenWindowController enterFullScreen]):
1594         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1595         (-[WKFullScreenWindowController _completedExitFullScreen]):
1596
1597 2018-07-18  Chris Dumez  <cdumez@apple.com>
1598
1599         WebContent crash in WebProcess::ensureNetworkProcessConnection
1600         https://bugs.webkit.org/show_bug.cgi?id=187791
1601         <rdar://problem/41995022>
1602
1603         Reviewed by Ryosuke Niwa.
1604
1605         If the WebProcessProxy::GetNetworkProcessConnection synchronous IPC between the WebProcess
1606         and the UIProcess succeeded but we received an invalid connection identifier, then try
1607         once more. This may indicate the network process has crashed, in which case it will be
1608         relaunched.
1609
1610         * WebProcess/WebProcess.cpp:
1611         (WebKit::getNetworkProcessConnection):
1612         (WebKit::WebProcess::ensureNetworkProcessConnection):
1613
1614 2018-07-18  Per Arne Vollan  <pvollan@apple.com>
1615
1616         The WebContent process does not suspend when MiniBrowser is minimized.
1617         https://bugs.webkit.org/show_bug.cgi?id=187708
1618
1619         Reviewed by Chris Dumez.
1620
1621         Using the NSRunLoop runloop type prevents the WebContent process from suspending. Instead, use the new
1622         _WebKit runloop type. Also do not leak a boost to the WebContent process, since this also prevents the
1623         WebContent process from going to sleep. Calling SetApplicationIsDaemon prevents the WebContent process
1624         from being assigned the application process priority level. To block WindowServer connections, call
1625         CGSSetDenyWindowServerConnections(true) instead. Finally, App nap must be manually enabled, since the
1626         WebContent process is no longer a NSApplication.
1627
1628         * Configurations/WebContentService.xcconfig:
1629         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1630         (WebKit::shouldLeakBoost):
1631         * WebProcess/WebPage/WebPage.cpp:
1632         (WebKit::WebPage::updateThrottleState):
1633         * WebProcess/cocoa/WebProcessCocoa.mm:
1634         (WebKit::WebProcess::platformInitializeProcess):
1635
1636 2018-07-18  Chris Dumez  <cdumez@apple.com>
1637
1638         Crash under WebKit::SuspendedPageProxy::webProcessDidClose(WebKit::WebProcessProxy&)
1639         https://bugs.webkit.org/show_bug.cgi?id=187780
1640
1641         Reviewed by Brady Eidson.
1642
1643         Protect |this| in SuspendedPageProxy::webProcessDidClose() since the call to
1644         WebPageProxy::suspendedPageClosed() may destroy us before the method is done
1645         executing.
1646
1647         * UIProcess/SuspendedPageProxy.cpp:
1648         (WebKit::SuspendedPageProxy::webProcessDidClose):
1649
1650 2018-07-18  Jer Noble  <jer.noble@apple.com>
1651
1652         -_beginAnimatedResizeWithUpdates: can leave view in bad state if called during an existing animation
1653         https://bugs.webkit.org/show_bug.cgi?id=187739
1654
1655         Reviewed by Tim Horton.
1656
1657         It's not enough to reset _dynamicViewportUpdateMode to NotResizing; other parts of the code
1658         check whether _resizeAnimationView is non-nil, the contentView may be hidden, etc. Add a new
1659         internal method _cancelAnimatedResize that cleans up state when a call to
1660         _beginAnimatedResizeWithUpdates: fails.
1661
1662         * UIProcess/API/Cocoa/WKWebView.mm:
1663         (-[WKWebView _processDidExit]):
1664         (-[WKWebView _cancelAnimatedResize]):
1665         (-[WKWebView _didCompleteAnimatedResize]):
1666         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
1667
1668 2018-07-18  Jer Noble  <jer.noble@apple.com>
1669
1670         PiP from Element Fullscreen should match AVKit's behavior
1671         https://bugs.webkit.org/show_bug.cgi?id=187623
1672
1673         Reviewed by Jon Lee.
1674
1675         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1676         (WebKit::PlaybackSessionManagerProxy::controlsManagerContextId const):
1677         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1678         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1679         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
1680         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
1681         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
1682         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
1683         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
1684         (WebKit::VideoFullscreenModelContext::failedToExitPictureInPicture):
1685         (WebKit::VideoFullscreenManagerProxy::controlsManagerInterface):
1686         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1687         (WKFullScreenViewControllerVideoFullscreenModelClient::setParent):
1688         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
1689         (WKFullScreenViewControllerVideoFullscreenModelClient::interface const):
1690         (-[WKFullScreenViewController initWithWebView:]):
1691         (-[WKFullScreenViewController dealloc]):
1692         (-[WKFullScreenViewController videoControlsManagerDidChange]):
1693         (-[WKFullScreenViewController ensurePiPAnimator]):
1694         (-[WKFullScreenViewController willEnterPictureInPicture]):
1695         (-[WKFullScreenViewController didEnterPictureInPicture]):
1696         (-[WKFullScreenViewController failedToEnterPictureInPicture]):
1697         (-[WKFullScreenViewController loadView]):
1698         (-[WKFullScreenViewController viewWillAppear:]):
1699         * UIProcess/Cocoa/WebViewImpl.mm:
1700         (WebKit::WebViewImpl::videoControlsManagerDidChange):
1701         * UIProcess/mac/WKFullScreenWindowController.h:
1702         * UIProcess/mac/WKFullScreenWindowController.mm:
1703         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setParent):
1704         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
1705         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::interface const):
1706         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
1707         (-[WKFullScreenWindowController dealloc]):
1708         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
1709         (-[WKFullScreenWindowController willEnterPictureInPicture]):
1710
1711 2018-07-18  Jer Noble  <jer.noble@apple.com>
1712
1713         Dissociate the VideoFullscreenInterface from its VideoFullscreenModel before removing it from the manager
1714         https://bugs.webkit.org/show_bug.cgi?id=187775
1715         <rdar://problem/42343229>
1716
1717         Reviewed by Jon Lee.
1718
1719         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1720         (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
1721
1722 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1723
1724         Add SPI to defer running async script until after document load
1725         https://bugs.webkit.org/show_bug.cgi?id=187748
1726         <rdar://problem/42317378>
1727
1728         Reviewed by Ryosuke Niwa and Tim Horton.
1729
1730         Add plumbing for a new ShouldDeferAsynchronousScriptsUntilAfterDocumentLoad configuration that determines
1731         whether async script execution should be deferred until document load (i.e. DOMContentLoaded). This
1732         configuration defaults to NO on all platforms. See WebCore ChangeLog for more detail.
1733
1734         * Shared/WebPreferences.yaml:
1735         * UIProcess/API/Cocoa/WKWebView.mm:
1736         (-[WKWebView _initializeWithConfiguration:]):
1737         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1738         (-[WKWebViewConfiguration init]):
1739         (-[WKWebViewConfiguration copyWithZone:]):
1740         (-[WKWebViewConfiguration _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad]):
1741         (-[WKWebViewConfiguration _setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad:]):
1742         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1743
1744 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
1745
1746         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
1747         https://bugs.webkit.org/show_bug.cgi?id=187751
1748
1749         Reviewed by Carlos Garcia Campos.
1750
1751         Start including the Nicosia::CompositionLayer objects in the
1752         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
1753         References to all the layers in a given scene are kept in a HashSet,
1754         and a separate reference to the root layer kept in a separate member
1755         variable.
1756
1757         CompositingCoordinator now takes care of adding or removing the
1758         Nicosia::CompositionLayer objects to the NicosiaState's HashSet, as well
1759         as setting the root layer object when it's being initialized. Additions
1760         and removals of Nicosia::CompositionLayer correspond to the additions
1761         and removals of CoordinatedGraphicsLayer objects to the coordinator's
1762         m_registeredLayers HashMap.
1763
1764         Upon each state commit that's done in CoordinatedGraphicsScene, the
1765         NicosiaState object will be copied into the member variable. Nothing is
1766         done yet with that state object, but in the near future it will be used
1767         to finally commit all the state details into the TextureMapper layers.
1768
1769         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1770         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1771         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1772         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1773         (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
1774         (WebKit::CompositingCoordinator::createGraphicsLayer):
1775         (WebKit::CompositingCoordinator::detachLayer):
1776         (WebKit::CompositingCoordinator::attachLayer):
1777
1778 2018-07-17  Tim Horton  <timothy_horton@apple.com>
1779
1780         REGRESSION (iOS 12): Can't scroll to the bottom of the page in WKWebView while keyboard is up on pages with viewport-fit=cover
1781         https://bugs.webkit.org/show_bug.cgi?id=187743
1782         <rdar://problem/41651546>
1783
1784         Reviewed by Simon Fraser.
1785
1786         UIScrollView's _systemContentInset no longer includes keyboard insets
1787         in apps linked on iOS 12+ when contentInsetAdjustmentBehavior is None.
1788
1789         We use contentInsetAdjustmentBehavior to control adjustment of other
1790         sources of insets, but expect the keyboard inset to always be applied.
1791
1792         For now, barring a more comprehensive way to separate insets, re-add
1793         the keyboard inset in cases where UIKit does not.
1794
1795         * Platform/spi/ios/UIKitSPI.h:
1796         Move some IPI to the SPI header.
1797
1798         * UIProcess/API/Cocoa/WKWebView.mm:
1799         (-[WKWebView _haveSetObscuredInsets]):
1800         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1801         Make it possible for WKScrollView to check whether the client is overriding insets.
1802
1803         * UIProcess/Cocoa/VersionChecks.h:
1804         Add a linkedOnOrAfter() version for this new UIScrollView behavior.
1805
1806         * UIProcess/ios/WKScrollView.mm:
1807         (-[WKScrollView initWithFrame:]):
1808         Force WKScrollView's scroll indicator to always respect insets. We always
1809         want the scroll bars in a sensible place, even if the page sets
1810         viewport-fit=cover.
1811
1812         (-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
1813         Store the bottom inset due to the keyboard.
1814
1815         (-[WKScrollView _systemContentInset]):
1816         Add the bottom inset due to the keyboard to the systemContentInset 
1817         in all cases where UIKit does not. Also avoid adding it if the client takes
1818         full control of the insets, because the only client that does (MobileSafari)
1819         includes insets-due-to-keyboard in their custom insets.
1820
1821 2018-07-17  Chris Dumez  <cdumez@apple.com>
1822
1823         RELEASE_ASSERT() under IPC::Connection::sendSync() from PluginProxy::supportsSnapshotting()
1824         https://bugs.webkit.org/show_bug.cgi?id=187740
1825         <rdar://problem/41818955>
1826
1827         Reviewed by Youenn Fablet.
1828
1829         As per the crash trace, PluginProxy::supportsSnapshotting() can be called during layout but does synchronous
1830         IPC. As a result, we need to prevent WebCore re-entrancy by using DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1831         sendOption.
1832
1833         * WebProcess/Plugins/PluginProxy.cpp:
1834         (WebKit::PluginProxy::supportsSnapshotting const):
1835
1836 2018-07-17  Chris Dumez  <cdumez@apple.com>
1837
1838         Turn on PSON in WebKitTestRunner
1839         https://bugs.webkit.org/show_bug.cgi?id=186542
1840
1841         Reviewed by Brady Eidson.
1842
1843         Fix leaking of pre-warmed WebContent processes which became obvious when turning
1844         on process-swap-on-navigation by default in WebKitTestRunner. The issue was that
1845         the WebProcessPool holds a strong reference to its WebProcessProxy objects via
1846         m_processes data members. In turn, WebProcessProxy objects hold a strong reference
1847         to their WebProcessPool via their m_processPool data member. This reference cycle
1848         normally gets broken by calling WebProcessProxy::shutDown() which removes the
1849         WebProcessProxy objects from its WebProcessPool's m_processes container.
1850         WebProcessProxy::shutDown() normally gets called when a WebProcessProxy no longer
1851         has any WebPageProxy objects. However, in the case of unused pre-warmed
1852         WebProcessProxy objects, those never get any page and therefore we'd never break
1853         the reference cycle. To address the issue, pre-warmed WebProcessProxy objects
1854         now only hold a Weak reference to their process pool, only regular WebProcessProxy
1855         objects hold a strong reference to their pool.
1856
1857         * UIProcess/WebProcessPool.cpp:
1858         (WebKit::WebProcessPool::~WebProcessPool):
1859         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1860         * UIProcess/WebProcessPool.h:
1861         * UIProcess/WebProcessProxy.cpp:
1862         (WebKit::WebProcessProxy::WebProcessProxy):
1863         (WebKit::WebProcessProxy::getLaunchOptions):
1864         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
1865         * UIProcess/WebProcessProxy.h:
1866         (WebKit::WebProcessProxy::processPool):
1867         (WebKit::WebProcessProxy::WeakOrStrongPtr::WeakOrStrongPtr):
1868         (WebKit::WebProcessProxy::WeakOrStrongPtr::setIsWeak):
1869         (WebKit::WebProcessProxy::WeakOrStrongPtr::get const):
1870         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator-> const):
1871         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator* const):
1872         (WebKit::WebProcessProxy::WeakOrStrongPtr::operator bool const):
1873         (WebKit::WebProcessProxy::WeakOrStrongPtr::updateStrongReference):
1874
1875 2018-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1876
1877         Add an SPI hook to allow clients to yield document parsing and script execution
1878         https://bugs.webkit.org/show_bug.cgi?id=187682
1879         <rdar://problem/42207453>
1880
1881         Reviewed by Ryosuke Niwa.
1882
1883         Add hooks to WKDOMDocument to create and return an internal WKDOMDocumentParserYieldToken object, whose lifetime
1884         is tied to a document parser yield token. See WebCore ChangeLog for more detail.
1885
1886         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
1887         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm:
1888         (-[WKDOMDocumentParserYieldToken initWithDocument:]):
1889         (-[WKDOMDocument parserYieldToken]):
1890
1891 2018-07-17  John Wilander  <wilander@apple.com>
1892
1893         Add completion handlers to TestRunner functions setStatisticsLastSeen(), setStatisticsPrevalentResource(), setStatisticsVeryPrevalentResource(), setStatisticsHasHadUserInteraction(), and setStatisticsHasHadNonRecentUserInteraction()
1894         https://bugs.webkit.org/show_bug.cgi?id=187710
1895         <rdar://problem/42252757>
1896
1897         Reviewed by Chris Dumez.
1898
1899         These changes are to back the completion handler functionality of
1900         TestRunner functions:
1901         - setStatisticsLastSeen(),
1902         - setStatisticsPrevalentResource(),
1903         - setStatisticsVeryPrevalentResource(),
1904         - setStatisticsHasHadUserInteraction(), and
1905         - setStatisticsHasHadNonRecentUserInteraction().
1906
1907         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1908         (WKWebsiteDataStoreSetStatisticsLastSeen):
1909         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
1910         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
1911         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
1912         (WKWebsiteDataStoreSetStatisticsHasHadNonRecentUserInteraction):
1913         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1914         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1915         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1916         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
1917         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1918         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1919         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1920         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1921         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
1922         * UIProcess/WebResourceLoadStatisticsStore.h:
1923
1924 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
1925
1926         Add color filter for transforming colors in Dark Mode
1927         https://bugs.webkit.org/show_bug.cgi?id=187717
1928
1929         Reviewed by Dean Jackson.
1930
1931         * Shared/WebCoreArgumentCoders.cpp:
1932         (IPC::ArgumentCoder<FilterOperation>::encode):
1933         (IPC::decodeFilterOperation):
1934
1935 2018-07-16  Tim Horton  <timothy_horton@apple.com>
1936
1937         Black flash in content area when returning to Mail
1938         https://bugs.webkit.org/show_bug.cgi?id=187719
1939         <rdar://problem/42165340>
1940
1941         Reviewed by Wenson Hsieh.
1942
1943         * UIProcess/ios/WebPageProxyIOS.mm:
1944         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
1945         This still reproduces sometimes even after r233723, because:
1946
1947         If a pending commit arrives after ApplicationDidEnterBackground (when we
1948         ask the web content process to freeze the layer tree), and after
1949         ApplicationDidFinishSnapshottingAfterEnteringBackground (when we hide
1950         WKContentView), but before the process sleeps, it will cause WKContentView
1951         to be unhidden (potentially including layers with empty surfaces as contents).
1952         Nothing will re-hide WKContentView. Instead, we should wait for the next
1953         *pending* commit, which will necessarily not come until after the application
1954         returns to the foreground because of the strict IPC ordering between
1955         the message that freezes the layer tree and the "next commit" mechanism.
1956
1957 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
1958
1959         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
1960         https://bugs.webkit.org/show_bug.cgi?id=187375
1961
1962         Reviewed by Simon Fraser.
1963
1964         For immediate-paint transaction, we should force all the images which are 
1965         pending decoding to be repainted before building this transaction.
1966
1967         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1968         (WebKit::PDFPlugin::updateControlTints):
1969         * WebProcess/Plugins/PluginView.cpp:
1970         (WebKit::PluginView::paint):
1971         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1972         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1973
1974 2018-07-11  Dean Jackson  <dino@apple.com>
1975
1976         Allow removal of white backgrounds
1977         https://bugs.webkit.org/show_bug.cgi?id=187574
1978         <rdar://problem/41146792>
1979
1980         Reviewed by Simon Fraser.
1981
1982         Add a new WebPreference for punching out white backgrounds.
1983
1984         * Shared/WebPreferences.yaml:
1985         * UIProcess/API/C/WKPreferences.cpp:
1986         (WKPreferencesSetPunchOutWhiteBackgroundsInDarkMode):
1987         (WKPreferencesGetPunchOutWhiteBackgroundsInDarkMode):
1988         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1989         * UIProcess/API/Cocoa/WKWebView.mm:
1990         (-[WKWebView _initializeWithConfiguration:]):
1991         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1992         (-[WKWebViewConfiguration init]):
1993         (-[WKWebViewConfiguration copyWithZone:]):
1994         (-[WKWebViewConfiguration _punchOutWhiteBackgroundsInDarkMode]):
1995         (-[WKWebViewConfiguration _setPunchOutWhiteBackgroundsInDarkMode:]):
1996         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1997
1998 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
1999
2000         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
2001         https://bugs.webkit.org/show_bug.cgi?id=186531
2002
2003         Reviewed by Tim Horton.
2004
2005         Created WebDataListSuggestionsDropdownMac as a wrapper around the suggestions
2006         view. The suggestions for TextFieldInputTypes are displayed using an NSTableView
2007         in it's own child window. This is done so that suggestions can be presented
2008         outside of the page if the parent window's size is too small. The maximum number
2009         of suggestions that are visible at one time is 6, with additional suggestions made
2010         available by scrolling.
2011
2012         Suggestions in the view can be selected via click or by using arrow keys. If the
2013         input element associated with the suggestions is blurred, or the page is moved in
2014         any way, the suggestions view is hidden.
2015
2016         Added IPC messages to the UIProcess to enable the display of the suggestions view.
2017         This required a new ArgumentCoder for DataListSuggestionInformation.
2018
2019         * Shared/WebCoreArgumentCoders.cpp:
2020         (IPC::ArgumentCoder<DataListSuggestionInformation>::encode):
2021         (IPC::ArgumentCoder<DataListSuggestionInformation>::decode):
2022         * Shared/WebCoreArgumentCoders.h:
2023         * UIProcess/PageClient.h:
2024         * UIProcess/WebDataListSuggestionsDropdown.cpp: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
2025         (WebKit::WebDataListSuggestionsDropdown::WebDataListSuggestionsDropdown):
2026         (WebKit::WebDataListSuggestionsDropdown::~WebDataListSuggestionsDropdown):
2027         (WebKit::WebDataListSuggestionsDropdown::close):
2028         * UIProcess/WebDataListSuggestionsDropdown.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
2029         (WebKit::WebDataListSuggestionsDropdown::Client::~Client):
2030         * UIProcess/WebPageProxy.cpp:
2031         (WebKit::WebPageProxy::viewWillStartLiveResize):
2032         (WebKit::WebPageProxy::viewDidLeaveWindow):
2033         (WebKit::WebPageProxy::handleWheelEvent):
2034         (WebKit::WebPageProxy::setPageZoomFactor):
2035         (WebKit::WebPageProxy::setPageAndTextZoomFactors):
2036         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2037         (WebKit::WebPageProxy::pageDidScroll):
2038         (WebKit::WebPageProxy::showDataListSuggestions):
2039         (WebKit::WebPageProxy::handleKeydownInDataList):
2040         (WebKit::WebPageProxy::endDataListSuggestions):
2041         (WebKit::WebPageProxy::didCloseSuggestions):
2042         (WebKit::WebPageProxy::didSelectOption):
2043         (WebKit::WebPageProxy::resetState):
2044         (WebKit::WebPageProxy::closeOverlayedViews):
2045         * UIProcess/WebPageProxy.h:
2046         * UIProcess/WebPageProxy.messages.in:
2047         * UIProcess/ios/PageClientImplIOS.h:
2048         * UIProcess/ios/PageClientImplIOS.mm:
2049         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
2050         * UIProcess/mac/PageClientImplMac.h:
2051         * UIProcess/mac/PageClientImplMac.mm:
2052         (WebKit::PageClientImpl::createDataListSuggestionsDropdown):
2053         * UIProcess/mac/WebDataListSuggestionsDropdownMac.h: Copied from Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h.
2054         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm: Added.
2055         (WebKit::WebDataListSuggestionsDropdownMac::create):
2056         (WebKit::WebDataListSuggestionsDropdownMac::~WebDataListSuggestionsDropdownMac):
2057         (WebKit::WebDataListSuggestionsDropdownMac::WebDataListSuggestionsDropdownMac):
2058         (WebKit::WebDataListSuggestionsDropdownMac::show):
2059         (WebKit::WebDataListSuggestionsDropdownMac::didSelectOption):
2060         (WebKit::WebDataListSuggestionsDropdownMac::selectOption):
2061         (WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
2062         (WebKit::WebDataListSuggestionsDropdownMac::close):
2063         (-[WKDataListSuggestionCell initWithFrame:]):
2064         (-[WKDataListSuggestionCell setText:]):
2065         (-[WKDataListSuggestionCell setActive:]):
2066         (-[WKDataListSuggestionCell drawRect:]):
2067         (-[WKDataListSuggestionCell mouseEntered:]):
2068         (-[WKDataListSuggestionCell mouseExited:]):
2069         (-[WKDataListSuggestionCell acceptsFirstResponder]):
2070         (-[WKDataListSuggestionTable initWithElementRect:]):
2071         (-[WKDataListSuggestionTable setVisibleRect:]):
2072         (-[WKDataListSuggestionTable currentActiveRow]):
2073         (-[WKDataListSuggestionTable setActiveRow:]):
2074         (-[WKDataListSuggestionTable reload]):
2075         (-[WKDataListSuggestionTable acceptsFirstResponder]):
2076         (-[WKDataListSuggestionTable enclosingScrollView]):
2077         (-[WKDataListSuggestionTable removeFromSuperviewWithoutNeedingDisplay]):
2078         (-[WKDataListSuggestionsView initWithInformation:inView:]):
2079         (-[WKDataListSuggestionsView currentSelectedString]):
2080         (-[WKDataListSuggestionsView updateWithInformation:]):
2081         (-[WKDataListSuggestionsView moveSelectionByDirection:]):
2082         (-[WKDataListSuggestionsView invalidate]):
2083         (-[WKDataListSuggestionsView dropdownRectForElementRect:]):
2084         (-[WKDataListSuggestionsView showSuggestionsDropdown:]):
2085         (-[WKDataListSuggestionsView selectedRow:]):
2086         (-[WKDataListSuggestionsView numberOfRowsInTableView:]):
2087         (-[WKDataListSuggestionsView tableView:heightOfRow:]):
2088         (-[WKDataListSuggestionsView tableView:viewForTableColumn:row:]):
2089         * WebKit.xcodeproj/project.pbxproj:
2090         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.cpp:
2091         (WebKit::WebDataListSuggestionPicker::handleKeydownWithIdentifier):
2092         (WebKit::WebDataListSuggestionPicker::didSelectOption):
2093         (WebKit::WebDataListSuggestionPicker::didCloseSuggestions):
2094         (WebKit::WebDataListSuggestionPicker::close):
2095         (WebKit::WebDataListSuggestionPicker::displayWithActivationType):
2096         * WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:
2097
2098 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
2099
2100         Fullscreen requires active document.
2101         https://bugs.webkit.org/show_bug.cgi?id=186226
2102         rdar://problem/36187413
2103
2104         Reviewed by Jer Noble.
2105
2106         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
2107
2108         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
2109         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
2110         be hidden.
2111
2112         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
2113
2114         This change adds a sync call to the UI process to get the current UI visibility state.
2115
2116         * UIProcess/WebPageProxy.cpp:
2117         (WebKit::WebPageProxy::getIsViewVisible):
2118         * UIProcess/WebPageProxy.h:
2119         * UIProcess/WebPageProxy.messages.in:
2120         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2121         (WebKit::WebChromeClient::isViewVisible):
2122         * WebProcess/WebCoreSupport/WebChromeClient.h:
2123
2124 2018-07-16  Tim Horton  <timothy_horton@apple.com>
2125
2126         REGRESSION (r233502): Camera in <input type=file> becomes unresponsive after attempting to dismiss it
2127         https://bugs.webkit.org/show_bug.cgi?id=187706
2128         <rdar://problem/42137088>
2129
2130         Reviewed by Wenson Hsieh.
2131
2132         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2133         Remove an unused member.
2134
2135         (-[WKFileUploadPanel _dismissDisplayAnimated:]):
2136         Allow us to dismiss the camera view controller in addition to the menu.
2137
2138 2018-07-16  Alex Christensen  <achristensen@webkit.org>
2139
2140         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
2141         https://bugs.webkit.org/show_bug.cgi?id=187671
2142
2143         Reviewed by Darin Adler.
2144
2145         * Shared/WebCoreArgumentCoders.h:
2146
2147 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
2148
2149         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
2150         https://bugs.webkit.org/show_bug.cgi?id=187631
2151         <rdar://problem/42164227>
2152
2153         Reviewed by Brady Eidson.
2154
2155         We need to return all origins, both openingOrigin and mainFrameOrigin, of IndexedDB so users
2156         could be better aware of which origins are using databases and decide what they want to 
2157         remove.
2158
2159         * StorageProcess/StorageProcess.cpp:
2160         (WebKit::StorageProcess::indexedDatabaseOrigins):
2161         * StorageProcess/StorageProcess.h:
2162
2163 2018-07-15  Carlos Garcia Campos  <cgarcia@igalia.com>
2164
2165         [SOUP] http/tests/misc/bubble-drag-events.html crashes
2166         https://bugs.webkit.org/show_bug.cgi?id=182352
2167
2168         Reviewed by Youenn Fablet.
2169
2170         PingLoad is not refcounted and deletes itself when the load finishes. The problem is that the network data
2171         task can also finish the load, causing the PingLoad to be deleted early. We tried to fix it in r233032 in the
2172         network data task soup implementation, but it caused regressions.
2173
2174         * NetworkProcess/PingLoad.cpp:
2175         (WebKit::PingLoad::didReceiveChallenge): Create a weak ref for the ping load before calling the operation completion
2176         handler and return early after the completion handler if it was deleted.
2177         (WebKit::PingLoad::didReceiveResponseNetworkSession): Ditto.
2178         * NetworkProcess/PingLoad.h:
2179         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2180         (WebKit::NetworkDataTaskSoup::continueAuthenticate): Revert r233032.
2181
2182 2018-07-13  Timothy Hatcher  <timothy@apple.com>
2183
2184         Add _drawsBackground to WKWebViewConfiguration.
2185         https://bugs.webkit.org/show_bug.cgi?id=187665
2186         rdar://problem/42182268
2187
2188         Reviewed by Tim Horton.
2189
2190         * UIProcess/API/APIPageConfiguration.cpp:
2191         (API::PageConfiguration::copy const): Copy m_drawsBackground, and some missing values.
2192         * UIProcess/API/APIPageConfiguration.h:
2193         (API::PageConfiguration::drawsBackground const): Added.
2194         (API::PageConfiguration::setDrawsBackground): Added.
2195         * UIProcess/API/Cocoa/WKWebView.mm:
2196         (-[WKWebView _initializeWithConfiguration:]): Transfer _drawsBackground to page config.
2197         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2198         (-[WKWebViewConfiguration init]): Set _drawsBackground to YES.
2199         (-[WKWebViewConfiguration encodeWithCoder:]): Encode _drawsBackground.
2200         (-[WKWebViewConfiguration initWithCoder:]): Decode _drawsBackground.
2201         (-[WKWebViewConfiguration copyWithZone:]): Copy _drawsBackground.
2202         (-[WKWebViewConfiguration _drawsBackground]): Added.
2203         (-[WKWebViewConfiguration _setDrawsBackground:]): Added.
2204         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2205         * UIProcess/WebPageProxy.cpp: Set m_drawsBackground based on configuration.
2206
2207 2018-07-13  Tim Horton  <timothy_horton@apple.com>
2208
2209         WebKit sometimes holds WiFi/BT assertions while the Networking process is suspended
2210         https://bugs.webkit.org/show_bug.cgi?id=187662
2211         <rdar://problem/41999448>
2212
2213         Reviewed by Chris Dumez.
2214
2215         Inform WiFiAssertions when the Networking process is first going into the background,
2216         so it has a chance of dropping its assertions even in cases where the system
2217         suspends the process before we receive prepareToSuspend.
2218
2219         * NetworkProcess/NetworkProcess.cpp:
2220         (WebKit::NetworkProcess::processDidTransitionToForeground):
2221         (WebKit::NetworkProcess::processDidTransitionToBackground):
2222         * NetworkProcess/NetworkProcess.h:
2223         * NetworkProcess/NetworkProcess.messages.in:
2224         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2225         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
2226         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
2227         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2228         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
2229         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
2230         * UIProcess/Network/NetworkProcessProxy.cpp:
2231         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToForeground):
2232         (WebKit::NetworkProcessProxy::sendProcessDidTransitionToBackground):
2233         * UIProcess/Network/NetworkProcessProxy.h:
2234         * UIProcess/WebProcessPool.cpp:
2235         (WebKit::WebProcessPool::updateProcessAssertions):
2236         Plumb the foreground/background transition to NetworkProcess.
2237
2238         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2239         (WebKit::NetworkProcess::platformPrepareToSuspend):
2240         (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
2241         (WebKit::NetworkProcess::platformProcessDidTransitionToForeground):
2242         Make use of SuspensionReason to explain to WiFiAssertions the
2243         difference between prepareToSuspend and didTransitionToBackground,
2244         so that it can adjust the timing of dropping the assertion.
2245
2246 2018-07-13  Tim Horton  <timothy_horton@apple.com>
2247
2248         REGRESSION (r231676): watchOS WebKit usually doesn't load in the background
2249         https://bugs.webkit.org/show_bug.cgi?id=187663
2250         <rdar://problem/42181185>
2251
2252         Reviewed by Chris Dumez.
2253
2254         * UIProcess/ios/WebPageProxyIOS.mm:
2255         (WebKit::WebPageProxy::applicationDidEnterBackground):
2256         "Screen lock" is very aggressive on watchOS; we want to do our usual
2257         30 seconds of loading in the background when you drop your wrist,
2258         so disable this power optimization on that platform.
2259
2260 2018-07-13  Chris Dumez  <cdumez@apple.com>
2261
2262         WebResourceLoader may try to send a IPC with a destination ID that is 0
2263         https://bugs.webkit.org/show_bug.cgi?id=187654
2264         <rdar://problem/39265927>
2265
2266         Reviewed by Brady Eidson.
2267
2268         WebResourceLoader may try to send a IPC with a destination ID that is 0 according to release
2269         assertion hits we see in the wild. This can lead to HashMap corruption on recipient side when
2270         trying to lookup a key that is 0.
2271
2272         As per the crash traces, we see it starts from WebLoaderStrategy::internallyFailedLoadTimerFired()
2273         which is likely due to the Network process crashing. WebLoaderStrategy::networkProcessCrashed()
2274         calls scheduleInternallyFailedLoad() on each ResourceLoader and clears the WebResourceLoaders in
2275         m_webResourceLoaders. When a ResourceLoader is cancelled (marked as failed), we clear its identifier
2276         and we normally null out the WebLoaderStrategy's coreLoader. However, if we cannot find the
2277         WebResourceLoader in m_webResourceLoaders (because that map was already cleared) then the
2278         WebResourceLoader's coreLoader may not get nulled out, even if the coreLoader's identifier has
2279         been reset. We have 2 lambdas in WebResourceLoader which keep the WebResourceLoader alive and
2280         try to send IPC and are merely doing a null check on the coreLoader before trying to send the
2281         IPC.
2282
2283         To address the issue, we now clear the WebResourceLoader's coreLoader in
2284         WebLoaderStrategy::networkProcessCrashed(). For robustness, we also check that a coreLoader's
2285         identifier is not 0 before trying to send IPC.
2286
2287         * WebProcess/Network/WebLoaderStrategy.cpp:
2288         (WebKit::WebLoaderStrategy::networkProcessCrashed):
2289         * WebProcess/Network/WebResourceLoader.cpp:
2290         (WebKit::WebResourceLoader::willSendRequest):
2291         (WebKit::WebResourceLoader::didReceiveResponse):
2292
2293 2018-07-13  Zach Li  <zachli@apple.com>
2294
2295         Allow BOCOM and ABC plug-ins to run unsandboxed
2296         https://bugs.webkit.org/show_bug.cgi?id=187652
2297         rdar://problem/42149182
2298
2299         Reviewed by Youenn Fablet.
2300
2301         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2302         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
2303
2304 2018-07-13  Chris Dumez  <cdumez@apple.com>
2305
2306         Add more threading release assertions
2307         https://bugs.webkit.org/show_bug.cgi?id=187647
2308
2309         Reviewed by Alex Christensen.
2310
2311         Add more threading release assertions to help debug <rdar://problem/39265927>.
2312
2313         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2314         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2315         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
2316         * UIProcess/WebProcessProxy.cpp:
2317         (WebKit::m_isInPrewarmedPool):
2318         (WebKit::WebProcessProxy::~WebProcessProxy):
2319         (WebKit::WebProcessProxy::shutDown):
2320         (WebKit::WebProcessProxy::didFinishLaunching):
2321
2322 2018-07-13  Christopher Reid  <chris.reid@sony.com>
2323
2324         [WinCairo] Add windows storage process connection implementation
2325         https://bugs.webkit.org/show_bug.cgi?id=187531
2326
2327         Reviewed by Fujii Hironori.
2328
2329         * NetworkProcess/NetworkProcess.cpp:
2330         * Platform/IPC/Attachment.h:
2331         * StorageProcess/StorageProcess.cpp:
2332         * UIProcess/Storage/StorageProcessProxy.cpp:
2333
2334 2018-07-13  Dan Bernstein  <mitz@apple.com>
2335
2336         [macOS] REGRESSION (r233536): Development WebContent service got opted back into Library Validation
2337         https://bugs.webkit.org/show_bug.cgi?id=187640
2338
2339         Reviewed by Daniel Bates.
2340
2341         * Scripts/process-webcontent-entitlements.sh: Add the
2342           com.apple.security.cs.disable-library-validation to the Development service regardless of
2343           whether restricted entitlements are to be used, because that entitlement is not restricted.
2344
2345 2018-07-13  Chris Dumez  <cdumez@apple.com>
2346
2347         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
2348         https://bugs.webkit.org/show_bug.cgi?id=187629
2349
2350         Reviewed by Youenn Fablet.
2351
2352         NetworkConnectionToWebProcess::m_networkResourceLoaders should use Ref<> for its values
2353         since they cannot be null.
2354
2355         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2356         (WebKit::NetworkConnectionToWebProcess::didClose):
2357         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2358         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
2359         * NetworkProcess/NetworkConnectionToWebProcess.h:
2360
2361 2018-07-12  Alex Christensen  <achristensen@webkit.org>
2362
2363         Reduce size of WebCore::URL
2364         https://bugs.webkit.org/show_bug.cgi?id=186820
2365
2366         Reviewed by Yusuke Suzuki and Youenn Fablet.
2367
2368         * NetworkProcess/cache/NetworkCacheStorage.h:
2369         Increment cache version because of URL encoding change.
2370
2371 2018-07-12  Chris Dumez  <cdumez@apple.com>
2372
2373         [Cocoa] Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port
2374         https://bugs.webkit.org/show_bug.cgi?id=187625
2375
2376         Reviewed by Youenn Fablet.
2377
2378         Make sure NetworkProcess::createNetworkConnectionToWebProcess() returns a valid mach port to help
2379         debug <rdar://problem/41995022>.
2380
2381         * NetworkProcess/NetworkProcess.cpp:
2382         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2383         * UIProcess/Network/NetworkProcessProxy.cpp:
2384         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2385
2386 2018-07-12  Chris Dumez  <cdumez@apple.com>
2387
2388         PingLoad does not need to ref the NetworkConnectionToWebProcess
2389         https://bugs.webkit.org/show_bug.cgi?id=187624
2390
2391         Reviewed by Youenn Fablet.
2392
2393         PingLoad does not need to ref the NetworkConnectionToWebProcess and keep it alive longer than it needs to be.
2394         Instead, ref the IPC::Connection which is lighter weight and gets invalidated when the NetworkConnectionToWebProcess
2395         is destroyed.
2396
2397         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2398         (WebKit::NetworkConnectionToWebProcess::loadPing):
2399         (WebKit::NetworkConnectionToWebProcess::didFinishPingLoad): Deleted.
2400         * NetworkProcess/NetworkConnectionToWebProcess.h:
2401
2402 2018-07-12  Brady Eidson  <beidson@apple.com>
2403
2404         Make process-swap-on-navigation an experimental feature.
2405         <rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558
2406
2407         Reviewed by Chris Dumez.
2408
2409         * Shared/WebPreferences.yaml:
2410         
2411         * UIProcess/API/C/WKPreferences.cpp:
2412         (WKPreferencesSetProcessSwapOnNavigationEnabled):
2413         (WKPreferencesGetProcessSwapOnNavigationEnabled):
2414         * UIProcess/API/C/WKPreferencesRef.h:
2415         
2416         * UIProcess/WebPreferences.cpp:
2417         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
2418         
2419         * UIProcess/WebProcessPool.cpp:
2420         (WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
2421           absorb that setting into this process pool's configuration.
2422
2423 2018-07-12  Chris Dumez  <cdumez@apple.com>
2424
2425         Simplify code in NetworkConnectionToWebProcess::didReceiveMessage()
2426         https://bugs.webkit.org/show_bug.cgi?id=187621
2427
2428         Reviewed by Youenn Fablet.
2429
2430         Simplify code in NetworkConnectionToWebProcess::didReceiveMessage() by not using HashMap iterators and
2431         calling get() directly.
2432
2433         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2434         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
2435
2436 2018-07-12  Chris Dumez  <cdumez@apple.com>
2437
2438         Make sure WebProcess::ensureNetworkProcessConnection() is always called on the main thread
2439         https://bugs.webkit.org/show_bug.cgi?id=187607
2440
2441         Reviewed by Alex Christensen.
2442
2443         Add release assertion to make sure that ensureNetworkProcessConnection() is always called on the main
2444         thread. Calling it on a background thread would not be safe. It would not be safe because:
2445         1. We check if we have a network process connection and then create one if we don't without any locking.
2446         2. It is not safe to construct or use a NetworkProcessConnection object from a non-main thread
2447
2448         * WebProcess/WebProcess.cpp:
2449         (WebKit::WebProcess::ensureNetworkProcessConnection):
2450
2451 2018-07-12  Chris Dumez  <cdumez@apple.com>
2452
2453         Assert that the IPC::Connection is valid in Connection::dispatchMessage(Decoder&)
2454         https://bugs.webkit.org/show_bug.cgi?id=187617
2455
2456         Reviewed by Youenn Fablet.
2457
2458         Assert that the IPC::Connection is valid in Connection::dispatchMessage(Decoder&) as
2459         m_client would be stale otherwise.
2460
2461         * Platform/IPC/Connection.cpp:
2462         (IPC::Connection::dispatchMessage):
2463
2464 2018-07-12  Youenn Fablet  <youenn@apple.com>
2465
2466         Add a FrameLoaderClient willInjectUserScriptForFrame callback
2467         https://bugs.webkit.org/show_bug.cgi?id=187565
2468
2469         Reviewed by Alex Christensen.
2470
2471         Introduce a new WKBundlePageLoaderClient callback that is called everytime a user script is injected.
2472         Implement WebFrameLoaderClient::willInjectUserScript by calling this new callback.
2473
2474         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2475         (API::InjectedBundle::PageLoaderClient::willInjectUserScriptForFrame):
2476         * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
2477         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
2478         (setUpPageLoaderClient):
2479         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2480         (WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame):
2481         (WebKit::InjectedBundlePageLoaderClient::willInjectUserScriptForFrame):
2482         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2483         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2484         (WebKit::WebFrameLoaderClient::willInjectUserScript):
2485         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2486
2487 2018-07-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2488
2489         [iOS] When bringing MobileSafari to the foreground, images are drawn asynchronously after removing a snapshot that included them
2490         https://bugs.webkit.org/show_bug.cgi?id=187374
2491         <rdar://problem/41249545>
2492
2493         Reviewed by Tim Horton.
2494
2495         UIProcess should block committing all the layer tree transactions for 
2496         immediate update until it receives a one whose activityStateChangeID is
2497         greater than or equal to the one it sends with SetActivityState message.
2498
2499         * Scripts/webkit/messages.py:
2500         Fix the messages code generator to include DrawingAreaInfo.h for the WebKit
2501         typedef ActivityStateChangeID.
2502
2503         * Shared/DrawingAreaInfo.h:
2504         Define ActivityStateChangeID to be uint64_t. Add a definition for the case
2505         when the UIProcess won't be blocked for a reply back from the WebProcess.
2506
2507         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2508         (WebKit::RemoteLayerTreeTransaction::activityStateChangeID const):
2509         (WebKit::RemoteLayerTreeTransaction::setActivityStateChangeID):
2510         Add a member for activityStateChangeID in the LayerTreeTransaction.
2511
2512         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2513         (WebKit::RemoteLayerTreeTransaction::encode const):
2514         (WebKit::RemoteLayerTreeTransaction::decode):
2515         Make LayerTreeTransaction know how to encode and decode activityStateChangeID.
2516
2517         * UIProcess/DrawingAreaProxy.h:
2518         (WebKit::DrawingAreaProxy::waitForDidUpdateActivityState):
2519         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
2520         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2521         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2522         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
2523         Make the DrawingArea in the UIProcess wait the layer tree with a certain
2524         activityStateChangeID.
2525
2526         * UIProcess/WebPageProxy.cpp:
2527         (WebKit::WebPageProxy::dispatchActivityStateChange):
2528         (WebKit::WebPageProxy::waitForDidUpdateActivityState):
2529         If m_activityStateChangeWantsSynchronousReply is true, generate a new 
2530         activityStateChangeID and send it in the SetActivityState message.
2531
2532         * UIProcess/WebPageProxy.h:
2533         (WebKit::WebPageProxy::takeNextActivityStateChangeID):
2534         A simple way to generate a new activityStateChangeID.
2535
2536         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2537         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2538         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
2539         Fix the UIProcess functions' prototype for Mac.
2540
2541         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2542         (WebKit::AcceleratedDrawingArea::activityStateDidChange):
2543         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2544         Fix the UIProcess functions' prototype for GTK.
2545
2546         * WebProcess/WebPage/DrawingArea.h:
2547         (WebKit::DrawingArea::activityStateDidChange):
2548         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2549         Replace wantsDidUpdateActivityState with activityStateChangeID. Treat
2550         activityStateChangeID == ActivityStateChangeAsynchronous as if 
2551         wantsDidUpdateActivityState == false.
2552
2553         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2554         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2555         Make the WebPrcess pass the activityStateChangeID which it receives from
2556         the SetActivityState message to the LayerTreeTransaction.
2557
2558         (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
2559         When receiving the SetActivityState, treat activityStateChangeID !=
2560         ActivityStateChangeAsynchronous as if wantsDidUpdateActivityState == true.
2561
2562         * WebProcess/WebPage/WebPage.cpp:
2563         (WebKit::WebPage::reinitializeWebPage):
2564         (WebKit::WebPage::setActivityState):
2565         * WebProcess/WebPage/WebPage.h:
2566         * WebProcess/WebPage/WebPage.messages.in:
2567         Replace the boolean wantsDidUpdateActivityState with activityStateChangeID
2568         in the SetActivityState message.
2569
2570         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2571         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2572         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2573         (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
2574         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
2575         Fix the WebProcess functions' prototype for Mac.
2576
2577 2018-07-12  Antti Koivisto  <antti@apple.com>
2578
2579         REGRESSION (r232356): After zooming a page in and out, it's possible to temporarily have missing tiles (google.com, apple.com)
2580         https://bugs.webkit.org/show_bug.cgi?id=187553
2581         <rdar://problem/41863803>
2582
2583         Reviewed by Simon Fraser.
2584
2585         We ignore zoom scale from UI process if it doesn't match the last remote layer tree transaction. However nothing
2586         guarantees that we receive the real scale again until user interacts with the page. This means the web process
2587         scale and the UI process scale can be wildly out of sync.
2588
2589         This problem becomes more likely to be visible when
2590         - we are under memory pressure so we don't update tiles during zooming and rely on the one final update afterwards
2591         - the page generates lots of layer tree transactions
2592
2593         * WebProcess/WebPage/WebPage.cpp:
2594         (WebKit::WebPage::willCommitLayerTree):
2595
2596         Remember the last transaction where we actually changed the page scale.
2597
2598         * WebProcess/WebPage/WebPage.h:
2599         * WebProcess/WebPage/ios/WebPageIOS.mm:
2600         (WebKit::WebPage::scaleFromUIProcess const):
2601
2602         Only reject the UI process scale if there has been a scale changing transaction meanwhile.
2603         The transaction id test was added in r218149 and the problem it fixed remains fixed. This change also matches better
2604         what it was purpoted to implement.
2605
2606 2018-07-12  Megan Gardner  <megan_gardner@apple.com>
2607
2608         Keep Selections within Shadow DOM boundaries
2609         https://bugs.webkit.org/show_bug.cgi?id=187556
2610         <rdar://problem/41664567>
2611
2612         Reviewed by Ryosuke Niwa.
2613
2614         Update rangeForPosition to take into account both editing and shadow DOM boundries.
2615
2616         * WebProcess/WebPage/ios/WebPageIOS.mm:
2617         (WebKit::rangeForPoint):
2618         (WebKit::WebPage::updateSelectionWithTouches):
2619         (WebKit::rangeForPosition): Deleted.
2620         
2621 2018-07-12  Jer Noble  <jer.noble@apple.com>
2622
2623         REGRESSION (r230163): Videos cannot be seen full screen in Complete Anatomy app
2624         https://bugs.webkit.org/show_bug.cgi?id=187527
2625         <rdar://problem/40511527>
2626
2627         Reviewed by Ryosuke Niwa.
2628
2629         Do not enable element fullscreen mode unless apps specifically opt-in. The Fullscreen API is
2630         an experimental feature on iOS, but not on Mac, but we can't simply not return the ExperimentalFeature
2631         object from the list of experimental features, as this keeps Safari from being able to apply a
2632         NSUserDefault value for that feature. Instead, add a property to API::ExperimentalFeature and
2633         _WKExperimentalFeature called "hidden", which signals to clients whether to display the feature
2634         in their UI.
2635
2636         * Scripts/GeneratePreferences.rb:
2637         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
2638         * Shared/WebPreferences.yaml:
2639         * Shared/WebPreferencesDefaultValues.h:
2640         * UIProcess/API/APIExperimentalFeature.cpp:
2641         (API::ExperimentalFeature::create):
2642         (API::ExperimentalFeature::ExperimentalFeature):
2643         * UIProcess/API/APIExperimentalFeature.h:
2644         * UIProcess/API/Cocoa/_WKExperimentalFeature.h:
2645         * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
2646         (-[_WKExperimentalFeature isHidden]):
2647
2648 2018-07-12  Alexey Proskuryakov  <ap@apple.com>
2649
2650         [Mac] Run Unlock Keychain more reliably
2651         https://bugs.webkit.org/show_bug.cgi?id=187604
2652
2653         Reviewed by Dan Bernstein.
2654
2655         Move unlocking to a separate target, and make it a dependency for all targets that
2656         produce binaries.
2657         
2658         This is more than strictly required to fix the build, but this way, we won't need
2659         to remember about keychain when project structure changes. Another consideration that
2660         wasn't initially apparent to me is that is should be possible to build any target,
2661         not just "All", so projects aren't necessarily built in the same order even now.
2662
2663         * WebKit.xcodeproj/project.pbxproj: 
2664
2665 2018-07-12  Per Arne Vollan  <pvollan@apple.com>
2666
2667         Add compile guard for enabling NSRunLoop in the WebContent process.
2668         https://bugs.webkit.org/show_bug.cgi?id=187563
2669
2670         Reviewed by Chris Dumez.
2671
2672         Also, replace __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 with ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) where appropriate.
2673
2674         * Platform/mac/LayerHostingContext.mm:
2675         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2676         * Shared/ChildProcess.h:
2677         * Shared/mac/ChildProcessMac.mm:
2678         * Shared/mac/HangDetectionDisablerMac.mm:
2679         (WebKit::setClientsMayIgnoreEvents):
2680         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2681         (WebKit::WebProcessPool::registerNotificationObservers):
2682         (WebKit::WebProcessPool::unregisterNotificationObservers):
2683         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2684         (WebKit::shouldLeakBoost):
2685         * UIProcess/WebProcessPool.h:
2686         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h:
2687         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2688         (WebKit::PDFPlugin::PDFPlugin):
2689         * WebProcess/WebProcess.h:
2690         * WebProcess/WebProcess.messages.in:
2691         * WebProcess/cocoa/WebProcessCocoa.mm:
2692         (WebKit::WebProcess::platformInitializeWebProcess):
2693         (WebKit::WebProcess::stopRunLoop):
2694
2695 2018-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2696
2697         [WPE] Pass the backend library name as command line parameter to the web process
2698         https://bugs.webkit.org/show_bug.cgi?id=186841
2699
2700         Reviewed by Žan Doberšek.
2701
2702         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2703         (WebKit::ProcessLauncher::launchProcess): Add --backend-library parameter when launching the web process.
2704         * WebProcess/wpe/WebProcessMainWPE.cpp: Call wpe_loader_init() with the library passed as --backend-library parameter.
2705
2706 2018-07-11  Jon Lee  <jonlee@apple.com>
2707
2708         Update iOS fullscreen alert text
2709         https://bugs.webkit.org/show_bug.cgi?id=187576
2710         rdar://problem/42052284
2711
2712         Reviewed by Ryosuke Niwa.
2713
2714         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2715         (-[WKFullScreenViewController _showPhishingAlert]): Update text and string keys.
2716
2717 2018-07-11  Aditya Keerthi  <akeerthi@apple.com>
2718
2719         REGRESSION (231276): Attempting to copy an image fails
2720         https://bugs.webkit.org/show_bug.cgi?id=187212
2721         <rdar://problem/41540074>
2722
2723         Reviewed by Ryosuke Niwa.
2724
2725         r210683 introduced logic to prevent file URLs from being copied to the clipboard
2726         in unexpected cases. In order to achieve this functionality,
2727         checkURLReceivedFromWebProcess was called on all items in the pathnames array
2728         passed into WebPasteboardProxy::setPasteboardPathnamesForType. However, this
2729         method is a misnomer, as the pathnames array always contains exactly one URL and
2730         one title for the URL.
2731
2732         Renamed methods to make it clear that one URL and one title are being passed in
2733         and updated logic to ensure that checkURLReceivedFromWebProcess is only called
2734         on the URL and not the title.
2735
2736         * Shared/WebCoreArgumentCoders.cpp:
2737         (IPC::ArgumentCoder<PasteboardURL>::encode):
2738         (IPC::ArgumentCoder<PasteboardURL>::decode):
2739         * Shared/WebCoreArgumentCoders.h:
2740         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
2741         (WebKit::WebPasteboardProxy::setPasteboardURL):
2742         * UIProcess/WebPasteboardProxy.h:
2743         * UIProcess/WebPasteboardProxy.messages.in:
2744         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2745         (WebKit::WebPlatformStrategies::setURL):
2746         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2747
2748 2018-07-11  Alex Christensen  <achristensen@webkit.org>
2749
2750         Add SPI for immediate injection of user scripts
2751         https://bugs.webkit.org/show_bug.cgi?id=173342
2752         <rdar://problem/29202285>
2753
2754         Reviewed by Brady Eidson, Youenn Fablet, and Geoff Garen.
2755
2756         * UIProcess/API/C/WKPageGroup.cpp:
2757         (WKPageGroupAddUserScript):
2758         * UIProcess/API/C/WKUserContentControllerRef.cpp:
2759         (WKUserContentControllerAddUserScript):
2760         * UIProcess/API/Cocoa/WKUserContentController.mm:
2761         (-[WKUserContentController addUserScript:]):
2762         (-[WKUserContentController _addUserScriptImmediately:]):
2763         * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
2764         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2765         (WebKit::WebUserContentControllerProxy::addUserScript):
2766         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2767         * WebProcess/UserContent/WebUserContentController.cpp:
2768         (WebKit::WebUserContentController::addUserScripts):
2769         (WebKit::WebUserContentController::addUserScriptInternal):
2770         If we are to inject the script internally, inject it into the appropriate pages.
2771         If we're injecting into the top frame only, there's no need to traverse the frame tree.
2772         (WebKit::WebUserContentController::addUserScript):
2773         * WebProcess/UserContent/WebUserContentController.h:
2774         * WebProcess/UserContent/WebUserContentController.messages.in:
2775         * WebProcess/WebPage/WebPage.cpp:
2776         (WebKit::m_cpuLimit):
2777
2778 2018-07-11  Simon Fraser  <simon.fraser@apple.com>
2779
2780         [iOS WK2] Address a possible cause of missing tiles
2781         https://bugs.webkit.org/show_bug.cgi?id=187570
2782         rdar://problem/40941118
2783
2784         Reviewed by Tim Horton.
2785         
2786         If the web process crashes, it's possible for the user to trigger a scroll before
2787         the process is re-launched. The pre-commit handler will bail early on the _isValid
2788         check without clearing _hasScheduledVisibleRectUpdate, so that remains YES and we
2789         get stuck doing no more visible content rect updates.
2790         
2791         Fix by adding -[WKWebView _didRelaunchProcess] (WKContentView got this already), and
2792         in that clear state that could have been set in the UI process while the web process
2793         connection was invalid.
2794         
2795         Also add more release logging around process termination, crash and relaunch.
2796
2797         * UIProcess/API/Cocoa/WKWebView.mm:
2798         (-[WKWebView _processDidExit]):
2799         (-[WKWebView _didRelaunchProcess]):
2800         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
2801         (-[WKWebView _updateVisibleContentRects]):
2802         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2803         * UIProcess/WebPageProxy.cpp:
2804         (WebKit::WebPageProxy::reattachToWebProcess):
2805         (WebKit::WebPageProxy::processDidTerminate):
2806         * UIProcess/WebProcessProxy.cpp:
2807         (WebKit::WebProcessProxy::didClose):
2808         (WebKit::WebProcessProxy::didFinishLaunching):
2809         * UIProcess/ios/PageClientImplIOS.mm:
2810         (WebKit::PageClientImpl::didRelaunchProcess):
2811
2812 2018-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2813
2814         Release logging dumps "Cleaning up dragging state…" every time gesture recognizers are reset in WKContentView
2815         https://bugs.webkit.org/show_bug.cgi?id=187562
2816
2817         Reviewed by Tim Horton.
2818
2819         Tweaks up a release logging statement, such that it only logs when performing a drag or drop.
2820
2821         * UIProcess/ios/WKContentViewInteraction.mm:
2822         (-[WKContentView cleanUpDragSourceSessionState]):
2823
2824 2018-07-11  Commit Queue  <commit-queue@webkit.org>
2825
2826         Unreviewed, rolling out r233741.
2827         https://bugs.webkit.org/show_bug.cgi?id=187568
2828
2829         "WKTR vs exp features, booooooo" (Requested by bradee-oh on
2830         #webkit).
2831
2832         Reverted changeset:
2833
2834         "Make process-swap-on-navigation an experimental feature."
2835         https://bugs.webkit.org/show_bug.cgi?id=187558
2836         https://trac.webkit.org/changeset/233741
2837
2838 2018-07-11  Brady Eidson  <beidson@apple.com>
2839
2840         Make process-swap-on-navigation an experimental feature.
2841         <rdar://problem/41995053> and https://bugs.webkit.org/show_bug.cgi?id=187558
2842
2843         Reviewed by Geoff Garen.
2844
2845         * Shared/WebPreferences.yaml:
2846
2847         * UIProcess/WebPreferences.cpp:
2848         (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
2849
2850         * UIProcess/WebProcessPool.cpp:
2851         (WebKit::WebProcessPool::createWebPage): If the new web page has PSON enabled via WebPreferences,
2852           absorb that setting into this process pool's configuration.
2853
2854 2018-07-11  Jer Noble  <jer.noble@apple.com>
2855
2856         Disable all network caching for HLS streams.
2857         https://bugs.webkit.org/show_bug.cgi?id=187544
2858         <rdar://problem/41863600>
2859
2860         Reviewed by Chris Dumez.
2861
2862         Revert the behavior added in r215263 where Media responses are cached if they are from
2863         a resource whose expected content length is <4MB.
2864
2865         * NetworkProcess/cache/NetworkCache.cpp:
2866         (WebKit::NetworkCache::makeStoreDecision):
2867         (WebKit::NetworkCache::expectedTotalResourceSizeFromContentRange): Deleted.
2868
2869 2018-07-11  Zan Dobersek  <zdobersek@igalia.com>
2870
2871         [WPE] AC for fixed-position elements is not enabled
2872         https://bugs.webkit.org/show_bug.cgi?id=187514
2873
2874         Reviewed by Carlos Garcia Campos.
2875
2876         Enable accelerated compositing for fixed-position elements when using
2877         AcceleratedDrawingArea and AC is force-enabled. This effectively enables
2878         this option for the WPE port which is using the AcceleratedDrawingArea
2879         implementation and not DrawingAreaImpl like the GTK+ port.
2880
2881         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2882         (WebKit::AcceleratedDrawingArea::updatePreferences):
2883
2884 2018-07-11  Christopher Reid  <chris.reid@sony.com>
2885
2886         [Win][WebKit] Disable accelerated compositing until it is supported
2887         https://bugs.webkit.org/show_bug.cgi?id=187503
2888
2889         Reviewed by Žan Doberšek.
2890
2891         * UIProcess/win/WebView.cpp:
2892
2893 2018-07-10  Tim Horton  <timothy_horton@apple.com>
2894
2895         REGRESSION (r233480): Mail contents flash black when activating
2896         https://bugs.webkit.org/show_bug.cgi?id=187504
2897         <rdar://problem/41752351>
2898
2899         Reviewed by Simon Fraser.
2900
2901         The sequence of events to reproduce the bug originally fixed in r203371
2902         is either:
2903
2904         A) the simple background/foreground case
2905
2906         1] app begins to suspend
2907         2] app suspension snapshots are taken
2908         3] WKWebView's surfaces are marked volatile
2909         4] app completes suspension
2910             ... time goes by ...
2911         5] WKWebView's volatile surfaces are purged
2912             ... time goes by ...
2913         6] app begins to resume, shows (good) suspension snapshot
2914         7] app removes suspension snapshot
2915         8] WKWebView has sublayers with purged (black) surfaces
2916         9] WKWebView sublayers are repaired by a new commit with nonvolatile surfaces
2917
2918         B) the re-snapshot while in the background case
2919
2920         1] app begins to suspend
2921         2] app suspension snapshots are taken
2922         3] WKWebView's surfaces are marked volatile
2923         4] app completes suspension
2924         ... time goes by ...
2925         5] WKWebView's volatile surfaces are purged
2926         ... time goes by ...
2927         6] app wakes up in the background to update its snapshots
2928         7] in the updated snapshots, WKWebView has sublayers with purged (black) surfaces
2929         ... time goes by ...
2930         8] app begins to resume, shows (bad) suspension snapshot
2931         9] WKWebView presents layers with purged (black) surfaces until new commit fixes them
2932         10] WKWebView sublayers are repaired by a new commit with nonvolatile surfaces
2933
2934         WebKit's current approach to fix this problem is simply to hide the
2935         WKWebView's sublayers at some point after A2/B2 (suspension snapshots),
2936         but before A8/B7 (the first time the empty layers would be presented
2937         or snapshotted).
2938
2939         Previously, we did this by hiding the layers when the window's CAContext
2940         was created, which happened early enough in both cases (at A6/B6).
2941         However, that notification was removed underneath us at some point.
2942
2943         However, in looking at the timelines, there's a better place to do this:
2944         immediately after marking the surfaces volatile (A3/B3), which is always
2945         strictly after the app suspension snapshots are taken, and also always
2946         before the freshly-made-volatile layers could be presented or snapshotted.
2947
2948         * UIProcess/ApplicationStateTracker.h:
2949         * UIProcess/ApplicationStateTracker.mm:
2950         (WebKit::ApplicationStateTracker::ApplicationStateTracker):
2951         (WebKit::ApplicationStateTracker::~ApplicationStateTracker):
2952         (WebKit::ApplicationStateTracker::applicationDidCreateWindowContext): Deleted.
2953         * UIProcess/ios/WKApplicationStateTrackingView.h:
2954         * UIProcess/ios/WKApplicationStateTrackingView.mm:
2955         (-[WKApplicationStateTrackingView didMoveToWindow]):
2956         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]): Deleted.
2957         * UIProcess/ios/WKContentView.mm:
2958         (-[WKContentView _applicationDidCreateWindowContext]): Deleted.
2959         * UIProcess/ios/WebPageProxyIOS.mm:
2960         (WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground):
2961         Remove the didCreateWindowContext notification, and hide content after
2962         snapshotting after entering the background.
2963
2964 2018-07-10  Youenn Fablet  <youenn@apple.com>
2965
2966         Make fetch() use "same-origin" credentials by default
2967         https://bugs.webkit.org/show_bug.cgi?id=176023
2968
2969         Reviewed by Chris Dumez.
2970
2971         Before the patch, when changing the credential mode in case of redirection,
2972         we were not waiting for WebProcess response to restart the load.
2973         This patch updates the implementation to ask the WebProcess whether to proceed as for other regular asynchronous loads.
2974         This requires some refactoring in particular we now pass request, redirectRequest and redirectResponse to NetworkLoadChecker
2975         that will send them back as part of the completion handler.
2976
2977         To do so, we change manual redirection handling and make it a successful case and not an error case as before.
2978
2979         * NetworkProcess/NetworkLoadChecker.cpp:
2980         (WebKit::redirectionError):
2981         (WebKit::NetworkLoadChecker::checkRedirection):
2982         * NetworkProcess/NetworkLoadChecker.h:
2983         * NetworkProcess/NetworkResourceLoader.cpp:
2984         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2985         (WebKit::NetworkResourceLoader::restartNetworkLoad):
2986         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2987         * NetworkProcess/NetworkResourceLoader.h:
2988         * NetworkProcess/PingLoad.cpp:
2989         (WebKit::PingLoad::willPerformHTTPRedirection):
2990
2991 2018-07-10  Chris Dumez  <cdumez@apple.com>
2992
2993         [IOS] We should prevent WebProcess suspension while the UIProcess is waiting for a reply from its injected bundle
2994         https://bugs.webkit.org/show_bug.cgi?id=187536
2995         <rdar://problem/41931912>
2996
2997         Reviewed by Brady Eidson.
2998
2999         Update RemoteObjectRegistry to take a background process assertion for each pending reply on the
3000         UIProcess side. Otherwise, the destination web process may get suspended and the reply block would
3001         not get called. We already do this in WebPageProxy for callbacks waiting for an IPC from the
3002         WebProcess.
3003
3004         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3005         * Shared/API/Cocoa/RemoteObjectRegistry.mm:
3006         (WebKit::RemoteObjectRegistry::RemoteObjectRegistry):
3007         (WebKit::RemoteObjectRegistry::sendInvocation):
3008         (WebKit::RemoteObjectRegistry::callReplyBlock):
3009         (WebKit::RemoteObjectRegistry::releaseUnusedReplyBlock):
3010         * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
3011         (-[_WKRemoteObjectRegistry _initWithWebPage:]):
3012         (-[_WKRemoteObjectRegistry _initWithWebPageProxy:]):
3013         (-[_WKRemoteObjectRegistry _initWithMessageSender:]): Deleted.
3014         * Shared/API/Cocoa/_WKRemoteObjectRegistryInternal.h:
3015         * UIProcess/API/Cocoa/WKWebView.mm:
3016         (-[WKWebView _remoteObjectRegistry]):
3017         * UIProcess/Cocoa/WebViewImpl.mm:
3018         (WebKit::WebViewImpl::remoteObjectRegistry):
3019         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3020         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
3021
3022 2018-07-09  Brian Burg  <bburg@apple.com>
3023
3024         WebDriver: hang when running Selenium test correct_event_firing_tests.py::testShouldEmitOnChangeEventsWhenSelectingElements[Safari]
3025         https://bugs.webkit.org/show_bug.cgi?id=187486
3026         <rdar://problem/41987110>
3027
3028         Reviewed by Tim Horton.
3029
3030         This test takes the unusual step of doing Element Click directly on a <select> element,
3031         despite the specification supporting clicking on <option> elements directly. It hangs
3032         because we fire a nested run loop when the Carbon popup menu appears, and the nested runloop
3033         is not exited until the popup menu is clicked or dismissed.
3034
3035         If a click is being simulated on the <select> via WebDriver, we should just not show
3036         the popup menu but still deliver all of the events that are fired when clicking the element.
3037
3038         * UIProcess/WebPageProxy.cpp:
3039         (WebKit::WebPageProxy::showPopupMenu):
3040
3041 2018-07-10  Tim Horton  <timothy_horton@apple.com>
3042
3043         Try to fix the build
3044
3045         * UIProcess/API/Cocoa/WKWebView.mm:
3046         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
3047
3048 2018-07-10  Tim Horton  <timothy_horton@apple.com>
3049
3050         doAfterNextPresentationUpdate should not be called while content is hidden due to animated resize
3051         https://bugs.webkit.org/show_bug.cgi?id=187500
3052         <rdar://problem/41294139>
3053
3054         Reviewed by Simon Fraser.
3055
3056         Clients generally expect that after doAfterNextPresentationUpdate, there's
3057         something vaguely sensible on the screen. They use this to remove snapshots,
3058         unhide web views, etc.
3059
3060         During some kinds of resize/rotation, we will hide the WKContentView,
3061         and asynchronously hide it when the resize/rotation is complete. This
3062         can cause clients to prematurely expose a blank WKWebView.
3063
3064         To fix this, avoid calling doAfterNextPresentationUpdate until the
3065         animated resize completes. Add a variant that does not wait for this
3066         (to be used for testing purposes).
3067
3068         * UIProcess/API/Cocoa/WKWebView.mm:
3069         (-[WKWebView _didCompleteAnimatedResize]):
3070         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
3071         Rename the vector of blocks that we call after animated resize completes
3072         to be generic rather than just about snapshots.
3073
3074         (-[WKWebView _internalDoAfterNextPresentationUpdate:withoutWaitingForPainting:withoutWaitingForAnimatedResize:]):
3075         Add this _internal variant of _doAfterNextPresentationUpdate that takes bits determining
3076         which waits to perform or avoid, to reduce duplication.
3077
3078         (-[WKWebView _doAfterNextPresentationUpdate:]):
3079         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting:]):
3080         (-[WKWebView _doAfterNextPresentationUpdateWithoutWaitingForPainting:]):
3081         Call _internalDoAfterNextPresentationUpdate with the appropriate bits set for each situation.
3082
3083         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3084         Add _doAfterNextPresentationUpdateWithoutWaitingForAnimatedResizeForTesting to WKWebView(WKTesting).
3085
3086 2018-07-10  Tim Horton  <timothy_horton@apple.com>
3087
3088         REGRESSION (r231510): Dismissing PDFPlugin context menu automatically clicks the first item
3089         https://bugs.webkit.org/show_bug.cgi?id=187507
3090         <rdar://problem/42007155>
3091
3092         Reviewed by Per Arne Vollan.
3093
3094         WebPageProxy::showPDFContextMenu, introduced in r213510, assumes that
3095         the user always chooses some item from the menu; it does not handle
3096         the case where the context menu is dismissed without selecting anything.
3097
3098         * UIProcess/WebPageProxy.h:
3099         * UIProcess/WebPageProxy.messages.in:
3100         * UIProcess/mac/WebPageProxyMac.mm:
3101         (-[WKPDFMenuTarget selectedMenuItem]):
3102         (-[WKPDFMenuTarget contextMenuAction:]):
3103         (WebKit::WebPageProxy::showPDFContextMenu):
3104         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3105         (WebKit::PDFPlugin::handleContextMenuEvent):
3106         Make showPDFContextMenu return an optional index, instead of always
3107         returning an index. Don't perform any action if it is nullopt.
3108
3109 2018-07-10  Stephan Szabo  <stephan.szabo@sony.com>
3110
3111         [WinCairo] Support display of webinspector ui on non-legacy minibrowser
3112         https://bugs.webkit.org/show_bug.cgi?id=187415
3113
3114         Reviewed by Brian Burg.
3115
3116         * UIProcess/WebInspectorProxy.h:
3117         * UIProcess/win/WebInspectorProxyWin.cpp:
3118         (WebKit::getInspectedWindowInfo):
3119         (WebKit::WebInspectorProxy::windowReceivedMessage):
3120         (WebKit::WebInspectorProxy::wndProc):
3121         (WebKit::WebInspectorProxy::registerWindowClass):
3122         (WebKit::decidePolicyForNavigationAction):
3123         (WebKit::webProcessDidCrash):
3124         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
3125         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
3126         (WebKit::WebInspectorProxy::inspectorPageURL):
3127         (WebKit::WebInspectorProxy::inspectorTestPageURL):
3128         (WebKit::WebInspectorProxy::inspectorBaseURL):
3129         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
3130         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
3131         (WebKit::WebInspectorProxy::platformAttach):
3132         (WebKit::WebInspectorProxy::platformDetach):
3133         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
3134         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
3135         (WebKit::WebInspectorProxy::platformIsFront):
3136         (WebKit::WebInspectorProxy::platformHide):
3137         (WebKit::WebInspectorProxy::platformBringToFront):
3138         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
3139         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
3140         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
3141         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
3142         (WebKit::WebInspectorProxy::platformInvalidate):
3143         (WebKit::WebInspectorProxy::platformStartWindowDrag):
3144         * WebProcess/WebPage/WebInspector.cpp:
3145         (WebKit::WebInspector::openFrontendConnection):
3146         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
3147         (WebKit::WebInspectorUI::localizedStringsURL):
3148         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
3149
3150 2018-07-10  John Wilander  <wilander@apple.com>
3151
3152         Resource Load Statistics: Make testRunner.statisticsResetToConsistentState() take a completion handler
3153         https://bugs.webkit.org/show_bug.cgi?id=187499
3154         <rdar://problem/41999431>
3155
3156         Reviewed by Chris Dumez.
3157
3158         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3159         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3160             Now uses a WTF::CallbackAggregator to call its
3161             completion handler when both the call to
3162             WebResourceLoadStatisticsStore::scheduleClearInMemory()
3163             and to
3164             WebResourceLoadStatisticsStore::resetParametersToDefaultValues()
3165             are complete.
3166         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3167         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3168         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
3169             Now takes a WTF::CompletionHandler so that it can support the
3170             completion handler in
3171             WKWebsiteDataStoreStatisticsResetToConsistentState().
3172         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
3173             Now takes a WTF::CompletionHandler so that it can support the
3174             completion handler in
3175             WKWebsiteDataStoreStatisticsResetToConsistentState().
3176         * UIProcess/WebResourceLoadStatisticsStore.h:
3177
3178 2018-07-10  Ryosuke Niwa  <rniwa@webkit.org>
3179
3180         Disable cross-origin-window-policy by default
3181         https://bugs.webkit.org/show_bug.cgi?id=187509
3182
3183         Reviewed by Chris Dumez.
3184
3185         * Shared/WebPreferences.yaml:
3186         * UIProcess/API/C/WKPreferences.cpp:
3187         (WKPreferencesSetCrossOriginWindowPolicyEnabled):
3188         (WKPreferencesGetCrossOriginWindowPolicyEnabled):
3189         * UIProcess/API/C/WKPreferencesRef.h:
3190
3191 2018-07-09  Tim Horton  <timothy_horton@apple.com>
3192
3193         REGRESSION (r232416): Flickering when going back to Google search results on back swipe
3194         https://bugs.webkit.org/show_bug.cgi?id=187506
3195         <rdar://problem/41939594>
3196
3197         Reviewed by Chris Dumez.
3198
3199         Same document navigations won't have a preceding didStartProvisionalLoadForMainFrame,
3200         so the code introduced in r232416 would immediately remove the snapshot
3201         upon any same document navigation.
3202
3203         Instead, adjust r232416 slightly to start tracking snapshot removal events
3204         after didStartProvisionalLoad OR didSameDocumentNavigation. Call the block
3205         that starts tracking, then immediately fire the same-document navigation event.
3206
3207         * UIProcess/Cocoa/ViewGestureController.cpp:
3208         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
3209         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
3210         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
3211         (WebKit::ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent):
3212         * UIProcess/Cocoa/ViewGestureController.h:
3213         * UIProcess/ios/ViewGestureControllerIOS.mm:
3214         (WebKit::ViewGestureController::endSwipeGesture):
3215         * UIProcess/mac/ViewGestureControllerMac.mm:
3216         (WebKit::ViewGestureController::endSwipeGesture):
3217
3218 2018-07-09  Youenn Fablet  <youenn@apple.com>
3219
3220         Remove cfca.com.npCryptoKit.CGB.MAC.sb and cfca.com.npP11CertEnroll.MAC.CGB.sb
3221         https://bugs.webkit.org/show_bug.cgi?id=187487
3222         <rdar://problem/41991584>
3223
3224         Reviewed by Alexey Proskuryakov.
3225
3226         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Removed.
3227         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Removed.
3228         * WebKit.xcodeproj/project.pbxproj:
3229
3230 2018-07-09  Youenn Fablet  <youenn@apple.com>
3231
3232         Add the possibility to run unsandboxed plug-ins
3233         https://bugs.webkit.org/show_bug.cgi?id=187310
3234         <rdar://problem/41798808>
3235
3236         Reviewed by Alexey Proskuryakov.
3237
3238         Add a utility method to know which plug-ins are allowed to run unsandboxed.
3239         For such plug-ins, we skip the sandboxing done when starting the plug-in process.
3240
3241         * PluginProcess/mac/PluginProcessMac.mm:
3242         (WebKit::PluginProcess::initializeSandbox):
3243         * Shared/WebPreferences.yaml:
3244         * UIProcess/Plugins/PluginInfoStore.cpp:
3245         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
3246         * UIProcess/Plugins/PluginInfoStore.h:
3247         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
3248         (WebKit::PluginInfoStore::shouldRunPluginUnsandboxed):
3249         (WebKit::PluginInfoStore::shouldUsePlugin):
3250
3251 2018-07-09  Dean Jackson  <dino@apple.com>
3252
3253         Remove fullscreen-auto-hide-delay
3254         https://bugs.webkit.org/show_bug.cgi?id=187493
3255         <rdar://problem/41830852>
3256
3257         Reviewed by Antoine Quint.
3258
3259         Now there is no delay, rename setFullscreenAutoHideTiming to setFullscreenAutoHideDuration,
3260         and only send that value over to the Web Process.
3261
3262         * UIProcess/WebFullScreenManagerProxy.cpp:
3263         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDuration):
3264         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideTiming): Deleted.
3265         * UIProcess/WebFullScreenManagerProxy.h:
3266         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3267         (-[WKFullScreenViewController viewWillAppear:]):
3268         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3269         (WebKit::WebFullScreenManager::didExitFullScreen):
3270         (WebKit::WebFullScreenManager::setFullscreenAutoHideDuration):
3271         (WebKit::WebFullScreenManager::setFullscreenAutoHideTiming): Deleted.
3272         * WebProcess/FullScreen/WebFullScreenManager.h:
3273         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
3274
3275 2018-07-09  Timothy Hatcher  <timothy@apple.com>
3276
3277         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
3278         https://bugs.webkit.org/show_bug.cgi?id=187425
3279         rdar://problem/39948240
3280
3281         Reviewed by Tim Horton.
3282
3283         * UIProcess/API/Cocoa/WKWebView.mm:
3284         (-[WKWebView _initializeWithConfiguration:]): Moved call to setUseDarkAppearance to WebViewImpl.
3285         (-[WKWebView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
3286         (-[WKWebView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
3287         (-[WKWebView _effectiveAppearanceIsDark]): Deleted.
3288         (-[WKWebView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
3289         * UIProcess/API/mac/WKView.mm:
3290         (-[WKView viewDidChangeEffectiveAppearance]): Added. This is the proper NSView method to use.
3291         (-[WKView _setUseSystemAppearance:]): No need to call setUseDarkAppearance here anymore.
3292         (-[WKView _effectiveAppearanceIsDark]): Deleted.
3293         (-[WKView effectiveAppearanceDidChange]): Deleted. This method is a deprecated name.
3294         * UIProcess/Cocoa/WebViewImpl.h:
3295         * UIProcess/Cocoa/WebViewImpl.mm:
3296         (WebKit::WebViewImpl::WebViewImpl): Call setUseDarkAppearance before page config is sent in initializeWebPage.
3297         (WebKit::WebViewImpl::effectiveAppearanceDidChange): Added.
3298         * WebProcess/WebPage/WebPage.cpp:
3299         (WebKit::WebPage::setUseDarkAppearance): WebCore::Page::setUseDarkAppearance now handles the style changes.
3300         The RenderTheme color caches also don't need cleared with platformColorsDidChange(), since we cache light
3301         and dark colors seperatly in RenderThemeMac.
3302
3303 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
3304
3305         Shrink various loading-related enums to shrink CachedResource
3306         https://bugs.webkit.org/show_bug.cgi?id=187443
3307
3308         Reviewed by Chris Dumez.
3309
3310         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
3311         (WebKit::LegacyCustomProtocolManager::wasRedirectedToRequest):
3312         * NetworkProcess/NetworkLoad.cpp:
3313         (WebKit::NetworkLoad::continueWillSendRequest):
3314         * NetworkProcess/NetworkLoadParameters.h:
3315         * NetworkProcess/NetworkResourceLoader.cpp:
3316         (WebKit::NetworkResourceLoader::canUseCache const):
3317         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3318         * NetworkProcess/cache/NetworkCache.cpp:
3319         (WebKit::NetworkCache::cachePolicyAllowsExpired):
3320         (WebKit::NetworkCache::makeRetrieveDecision):
3321         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3322         (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad):
3323         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3324         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3325         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3326         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
3327         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
3328         * Shared/API/c/mac/WKURLRequestNS.mm:
3329         (WKURLRequestCopyNSURLRequest):
3330         * Shared/Cocoa/WKNSURLRequest.mm:
3331         (-[WKNSURLRequest _web_createTarget]):
3332         * Shared/mac/WebCoreArgumentCodersMac.mm:
3333         (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
3334         * UIProcess/API/Cocoa/WKFrameInfo.mm:
3335         (-[WKFrameInfo request]):
3336         * UIProcess/API/Cocoa/WKNavigation.mm:
3337         (-[WKNavigation _request]):
3338         * UIProcess/API/Cocoa/WKNavigationAction.mm:
3339         (-[WKNavigationAction request]):
3340         * UIProcess/API/Cocoa/WKNavigationData.mm:
3341         (-[WKNavigationData originalRequest]):
3342         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3343         (-[WKNavigationResponse _request]):
3344         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
3345         (-[WKURLSchemeTaskImpl request]):
3346         * UIProcess/API/Cocoa/_WKDownload.mm:
3347         (-[_WKDownload request]):
3348         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
3349         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
3350         * WebProcess/Network/WebLoaderStrategy.cpp:
3351         (WebKit::maximumBufferingTime):
3352         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3353         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3354         * WebProcess/WebPage/mac/WebPageMac.mm:
3355         (WebKit::WebPage::platformCanHandleRequest):
3356
3357 2018-07-09  Chris Dumez  <cdumez@apple.com>
3358
3359         WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData() fails to protect the page in its lambda
3360         https://bugs.webkit.org/show_bug.cgi?id=187478
3361         <rdar://problem/41975998>
3362
3363         Reviewed by Youenn Fablet.
3364
3365         Make sure we protect the WebPageProxy when we capture it in the lambda or it might go away by the
3366         time the lambda gets called.
3367
3368         * UIProcess/WebProcessProxy.cpp:
3369         (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
3370
3371 2018-07-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3372
3373         [Curl] Remove unused AuthenticationManager static methods.
3374         https://bugs.webkit.org/show_bug.cgi?id=187419
3375
3376         Reviewed by Yusuke Suzuki.
3377
3378         The file for curl port was added without implementation and never called from anyware.
3379         Also interfaces only used by the curl port were removed from the shared header file.
3380
3381         * PlatformWin.cmake:
3382         * Shared/Authentication/AuthenticationManager.h:
3383         * Shared/Authentication/curl/AuthenticationManagerCurl.cpp: Removed.
3384
3385 2018-07-09  Stephan Szabo  <stephan.szabo@sony.com>
3386
3387         Check that LayerTreeHost was created before use
3388         https://bugs.webkit.org/show_bug.cgi?id=187404
3389
3390         Reviewed by Žan Doberšek.
3391
3392         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3393         (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
3394
3395 2018-07-09  Commit Queue  <commit-queue@webkit.org>
3396
3397         Unreviewed, rolling out r233612.
3398         https://bugs.webkit.org/show_bug.cgi?id=187475
3399
3400         Revision caused the api test LinkColorWithSystemAppearance to
3401         fail on all systems. (Requested by Truitt on #webkit).
3402
3403         Reverted changeset:
3404
3405         "Semantic colors don't update when accessibility Increase
3406         Contrast mode is enabled."
3407         https://bugs.webkit.org/show_bug.cgi?id=187425
3408         https://trac.webkit.org/changeset/233612
3409
3410 2018-07-09  Brian Burg  <bburg@apple.com>
3411
3412         WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
3413         https://bugs.webkit.org/show_bug.cgi?id=187418
3414         <rdar://problem/41909520>
3415
3416         Unreviewed build fix for Sierra.
3417
3418         * UIProcess/WebPageProxy.cpp:
3419         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3420         According to some compilers, the local 'automationSession' is unused. Change this
3421         to just convert the return value to boolean rather than assign to an unused local.
3422
3423 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3424
3425