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