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