Deprecate WKConnection
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-10-02  Alex Christensen  <achristensen@webkit.org>
2
3         Deprecate WKConnection
4         https://bugs.webkit.org/show_bug.cgi?id=190147
5
6         Reviewed by Andy Estes.
7
8         * Shared/Cocoa/APIObject.mm:
9         (API::Object::newObject):
10         * UIProcess/API/Cocoa/WKConnection.h:
11         * UIProcess/API/Cocoa/WKConnection.mm:
12         (didReceiveMessage):
13         (didClose):
14         * UIProcess/API/Cocoa/WKConnectionInternal.h:
15         * UIProcess/API/Cocoa/WKProcessGroup.h:
16         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
17         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
18
19 2018-10-01  Dean Jackson  <dino@apple.com>
20
21         [macOS] Switching to discrete GPU should be done in the UI process
22         https://bugs.webkit.org/show_bug.cgi?id=189361
23         <rdar://problem/43949622>
24
25         Reviewed by Simon Fraser.
26
27         Implement the UI-side process for triggering a GPU mux.
28
29         * Platform/Logging.h: Add a WebGL logging channel.
30
31         * SourcesCocoa.txt: Add the new files: WebSwitchingGPUClient and HighPerformanceGPUManager.
32
33         * UIProcess/Cocoa/WebProcessProxyCocoa.mm: UI process calls that use HighPerformanceGPUManager
34         to keep track of whether or not this process needs the high-performance GPU.
35         (WebKit::WebProcessProxy::requestHighPerformanceGPU):
36         (WebKit::WebProcessProxy::releaseHighPerformanceGPU):
37
38         * UIProcess/WebProcessProxy.cpp:
39         (WebKit::WebProcessProxy::~WebProcessProxy): Make sure to unregister with the HighPerformanceGPUManager
40         as the process disappears without manually removing itself (e.g. crashes).
41         * UIProcess/WebProcessProxy.h:
42         * UIProcess/WebProcessProxy.messages.in: New messages.
43
44         * UIProcess/mac/HighPerformanceGPUManager.cpp: New class that copies most of what used
45         to live in GraphicsContext3DManager. It creates a CGLPixelFormat object when it sees
46         that at least one process needs the high-performance GPU.
47         (WebKit::HighPerformanceGPUManager::singleton):
48         (WebKit::HighPerformanceGPUManager::addProcessRequiringHighPerformance):
49         (WebKit::HighPerformanceGPUManager::removeProcessRequiringHighPerformance):
50         (WebKit::HighPerformanceGPUManager::updateState):
51         * UIProcess/mac/HighPerformanceGPUManager.h: Added.
52
53         * WebKit.xcodeproj/project.pbxproj: Add new files.
54
55         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.cpp: Implementation of the SwitchingGPUClient for
56         WebCore, which sends messages to the UI process.
57         (WebKit::WebSwitchingGPUClient::singleton):
58         (WebKit::WebSwitchingGPUClient::requestHighPerformanceGPU):
59         (WebKit::WebSwitchingGPUClient::releaseHighPerformanceGPU):
60         * WebProcess/WebCoreSupport/mac/WebSwitchingGPUClient.h: Added.
61
62         * WebProcess/cocoa/WebProcessCocoa.mm: Register the GPUClient.
63         (WebKit::WebProcess::platformInitializeProcess):
64
65 2018-10-02  Sihui Liu  <sihui_liu@apple.com>
66
67         Fix a potential crash in NetworkProcess::deleteWebsiteDataForOrigins
68         https://bugs.webkit.org/show_bug.cgi?id=190220
69
70         Reviewed by Chris Dumez.
71
72         * NetworkProcess/NetworkProcess.cpp:
73         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
74
75 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
76
77         [WebKit2] Format > Bold and Format > Italic don't toggle between bold and italic style
78         https://bugs.webkit.org/show_bug.cgi?id=179787
79         <rdar://problem/35593389>
80
81         Reviewed by Tim Horton.
82
83         Fixes the bug by relaxing our policy in WebViewImpl::updateFontManagerIfNeeded. Instead of updating only when
84         the font panel is visible, update when either the font panel is visible, or the selection is in a richly
85         editable area. In the latter case, an up-to-date NSFontManager state is needed in order for certain font
86         formatting menu items, such as bold and italic, to correctly toggle state.
87
88         Test: FontManagerTests.ToggleBoldAndItalicWithMenuItems
89
90         * UIProcess/Cocoa/WebViewImpl.h:
91         * UIProcess/Cocoa/WebViewImpl.mm:
92         (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]):
93         (WebKit::WebViewImpl::selectionDidChange):
94         (WebKit::WebViewImpl::updateFontManagerIfNeeded):
95
96         Rename updateFontPanelIfNeeded to updateFontManagerIfNeeded, to reflect the new behavior.
97
98         (WebKit::WebViewImpl::changeFontAttributesFromSender):
99         (WebKit::WebViewImpl::changeFontFromFontManager):
100         (WebKit::WebViewImpl::updateFontPanelIfNeeded): Deleted.
101
102 2018-10-02  Alex Christensen  <achristensen@webkit.org>
103
104         Remove ParsedURLString
105         https://bugs.webkit.org/show_bug.cgi?id=190154
106
107         Reviewed by Chris Dumez.
108
109         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
110         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
111         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
112         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
113         * PluginProcess/PluginControllerProxy.cpp:
114         (WebKit::PluginControllerProxy::streamWillSendRequest):
115         (WebKit::PluginControllerProxy::streamDidReceiveResponse):
116         (WebKit::PluginControllerProxy::manualStreamDidReceiveResponse):
117         * Shared/API/APIUserContentURLPattern.h:
118         (API::UserContentURLPattern::matchesURL const):
119         * Shared/WebBackForwardListItem.cpp:
120         (WebKit::WebBackForwardListItem::itemIsInSameDocument const):
121         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
122         (WebKit::RemoteInspectorProtocolHandler::handleRequest):
123         (WebKit::RemoteInspectorProtocolHandler::targetListChanged):
124         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
125         (WebKit::PluginProcessProxy::openURL):
126         * UIProcess/SuspendedPageProxy.cpp:
127         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
128         * UIProcess/WebPageProxy.cpp:
129         (WebKit::WebPageProxy::loadFile):
130         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
131         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
132         (WebKit::WebPageProxy::createNewPage):
133         (WebKit::WebPageProxy::processDidTerminate):
134         * UIProcess/WebProcessPool.cpp:
135         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
136         (WebKit::WebProcessPool::processForNavigationInternal):
137         * UIProcess/WebProcessProxy.cpp:
138         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
139         * UIProcess/mac/WebContextMenuProxyMac.mm:
140         (WebKit::WebContextMenuProxyMac::createShareMenuItem):
141         * WebProcess/InjectedBundle/InjectedBundle.cpp:
142         (WebKit::InjectedBundle::addUserScript):
143         (WebKit::InjectedBundle::addUserStyleSheet):
144         (WebKit::InjectedBundle::removeUserScript):
145         (WebKit::InjectedBundle::removeUserStyleSheet):
146         * WebProcess/Plugins/Plugin.cpp:
147         (WebKit::Plugin::Parameters::decode):
148         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
149         (WebKit::WebPlatformStrategies::url):
150         (WebKit::WebPlatformStrategies::readURLFromPasteboard):
151
152 2018-10-01  Dean Jackson  <dino@apple.com>
153
154         Remove CSS Animation Triggers
155         https://bugs.webkit.org/show_bug.cgi?id=190175
156         <rdar://problem/44925626>
157
158         Reviewed by Simon Fraser.
159
160         * Configurations/FeatureDefines.xcconfig:
161
162 2018-10-02  Michael Catanzaro  <mcatanzaro@igalia.com>
163
164         REGRESSION(r236662): Fix -Wformat warnings in CacheStorageEngineCaches.cpp
165         https://bugs.webkit.org/show_bug.cgi?id=190205
166
167         Reviewed by Chris Dumez.
168
169         Passing enums to %d is not kosher, at least not according to GCC's -Wformat. Avoid it.
170
171         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
172         (WebKit::CacheStorage::Caches::initialize):
173         (WebKit::CacheStorage::Caches::readCachesFromDisk):
174         (WebKit::CacheStorage::Caches::writeCachesToDisk):
175
176 2018-10-02  Commit Queue  <commit-queue@webkit.org>
177
178         Unreviewed, rolling out r236624 and r236671.
179         https://bugs.webkit.org/show_bug.cgi?id=190207
180
181         The change in r236624 introduced crashes on the bots
182         (Requested by ryanhaddad on #webkit).
183
184         Reverted changesets:
185
186         "Refactoring: eliminate raw pointer usage in Fullscreen code"
187         https://bugs.webkit.org/show_bug.cgi?id=188747
188         https://trac.webkit.org/changeset/236624
189
190         "Unify implementation in VideoFullscreenInterfaceAVKit"
191         https://bugs.webkit.org/show_bug.cgi?id=190091
192         https://trac.webkit.org/changeset/236671
193
194 2018-10-02  Antti Koivisto  <antti@apple.com>
195
196         WebPageProxy::reattachToWebProcess cleanups
197         https://bugs.webkit.org/show_bug.cgi?id=189881
198
199         Reviewed by Chris Dumez.
200
201         Change the factoring to separate swap and crash code paths into different functions.
202
203         * UIProcess/WebPageProxy.cpp:
204         (WebKit::WebPageProxy::reattachToWebProcess):
205         (WebKit::WebPageProxy::swapToWebProcess):
206
207         Separate function for the swap case.
208
209         (WebKit::WebPageProxy::finishAttachingToWebProcess):
210
211         Factor the common parts here.
212
213         (WebKit::WebPageProxy::continueNavigationInNewProcess):
214         * UIProcess/WebPageProxy.h:
215
216 2018-10-02  Adrian Perez de Castro  <aperez@igalia.com>
217
218         [GTK] Theming of authentication dialog breaks with themes other than Adwaita
219         https://bugs.webkit.org/show_bug.cgi?id=190117
220
221         Reviewed by Michael Catanzaro.
222
223         Adds the missing GTK_STYLE_CLASS_BACKGROUND to the WebKitWebViewDialog
224         widget, which was missing for GTK+ 3.20 or newer, and set the widget
225         as app-paintable to avoid the base class paint method to add an opaque
226         background.
227
228         Thanks to Benjamin Otte for the guidance to debug the theming issues.
229
230         * UIProcess/API/gtk/WebKitWebViewDialog.cpp:
231         (webkitWebViewDialogDraw): Remove the style context save/restore, it
232         is unneeded because the style classes are set at widget construction
233         time and not changed ever after.
234         (webkitWebViewDialogConstructed): Mark the widget as app-paintable to
235         avoid the base widget paint operation to fill the whole background,
236         because the dialog widget paints the translucent overlay itself; and
237         also add the missing GTK_STYLE_CLASS_BACKGROUND class at construction
238         when building against GTK+ 3.20 or newer.
239
240 2018-10-02  Eric Carlson  <eric.carlson@apple.com>
241
242         [MediaStream] RealtimeMediaSource should be able to vend hashed IDs
243         https://bugs.webkit.org/show_bug.cgi?id=190142
244         <rdar://problem/44911109>
245
246         Reviewed by Youenn Fablet.
247
248         * Shared/WebCoreArgumentCoders.cpp:
249         (IPC::ArgumentCoder<MediaConstraints>::encode):
250         (IPC::ArgumentCoder<MediaConstraints>::decode):
251         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
252         (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
253         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
254         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
255         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
256         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
257         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
258         (WebKit::UserMediaCaptureManager::Source::Source):
259         (WebKit::UserMediaCaptureManager::createCaptureSource):
260         * WebProcess/cocoa/UserMediaCaptureManager.h:
261
262 2018-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
263
264         [macOS] Implement a way for the UI process to request typing attributes at the current selection
265         https://bugs.webkit.org/show_bug.cgi?id=189983
266         <rdar://problem/44648705>
267
268         Reviewed by Ryosuke Niwa.
269
270         Implements `-[WKWebView typingAttributesWithCompletionHandler:]`, which asynchronously retrieves an NSDictionary
271         containing the typing attributes at the start of the current selection. This is a new asynchronous text input
272         client hook on macOS that is needed in order to support NSInspectorBar on WKWebView.
273
274         At a high level, this patch builds on top of refactoring done in r236445 to make it possible to send typing
275         attributes from the web process to the UI process, and then adds plumbing in the WebKit2 client layer to surface
276         typing attributes to WKWebView on macOS.
277
278         Tests:  FontManagerTests.TypingAttributesAfterSubscriptAndSuperscript
279                 FontManagerTests.ChangeTypingAttributesWithInspectorBar
280                 FontManagerTests.ChangeAttributesWithFontEffectsBox
281
282         * Platform/spi/mac/AppKitSPI.h:
283         * Shared/WebCoreArgumentCoders.cpp:
284         (IPC::ArgumentCoder<FontAttributes>::encode):
285         (IPC::ArgumentCoder<FontAttributes>::decode):
286
287         Implement IPC coding support for FontAttributes.
288
289         * Shared/WebCoreArgumentCoders.h:
290         * Shared/mac/ArgumentCodersMac.h:
291         * Shared/mac/ArgumentCodersMac.mm:
292         (IPC::encode):
293         (IPC::decode):
294
295         Add the ability to encode and decode UIFont. This allows Cocoa platforms to send `FontAttributes.font` over IPC
296         with a single call to IPC::encode/IPC::decode.
297
298         * UIProcess/API/Cocoa/WKWebView.mm:
299         (-[WKWebView typingAttributesWithCompletionHandler:]):
300
301         Add plumbing to WebViewImpl.
302
303         * UIProcess/Cocoa/WebViewImpl.h:
304         * UIProcess/Cocoa/WebViewImpl.mm:
305         (WebKit::WebViewImpl::selectionDidChange):
306
307         Update the NSInspectorBar on selection change, but only if it is present and visible, and WKWebView is currently
308         first responder.
309
310         (WebKit::WebViewImpl::typingAttributesWithCompletionHandler):
311
312         Call into WebPageProxy to retrieve FontAttributes from the web process, and invoke the callback with an
313         NSDictionary constructed from the retrieved FontAttributes.
314
315         * UIProcess/WebPageProxy.cpp:
316         (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart):
317         (WebKit::WebPageProxy::fontAttributesCallback):
318
319         Add plumbing to retrieve FontAttributes from the web process at the current selection. Additionally, cache the
320         font attributes to avoid doing extra work during subsequent requests.
321
322         (WebKit::WebPageProxy::resetStateAfterProcessExited):
323         * UIProcess/WebPageProxy.h:
324         (WebKit::WebPageProxy::cachedFontAttributesAtSelectionStart const):
325         * UIProcess/WebPageProxy.messages.in:
326         * UIProcess/ios/WebPageProxyIOS.mm:
327         (WebKit::WebPageProxy::editorStateChanged):
328         * UIProcess/mac/WebPageProxyMac.mm:
329         (WebKit::WebPageProxy::editorStateChanged):
330
331         Invalidate cached font attributes.
332
333         * WebKit.xcodeproj/project.pbxproj:
334         * WebProcess/WebPage/WebPage.cpp:
335         (WebKit::WebPage::requestFontAttributesAtSelectionStart):
336
337         Use the currently focused frame's Editor to compute FontAttributes at the current selection, and send the
338         computed FontAttributes back to the UI process.
339
340         * WebProcess/WebPage/WebPage.h:
341         * WebProcess/WebPage/WebPage.messages.in:
342
343 2018-10-01  Devin Rousso  <drousso@apple.com>
344
345         Web Inspector: remove analyzer manager
346         https://bugs.webkit.org/show_bug.cgi?id=190162
347
348         Reviewed by Joseph Pecoraro.
349
350         * InspectorGResources.cmake:
351         Remove eslint.
352
353 2018-09-30  Ryosuke Niwa  <rniwa@webkit.org>
354
355         Add a new variant of serializePreservingVisualAppearance which takes VisibleSelection
356         https://bugs.webkit.org/show_bug.cgi?id=190108
357
358         Reviewed by Wenson Hsieh.
359
360         Adopt the new variant which directly takes VisibleSelection.
361
362         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
363         (WebKit::WebEditorClient::updateGlobalSelection):
364
365 2018-10-01  Andy Estes  <aestes@apple.com>
366
367         [watchOS] Adopt NSURLSessionCompanionProxyPreference
368         https://bugs.webkit.org/show_bug.cgi?id=190177
369         <rdar://problem/43402114>
370
371         Reviewed by Wenson Hsieh.
372
373         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
374         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
375
376 2018-10-01  Chris Dumez  <cdumez@apple.com>
377
378         [Mac] The UIProcess should listen to memory pressure signals
379         https://bugs.webkit.org/show_bug.cgi?id=190166
380
381         Reviewed by Simon Fraser.
382
383         The UIProcess should listen to memory pressure signals on Mac in order to free memory, similarly to what we already
384         do on iOS. The memory pressure handler currently discards view snapshots and prewarmed processes.
385
386         * SourcesCocoa.txt:
387         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.h: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.h.
388         * UIProcess/Cocoa/WebMemoryPressureHandlerCocoa.mm: Renamed from Source/WebKit/UIProcess/ios/WebMemoryPressureHandlerIOS.mm.
389         (WebKit::installMemoryPressureHandler):
390         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
391         (WebKit::WebProcessPool::platformInitialize):
392         * WebKit.xcodeproj/project.pbxproj:
393
394 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
395
396         Fix Internal iOS Build after r236690
397         https://bugs.webkit.org/show_bug.cgi?id=190171
398
399         Reviewed by Alex Christensen.
400
401         * Platform/ExtraPrivateSymbolsForTAPI.h:
402
403 2018-10-01  Wenson Hsieh  <wenson_hsieh@apple.com>
404
405         [iOS] Add SPI to customize the input accessory view when focusing an element
406         https://bugs.webkit.org/show_bug.cgi?id=190152
407         <rdar://problem/42754975>
408
409         Reviewed by Dan Bernstein.
410
411         Adds SPI on WKFormInputSession to customize the input accessory view, alongside the input view. See below for
412         more details.
413
414         Test: KeyboardInputTests.CustomInputViewAndInputAccessoryView
415
416         * UIProcess/API/Cocoa/_WKFormInputSession.h:
417         * UIProcess/ios/WKContentViewInteraction.mm:
418         (-[WKFormInputSession customInputAccessoryView]):
419         (-[WKFormInputSession setCustomInputAccessoryView:]):
420
421         Reload input views when the custom input accessory view changes.
422
423         (-[WKContentView requiresAccessoryView]):
424
425         If a custom input accessory view is specified, return YES.
426
427         (-[WKContentView inputAccessoryView]):
428
429         Return the custom input accessory view if present, and fall back to the default web form accessory view.
430
431 2018-10-01  Sihui Liu  <sihui_liu@apple.com>
432
433         Remove StorageProcess
434         https://bugs.webkit.org/show_bug.cgi?id=189975
435
436         Reviewed by Geoffrey Garen.
437
438         * CMakeLists.txt:
439         * Configurations/Storage-OSX-sandbox.entitlements: Removed.
440         * Configurations/StorageService.xcconfig: Removed.
441         * Configurations/WebKit.xcconfig:
442         * DerivedSources.make:
443         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
444         (WebKit::WebIDBConnectionToClient::putOrAdd):
445         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
446         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
447         * PlatformGTK.cmake:
448         * PlatformMac.cmake:
449         * PlatformWPE.cmake:
450         * PlatformWin.cmake:
451         * Shared/ProcessExecutablePath.h:
452         * Shared/Storage/StorageProcessCreationParameters.cpp: Removed.
453         * Shared/Storage/StorageProcessCreationParameters.h: Removed.
454         * Shared/glib/ProcessExecutablePathGLib.cpp:
455         (WebKit::executablePathOfStorageProcess): Deleted.
456         * Sources.txt:
457         * SourcesCocoa.txt:
458         * SourcesGTK.txt:
459         * SourcesWPE.txt:
460         * StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist: Removed.
461         * StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm: Removed.
462         * StorageProcess/EntryPoint/unix/StorageProcessMain.cpp: Removed.
463         * StorageProcess/EntryPoint/win/StorageProcessMain.cpp: Removed.
464         * StorageProcess/StorageProcess.cpp: Removed.
465         * StorageProcess/StorageProcess.h: Removed.
466         * StorageProcess/StorageProcess.messages.in: Removed.
467         * StorageProcess/StorageToWebProcessConnection.cpp: Removed.
468         * StorageProcess/StorageToWebProcessConnection.h: Removed.
469         * StorageProcess/StorageToWebProcessConnection.messages.in: Removed.
470         * StorageProcess/glib/StorageProcessMainGLib.cpp: Removed.
471         * StorageProcess/ios/StorageProcessIOS.mm: Removed.
472         * StorageProcess/mac/StorageProcessMac.mm: Removed.
473         * StorageProcess/mac/com.apple.WebKit.Storage.sb.in: Removed.
474         * StorageProcess/unix/StorageProcessMainUnix.h: Removed.
475         * StorageProcess/win/StorageProcessMainWin.cpp: Removed.
476         * StorageProcess/win/StorageProcessMainWin.h: Removed.
477         * UIProcess/API/C/WKContext.cpp:
478         (WKContextTerminateStorageProcess): Deleted.
479         (WKContextGetDatabaseProcessIdentifier): Deleted.
480         * UIProcess/API/C/WKContext.h:
481         * UIProcess/API/C/WKContextPrivate.h:
482         * UIProcess/API/Cocoa/WKProcessPool.mm:
483         (-[WKProcessPool _terminateStorageProcess]): Deleted.
484         (-[WKProcessPool _storageProcessIdentifier]): Deleted.
485         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
486         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
487         (WebKit::ProcessLauncher::launchProcess):
488         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
489         (WebKit::processName):
490         * UIProcess/Storage/StorageProcessProxy.cpp: Removed.
491         * UIProcess/Storage/StorageProcessProxy.h: Removed.
492         * UIProcess/Storage/StorageProcessProxy.messages.in: Removed.
493         * UIProcess/WebContextClient.cpp:
494         (WebKit::WebContextClient::storageProcessDidCrash): Deleted.
495         * UIProcess/WebContextClient.h:
496         * UIProcess/WebContextSupplement.h:
497         * UIProcess/WebProcessPool.cpp:
498         (WebKit::WebProcessPool::sendMemoryPressureEvent):
499         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
500         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore): Deleted.
501         (WebKit::WebProcessPool::getStorageProcessConnection): Deleted.
502         (WebKit::WebProcessPool::storageProcessCrashed): Deleted.
503         (WebKit::WebProcessPool::storageProcessIdentifier): Deleted.
504         (WebKit::WebProcessPool::terminateStorageProcessForTesting): Deleted.
505         * UIProcess/WebProcessPool.h:
506         (WebKit::WebProcessPool::sendToStorageProcess): Deleted.
507         (WebKit::WebProcessPool::sendToStorageProcessRelaunchingIfNecessary): Deleted.
508         * UIProcess/WebProcessProxy.cpp:
509         (WebKit::WebProcessProxy::getStorageProcessConnection): Deleted.
510         * UIProcess/WebProcessProxy.h:
511         * UIProcess/WebProcessProxy.messages.in:
512         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
513         (WebKit::WebsiteDataStore::~WebsiteDataStore):
514         (WebKit::WebsiteDataStore::storageProcessParameters): Deleted.
515         * UIProcess/WebsiteData/WebsiteDataStore.h:
516         * WebKit.xcodeproj/project.pbxproj:
517         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
518         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
519         * WebProcess/Storage/WebToStorageProcessConnection.cpp: Removed.
520         * WebProcess/Storage/WebToStorageProcessConnection.h: Removed.
521         * WebProcess/WebProcess.cpp:
522         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
523         (WebKit::WebProcess::webToStorageProcessConnectionClosed): Deleted.
524         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Deleted.
525         * WebProcess/WebProcess.h:
526         * webkitglib-symbols.map:
527
528 2018-10-01  David Quesada  <david_quesada@apple.com>
529
530         Add missing Objective-C versions of downloads SPI
531         https://bugs.webkit.org/show_bug.cgi?id=190149
532         rdar://problem/44915592
533
534         Reviewed by Alex Christensen.
535
536         * UIProcess/API/Cocoa/WKProcessPool.mm:
537         (-[WKProcessPool _downloadURLRequest:]):
538         (-[WKProcessPool _resumeDownloadFromData:path:]):
539         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
540         * UIProcess/API/Cocoa/_WKDownload.h:
541         * UIProcess/API/Cocoa/_WKDownload.mm:
542         (-[_WKDownload resumeData]):
543         * UIProcess/API/Cocoa/_WKDownloadInternal.h:
544         * UIProcess/Cocoa/DownloadClient.mm:
545             Move the DownloadProxy's WrapperTraits out of DownloadClient, and into the internal
546             header so it can be used from other classes (i.e. WKProcessPool here).
547
548 2018-10-01  Alex Christensen  <achristensen@webkit.org>
549
550         Fix internal build after r236665
551         https://bugs.webkit.org/show_bug.cgi?id=189850
552
553         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
554         * WebKit.xcodeproj/project.pbxproj:
555
556 2018-10-01  Jiewen Tan  <jiewen_tan@apple.com>
557
558         [WebAuthN] Import a JS CBOR coder
559         https://bugs.webkit.org/show_bug.cgi?id=189877
560         <rdar://problem/44701124>
561
562         Reviewed by Chris Dumez.
563
564         Update MockWebAuthenticationConfiguration to have userCertificateBase64 and intermediateCACertificateBase64
565         as Local's memeber such that tests can pass those certificates to MockLocalConnection instead of letting it
566         holds some static ones.
567
568         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
569         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
570         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
571         (WebKit::MockLocalConnection::getAttestation const):
572         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
573
574 2018-10-01  Chris Dumez  <cdumez@apple.com>
575
576         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
577         https://bugs.webkit.org/show_bug.cgi?id=190052
578
579         Reviewed by Ryosuke Niwa.
580
581         * Platform/IPC/Connection.cpp:
582         (IPC::Connection::sendMessage):
583         * Platform/IPC/Connection.h:
584         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
585         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
586         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
587         * WebProcess/WebPage/WebPage.cpp:
588         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
589         * WebProcess/WebPage/WebPage.h:
590
591 2018-10-01  Daniel Bates  <dabates@apple.com>
592
593         [iOS] Special keys are misidentified in DOM keyboard events
594         https://bugs.webkit.org/show_bug.cgi?id=189974
595
596         Reviewed by Wenson Hsieh.
597
598         Take the key code of WebEvent to be the key code for the new WebKeyboardEvent verbatim
599         now that we normalize the character strings of the WebEvent to account for the special
600         UIKit input strings.
601
602         * Shared/ios/WebIOSEventFactory.mm:
603         (WebIOSEventFactory::createWebKeyboardEvent):
604
605 2018-10-01  Alex Christensen  <achristensen@webkit.org>
606
607         Fix an internal build after r236665
608         https://bugs.webkit.org/show_bug.cgi?id=189850
609
610         * WebKit.xcodeproj/project.pbxproj:
611         Make WKNSURLAuthenticationChallenge.h a private header.
612
613 2018-10-01  Alex Christensen  <achristensen@webkit.org>
614
615         URL should not use TextEncoding internally
616         https://bugs.webkit.org/show_bug.cgi?id=190111
617
618         Reviewed by Andy Estes.
619
620         * UIProcess/WebInspectorProxy.cpp:
621
622 2018-10-01  Jeremy Jones  <jeremyj@apple.com>
623
624         Unify implementation in VideoFullscreenInterfaceAVKit
625         https://bugs.webkit.org/show_bug.cgi?id=190091
626         rdar://problem/44734523
627
628         Reviewed by Jer Noble.
629
630         Unified code in VideoFullscreenInterfaceAVKit now that new code path is proven and include
631         any changes that had been made in the old path.
632
633         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
634         * WebProcess/cocoa/VideoFullscreenManager.mm:
635         (WebKit::VideoFullscreenManager::supportsVideoFullscreenStandby const):
636         (WebKit::VideoFullscreenManager::didSetupFullscreen):
637         (WebKit::VideoFullscreenManager::didExitFullscreen):
638
639 2018-10-01  Daniel Bates  <dabates@apple.com>
640
641         [iOS] Wrong key event may be sent to UIKit
642         https://bugs.webkit.org/show_bug.cgi?id=189992
643
644         Reviewed by Simon Fraser.
645
646         Retain a clone of a received UIEvent if it is for a hardware key event so as to ensure that we
647         notify the UIKit keyboard code of the correct keyboard event.
648
649         Currently the UIProcess retains the UIEvent associated with a keyboard event so as to defer
650         notifying the UIKit keyboard code (via -_handleKeyUIEvent) about a received keyboard event until
651         after the WebProcess has processed the raw key event. If this UIEvent is for a hardware keyboard
652         event then it is not sufficient to retain it to preserve its value because UIKit uses a singleton
653         UIEvent for all hardware keyboard events ;=> its value will be clobbered as each hardware keyboard
654         event is received. Instead we need to explicitly clone a UIEvent for a hardware key event before
655         retaining it.
656
657         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
658         * UIProcess/ios/WKContentViewInteraction.mm:
659         (-[WKContentView handleKeyEvent:]): Clone the UIEvent if it is for a hardware key event.
660
661 2018-10-01  Alex Christensen  <achristensen@webkit.org>
662
663         Deprecate ObjC SPI in Deprecated Xcode group
664         https://bugs.webkit.org/show_bug.cgi?id=189850
665
666         Reviewed by Andy Estes.
667
668         * Shared/Cocoa/APIObject.mm:
669         (API::Object::newObject):
670         * Shared/mac/ObjCObjectGraph.mm:
671         (WebKit::typeFromObject):
672         (WebKit::ObjCObjectGraph::encode):
673         (WebKit::ObjCObjectGraph::decode):
674         * UIProcess/API/Cocoa/WKBrowsingContextController.h:
675         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
676         (didStartProvisionalNavigation):
677         (didReceiveServerRedirectForProvisionalNavigation):
678         (didFailProvisionalNavigation):
679         (didCommitNavigation):
680         (didFinishNavigation):
681         (didFailNavigation):
682         (canAuthenticateAgainstProtectionSpace):
683         (didReceiveAuthenticationChallenge):
684         (processDidCrash):
685         (setUpPagePolicyClient):
686         * UIProcess/API/Cocoa/WKBrowsingContextGroup.h:
687         * UIProcess/API/Cocoa/WKBrowsingContextGroupInternal.h:
688         * UIProcess/API/Cocoa/WKBrowsingContextHistoryDelegate.h:
689         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegate.h:
690         * UIProcess/API/Cocoa/WKBrowsingContextLoadDelegatePrivate.h:
691         * UIProcess/API/Cocoa/WKBrowsingContextPolicyDelegate.h:
692         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.h:
693         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
694         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
695         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
696         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
697         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
698         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
699         * UIProcess/API/Cocoa/WKNavigationData.h:
700         * UIProcess/API/Cocoa/WKNavigationDataInternal.h:
701         * UIProcess/API/Cocoa/WKProcessGroup.h:
702         * UIProcess/API/Cocoa/WKProcessGroup.mm:
703         (didCreateConnection):
704         (getInjectedBundleInitializationUserData):
705         (didNavigateWithNavigationData):
706         (didPerformClientRedirect):
707         (didPerformServerRedirect):
708         (didUpdateHistoryTitle):
709         * UIProcess/API/Cocoa/WKTypeRefWrapper.h:
710         * UIProcess/API/Cocoa/WKView.h:
711         (WK_CLASS_DEPRECATED_WITH_REPLACEMENT):
712         * UIProcess/API/Cocoa/_WKThumbnailView.h:
713         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
714         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
715         (WebKit::WebProcessProxy::transformHandlesToObjects):
716         (WebKit::WebProcessProxy::transformObjectsToHandles):
717         * UIProcess/Cocoa/WebViewImpl.h:
718         * UIProcess/Cocoa/WebViewImpl.mm:
719         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
720         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
721         * UIProcess/ios/WKContentView.h:
722         * UIProcess/mac/WebInspectorProxyMac.mm:
723         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
724         * WebProcess/cocoa/WebProcessCocoa.mm:
725         (WebKit::WebProcess::transformHandlesToObjects):
726         (WebKit::WebProcess::transformObjectsToHandles):
727
728 2018-10-01  Youenn Fablet  <youenn@apple.com>
729
730         [macOS Sierra] Layout Test http/wpt/cache-storage/cache-put-keys.https.any.worker.html is a flaky failure
731         https://bugs.webkit.org/show_bug.cgi?id=184204
732
733         Reviewed by Chris Dumez.
734
735         NetworkCache::Storage by default limits the length to read to 1500 milliseconds.
736         This is good for the HTTP cache since networking might be faster.
737         It does not work for DOM cache which needs to get these resources even if it takes a long time.
738
739         Since this is disabled by a Mode::Testing option, use it for DOMCache after renaming it to Mode::AvoidRandomness.
740
741         Add a bunch of release logging to help debugging error cases.
742
743         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
744         (WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
745         (WebKit::CacheStorage::Caches::initialize):
746         (WebKit::CacheStorage::Caches::writeCachesToDisk):
747         (WebKit::CacheStorage::Caches::readRecord):
748         * NetworkProcess/cache/NetworkCache.cpp:
749         (WebKit::NetworkCache::Cache::open):
750         * NetworkProcess/cache/NetworkCacheStorage.cpp:
751         (WebKit::NetworkCache::Storage::dispatchReadOperation):
752         (WebKit::NetworkCache::Storage::shrinkIfNeeded):
753         * NetworkProcess/cache/NetworkCacheStorage.h:
754
755 2018-10-01  Olivier Blin  <olivier.blin@softathome.com>
756
757         [WPE] Remove WebKit2InspectorGResourceBundle.xml
758         https://bugs.webkit.org/show_bug.cgi?id=190132
759
760         Reviewed by Michael Catanzaro.
761
762         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml: Removed.
763         This is unused since legacy INSPECTOR_SERVER implementation has
764         been removed in r217924.
765
766 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
767
768         [MediaStream] Clean up RealtimeMediaSource settings change handling
769         https://bugs.webkit.org/show_bug.cgi?id=189998
770         <rdar://problem/44797884>
771
772         Reviewed by Youenn Fablet.
773
774         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
775         (WebKit::UserMediaCaptureManager::Source::setSettings):
776
777 2018-09-30  Eric Carlson  <eric.carlson@apple.com>
778
779         [MediaStream] Use display-specific capture factories
780         https://bugs.webkit.org/show_bug.cgi?id=190043
781         <rdar://problem/44834412>
782
783         Reviewed by Youenn Fablet.
784
785         * WebProcess/cocoa/UserMediaCaptureManager.h:
786
787 2018-09-29  Commit Queue  <commit-queue@webkit.org>
788
789         Unreviewed, rolling out r236631.
790         https://bugs.webkit.org/show_bug.cgi?id=190112
791
792         Caused various eventSender tests, including fast/css/pseudo-
793         active-style-sharing*, to fail (Requested by smfr on #webkit).
794
795         Reverted changeset:
796
797         "Regression(r236512): http/tests/navigation/keyboard-events-
798         during-provisional-navigation.html is flaky"
799         https://bugs.webkit.org/show_bug.cgi?id=190052
800         https://trac.webkit.org/changeset/236631
801
802 2018-09-29  Chris Dumez  <cdumez@apple.com>
803
804         [PSON] Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage()
805         https://bugs.webkit.org/show_bug.cgi?id=190084
806         <rdar://problem/44844561>
807
808         Reviewed by Antti Koivisto.
809
810         Deal with the drawing area potentially being null in WebFrameLoaderClient::transitionToCommittedForNewPage(), as a
811         result of calling WebPage::tearDownDrawingAreaForSuspend().
812
813         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
814         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
815
816 2018-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
817
818         No DOM API to instantiate an attachment for an img element
819         https://bugs.webkit.org/show_bug.cgi?id=189934
820         <rdar://problem/44743222>
821
822         Reviewed by Ryosuke Niwa.
823
824         Makes some adjustments to support using _WKAttachment's file wrapper to change the contents of any image element
825         hosting the attachment in its shadow root. To do this, we add some plumbing to allow the UI process to update an
826         attachment element's enclosing image with data from its file wrapper.
827
828         * UIProcess/API/APIAttachment.cpp:
829         (API::Attachment::isEmpty const):
830         (API::Attachment::enclosingImageData const):
831
832         Helper method that creates a SharedBuffer representing image data for the attachment. Only returns a non-null
833         value for attachment elements that are enclosed within an image.
834
835         * UIProcess/API/APIAttachment.h:
836         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
837         (API::Attachment::enclosingImageData const):
838         (API::Attachment::isEmpty const):
839         * UIProcess/API/Cocoa/WKWebView.mm:
840         (-[WKWebView _attachmentForIdentifier:]):
841
842         Add new SPI to request a _WKAttachment for a given unique identifier. Currently, this is only used for testing.
843
844         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
845         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
846         (WebKit::WebPageProxy::platformRegisterAttachment):
847         * UIProcess/WebPageProxy.cpp:
848         (WebKit::WebPageProxy::updateAttachmentAttributes):
849         (WebKit::WebPageProxy::registerAttachmentIdentifier):
850         (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
851
852         Plumb whether or not the attachment is enclosed by an image from the web process to the UI process.
853
854         (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier):
855         (WebKit::WebPageProxy::didInsertAttachment): Deleted.
856         (WebKit::WebPageProxy::didRemoveAttachment):
857         * UIProcess/WebPageProxy.h:
858         * UIProcess/WebPageProxy.messages.in:
859         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
860         (WebKit::WebEditorClient::registerAttachmentIdentifier):
861         (WebKit::WebEditorClient::didInsertAttachmentWithIdentifier):
862
863         Update attachment attributes after inserting an attachment. This ensures that an attachment that was created and
864         later inserted via script into the document will be synced with state in the UI process, if the client has
865         changed the contents of the attachment.
866
867         * WebProcess/WebCoreSupport/WebEditorClient.h:
868         * WebProcess/WebPage/WebPage.cpp:
869         (WebKit::WebPage::updateAttachmentAttributes):
870
871         Plumb attachment data from the UI process to the web process.
872
873         * WebProcess/WebPage/WebPage.h:
874         * WebProcess/WebPage/WebPage.messages.in:
875
876 2018-09-28  Chris Dumez  <cdumez@apple.com>
877
878         Regression(r236512): http/tests/navigation/keyboard-events-during-provisional-navigation.html is flaky
879         https://bugs.webkit.org/show_bug.cgi?id=190052
880
881         Reviewed by Ryosuke Niwa.
882
883         Introduce a new IPC::SendOption indicating that the IPC should always be sent asynchronously,
884         even if the connection is in fully synchronous mode. This is used by WebKitTestRunner for
885         all text outputting (e.g. console.log) is asynchronous, and thus in order.
886
887         * Platform/IPC/Connection.cpp:
888         (IPC::Connection::sendMessage):
889         * Platform/IPC/Connection.h:
890         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
891         (WKBundlePagePostMessageIgnoringFullySynchronousMode):
892         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
893         * WebProcess/WebPage/WebPage.cpp:
894         (WebKit::WebPage::postMessageIgnoringFullySynchronousMode):
895         * WebProcess/WebPage/WebPage.h:
896
897 2018-09-28  John Wilander  <wilander@apple.com>
898
899         Skip debug assertion in ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain()
900         https://bugs.webkit.org/show_bug.cgi?id=190097
901         <rdar://problem/44877080>
902
903         Reviewed by Chris Dumez.
904
905         The change in https://bugs.webkit.org/show_bug.cgi?id=190055 causes a
906         re-classification that may trigger a debug assertion in
907         ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain().
908         We should skip the assertion for statistics model version 14 to avoid
909         this.
910
911         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
912         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain const):
913
914 2018-09-28  Devin Rousso  <drousso@apple.com>
915
916         Web Inspector: crash in InspectorNetworkAgent::didReceiveResponse when loading denied x-frame resources
917         https://bugs.webkit.org/show_bug.cgi?id=190046
918
919         Reviewed by Joseph Pecoraro.
920
921         * NetworkProcess/NetworkResourceLoader.cpp:
922         (WebKit::NetworkResourceLoader::didReceiveResponse):
923         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
924         Send the sanitized `ResourceResponse` with the message so WebInspector is able to access it.
925
926         * WebProcess/Network/WebResourceLoader.h:
927         * WebProcess/Network/WebResourceLoader.cpp:
928         * WebProcess/Network/WebResourceLoader.messages.in:
929         (WebKit::WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
930
931 2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
932
933         [WebAuthN] Polish WebAuthN auto-test environment
934         https://bugs.webkit.org/show_bug.cgi?id=189283
935         <rdar://problem/44117828>
936
937         Reviewed by Chris Dumez.
938
939         This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
940         absence of local authenticators.
941
942         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
943         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
944         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
945         (WebKit::MockLocalConnection::getUserConsent const):
946         (WebKit::MockLocalConnection::getAttestation const):
947         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
948         (WebKit::MockLocalService::platformStartDiscovery const):
949         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
950
951 2018-09-28  Jer Noble  <jer.noble@apple.com>
952
953         Refactoring: eliminate raw pointer usage in Fullscreen code
954         https://bugs.webkit.org/show_bug.cgi?id=188747
955         <rdar://problem/43541164>
956
957         Reviewed by Alex Christensen.
958
959         Adopt those Ref and WeakPtr changes made in WebCore.
960
961         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
962         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
963         (WebKit::PlaybackSessionModelContext::addClient):
964         (WebKit::PlaybackSessionModelContext::removeClient):
965         (WebKit::PlaybackSessionModelContext::durationChanged):
966         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
967         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
968         (WebKit::PlaybackSessionModelContext::rateChanged):
969         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
970         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
971         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
972         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
973         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
974         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
975         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
976         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
977         (WebKit::PlaybackSessionModelContext::mutedChanged):
978         (WebKit::PlaybackSessionModelContext::volumeChanged):
979         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
980         (WebKit::PlaybackSessionManagerProxy::invalidate):
981         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
982         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
983         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
984         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
985         (WebKit::VideoFullscreenModelContext::create):
986         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
987         (WebKit::VideoFullscreenModelContext::addClient):
988         (WebKit::VideoFullscreenModelContext::removeClient):
989         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
990         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
991         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
992         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
993         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
994         (WebKit::VideoFullscreenManagerProxy::invalidate):
995         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
996         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
997         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
998         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
999         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
1000         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
1001         (-[WKFullScreenViewController videoControlsManagerDidChange]):
1002         (-[WKFullScreenViewController _togglePiPAction:]):
1003         * UIProcess/mac/WKFullScreenWindowController.mm:
1004         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
1005         * WebProcess/cocoa/PlaybackSessionManager.h:
1006         * WebProcess/cocoa/PlaybackSessionManager.mm:
1007         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
1008         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
1009         (WebKit::PlaybackSessionManager::createModelAndInterface):
1010         (WebKit::PlaybackSessionManager::removeContext):
1011         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
1012         * WebProcess/cocoa/VideoFullscreenManager.h:
1013         (WebKit::VideoFullscreenInterfaceContext::create):
1014         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
1015         * WebProcess/cocoa/VideoFullscreenManager.mm:
1016         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
1017         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
1018         (WebKit::VideoFullscreenManager::createModelAndInterface):
1019         (WebKit::VideoFullscreenManager::removeContext):
1020
1021 2018-09-28  Chris Dumez  <cdumez@apple.com>
1022
1023         Drop support for cross-origin-window-policy header
1024         https://bugs.webkit.org/show_bug.cgi?id=190081
1025
1026         Reviewed by Ryosuke Niwa.
1027
1028         * Shared/WebPreferences.yaml:
1029         * UIProcess/API/C/WKPreferences.cpp:
1030         * UIProcess/API/C/WKPreferencesRef.h:
1031         * WebProcess/WebPage/WebPage.cpp:
1032         (WebKit::WebPage::frameBecameRemote):
1033
1034 2018-09-28  Chris Dumez  <cdumez@apple.com>
1035
1036         Do not do automatic process prewarming while under memory pressure
1037         https://bugs.webkit.org/show_bug.cgi?id=190082
1038         <rdar://problem/39771424>
1039
1040         Reviewed by Geoffrey Garen.
1041
1042         Do not do automatic process prewarming while under memory pressure and
1043         also terminate any prewarmed process when receiving a memory warning.
1044
1045         * UIProcess/WebProcessPool.cpp:
1046         (WebKit::WebProcessPool::prewarmProcess):
1047         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1048         (WebKit::WebProcessPool::handleMemoryPressureWarning):
1049         * UIProcess/WebProcessPool.h:
1050         * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
1051         (WebKit::installMemoryPressureHandler):
1052
1053 2018-09-28  Daniel Bates  <dabates@apple.com>
1054
1055         [iOS] Allow programmatic focus when hardware keyboard is attached
1056         https://bugs.webkit.org/show_bug.cgi?id=190017
1057         <rdar://problem/42270463>
1058
1059         Reviewed by Wenson Hsieh.
1060
1061         Make the experience of using iOS with a hardware keyboard more desktop-like by allowing
1062         programmatic focusing of editable elements.
1063
1064         * Platform/spi/ios/UIKitSPI.h: Forward declare SPI.
1065         * Shared/NativeWebKeyboardEvent.h:
1066         * Shared/ios/NativeWebKeyboardEventIOS.mm:
1067         (WebKit::isInHardwareKeyboardMode): Returns whether we are in hardware keyboard mode. In DumpRenderTree
1068         and WebKitTestRunner this function always returns false to keep test results deterministic.
1069         * UIProcess/ios/WKContentViewInteraction.mm:
1070         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1071         Allow starting an input session if we are in hardware keyboard mode.
1072         * WebProcess/WebPage/ios/WebPageIOS.mm:
1073         (WebKit::WebPage::platformEditorState const): Send the full editor state if we are in hardware
1074         keyboard mode regardless of whether layout has been performed so that UIProcess can update UI,
1075         including the position of the caret, immediately.
1076
1077 2018-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1078
1079         Rename createMarkup to serializePreservingVisualAppearance
1080         https://bugs.webkit.org/show_bug.cgi?id=190086
1081
1082         Reviewed by Wenson Hsieh.
1083
1084         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1085         (WebKit::WebEditorClient::updateGlobalSelection):
1086
1087 2018-09-28  Commit Queue  <commit-queue@webkit.org>
1088
1089         Unreviewed, rolling out r236605.
1090         https://bugs.webkit.org/show_bug.cgi?id=190087
1091
1092         caused three API test timeouts (Requested by jernoble on
1093         #webkit).
1094
1095         Reverted changeset:
1096
1097         "Refactoring: eliminate raw pointer usage in Fullscreen code"
1098         https://bugs.webkit.org/show_bug.cgi?id=188747
1099         https://trac.webkit.org/changeset/236605
1100
1101 2018-09-28  Jer Noble  <jer.noble@apple.com>
1102
1103         Refactoring: eliminate raw pointer usage in Fullscreen code
1104         https://bugs.webkit.org/show_bug.cgi?id=188747
1105         <rdar://problem/43541164>
1106
1107         Reviewed by Alex Christensen.
1108
1109         Adopt those Ref and WeakPtr changes made in WebCore.
1110
1111         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1112         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1113         (WebKit::PlaybackSessionModelContext::addClient):
1114         (WebKit::PlaybackSessionModelContext::removeClient):
1115         (WebKit::PlaybackSessionModelContext::durationChanged):
1116         (WebKit::PlaybackSessionModelContext::currentTimeChanged):
1117         (WebKit::PlaybackSessionModelContext::bufferedTimeChanged):
1118         (WebKit::PlaybackSessionModelContext::rateChanged):
1119         (WebKit::PlaybackSessionModelContext::seekableRangesChanged):
1120         (WebKit::PlaybackSessionModelContext::canPlayFastReverseChanged):
1121         (WebKit::PlaybackSessionModelContext::audioMediaSelectionOptionsChanged):
1122         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionOptionsChanged):
1123         (WebKit::PlaybackSessionModelContext::audioMediaSelectionIndexChanged):
1124         (WebKit::PlaybackSessionModelContext::legibleMediaSelectionIndexChanged):
1125         (WebKit::PlaybackSessionModelContext::externalPlaybackChanged):
1126         (WebKit::PlaybackSessionModelContext::wirelessVideoPlaybackDisabledChanged):
1127         (WebKit::PlaybackSessionModelContext::mutedChanged):
1128         (WebKit::PlaybackSessionModelContext::volumeChanged):
1129         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
1130         (WebKit::PlaybackSessionManagerProxy::invalidate):
1131         (WebKit::PlaybackSessionManagerProxy::createModelAndInterface):
1132         (WebKit::PlaybackSessionManagerProxy::removeClientForContext):
1133         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1134         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1135         (WebKit::VideoFullscreenModelContext::create):
1136         (WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):
1137         (WebKit::VideoFullscreenModelContext::addClient):
1138         (WebKit::VideoFullscreenModelContext::removeClient):
1139         (WebKit::VideoFullscreenModelContext::willEnterPictureInPicture):
1140         (WebKit::VideoFullscreenModelContext::didEnterPictureInPicture):
1141         (WebKit::VideoFullscreenModelContext::failedToEnterPictureInPicture):
1142         (WebKit::VideoFullscreenModelContext::willExitPictureInPicture):
1143         (WebKit::VideoFullscreenModelContext::didExitPictureInPicture):
1144         (WebKit::VideoFullscreenManagerProxy::invalidate):
1145         (WebKit::VideoFullscreenManagerProxy::createModelAndInterface):
1146         (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
1147         (WebKit::VideoFullscreenModelContext::~VideoFullscreenModelContext): Deleted.
1148         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1149         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
1150         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
1151         (-[WKFullScreenViewController videoControlsManagerDidChange]):
1152         (-[WKFullScreenViewController _togglePiPAction:]):
1153         * UIProcess/mac/WKFullScreenWindowController.mm:
1154         (WebKit::WKFullScreenWindowControllerVideoFullscreenModelClient::setInterface):
1155         * WebProcess/cocoa/PlaybackSessionManager.h:
1156         * WebProcess/cocoa/PlaybackSessionManager.mm:
1157         (WebKit::PlaybackSessionInterfaceContext::PlaybackSessionInterfaceContext):
1158         (WebKit::PlaybackSessionManager::~PlaybackSessionManager):
1159         (WebKit::PlaybackSessionManager::createModelAndInterface):
1160         (WebKit::PlaybackSessionManager::removeContext):
1161         (WebKit::PlaybackSessionInterfaceContext::~PlaybackSessionInterfaceContext): Deleted.
1162         * WebProcess/cocoa/VideoFullscreenManager.h:
1163         (WebKit::VideoFullscreenInterfaceContext::create):
1164         (WebKit::VideoFullscreenInterfaceContext::createWeakPtr):
1165         * WebProcess/cocoa/VideoFullscreenManager.mm:
1166         (WebKit::VideoFullscreenInterfaceContext::VideoFullscreenInterfaceContext):
1167         (WebKit::VideoFullscreenManager::~VideoFullscreenManager):
1168         (WebKit::VideoFullscreenManager::createModelAndInterface):
1169         (WebKit::VideoFullscreenManager::removeContext):
1170
1171 2018-09-28  Fujii Hironori  <Hironori.Fujii@sony.com>
1172
1173         [WinCairo] error C2027: use of undefined type 'WTF::EnumTraits<E>' while compiling AuthenticationChallengeProxy.cpp
1174         https://bugs.webkit.org/show_bug.cgi?id=190071
1175
1176         Unreviewed build fix for WinCairo port.
1177
1178         AuthenticationChallengeDisposition was not defined in this file.
1179
1180         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp: Include "AuthenticationChallengeDisposition.h".
1181
1182 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
1183
1184         Use enum class in createMarkup arguments
1185         https://bugs.webkit.org/show_bug.cgi?id=190028
1186
1187         Reviewed by Wenson Hsieh.
1188
1189         * WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
1190         (WebKit::WebEditorClient::updateGlobalSelection):
1191
1192 2018-09-27  John Wilander  <wilander@apple.com>
1193
1194         Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
1195         https://bugs.webkit.org/show_bug.cgi?id=190055
1196         <rdar://problem/44843460>
1197
1198         Reviewed by Chris Dumez.
1199
1200         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1201             Bumped the statisticsModelVersion to 14 to be able to
1202             correct legacy statistics.
1203         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
1204             Now skips capture if it's the main frame.
1205
1206 2018-09-27  Brent Fulgham  <bfulgham@apple.com>
1207
1208         [iOS] Allow access to VoiceServices features needed for accessibility
1209         https://bugs.webkit.org/show_bug.cgi?id=190019
1210         <rdar://problem/43621111>
1211
1212         Reviewed by Chris Fleizach.
1213
1214         Revise the sandbox to allow access to relevant WebSpeech features.
1215
1216         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1217
1218 2018-09-27  Sihui Liu  <sihui_liu@apple.com>
1219
1220         Fix IOSMAC build
1221         https://bugs.webkit.org/show_bug.cgi?id=190021
1222
1223         Reviewed by Alex Christensen.
1224
1225         * NetworkProcess/mac/NetworkProcessMac.mm:
1226         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
1227
1228 2018-09-27  John Wilander  <wilander@apple.com>
1229
1230         Resource Load Statistics: Remove temporary compatibility fix for auto-dismiss popups
1231         https://bugs.webkit.org/show_bug.cgi?id=189980
1232         <rdar://problem/44780645>
1233
1234         Reviewed by Alex Christensen.
1235
1236         The change in https://bugs.webkit.org/show_bug.cgi?id=183620 was a temporary
1237         compatibility fix as explained in:
1238         https://webkit.org/blog/8311/intelligent-tracking-prevention-2-0/. We should
1239         remove it.
1240
1241         These changes remove the parameter isTriggeredByUserGesture since it's no longer needed.
1242
1243         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1244         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
1245         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
1246         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1247         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1248         * UIProcess/WebResourceLoadStatisticsStore.h:
1249         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1250         * WebProcess/WebProcess.cpp:
1251         (WebKit::WebProcess::WebProcess):
1252
1253 2018-09-27  Ryan Haddad  <ryanhaddad@apple.com>
1254
1255         Unreviewed, rolling out r236557.
1256
1257         Really roll out r236557 this time because it breaks internal
1258         builds.
1259
1260         Reverted changeset:
1261
1262         "Add VP8 support to WebRTC"
1263         https://bugs.webkit.org/show_bug.cgi?id=189976
1264         https://trac.webkit.org/changeset/236557
1265
1266 2018-09-27  Youenn Fablet  <youenn@apple.com>
1267
1268         Add VP8 support to WebRTC
1269         https://bugs.webkit.org/show_bug.cgi?id=189976
1270
1271         Reviewed by Eric Carlson.
1272
1273         * Shared/WebPreferences.yaml:
1274
1275 2018-09-27  Chris Dumez  <cdumez@apple.com>
1276
1277         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
1278         https://bugs.webkit.org/show_bug.cgi?id=184183
1279         <rdar://problem/36800576>
1280
1281         Reviewed by Ryosuke Niwa.
1282
1283         In recent years, we have experienced re-entrancy bugs/crashes in WebCore due to the WebContent process
1284         processing unrelated incoming synchronous IPC when waiting for a reply to one of its synchronous IPC
1285         to another process. In order to deal with this, we introduced a DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1286         IPC::SendOption which we used on sendSync() calls where we knew re-entering would be unsafe. However,
1287         it turns out to be needed for a lot of the WebProcess's sync IPC and it is error-prone. In order to
1288         address the issue, we've decided to update the WebContent process behavior so that it processes all its
1289         IPC in order (not matter if synchronous or not) and thus so that we never dispatch unrelated synchronous
1290         IPC while waiting for a synchronous IPC reply, expect in cases where it would cause a deadlock.
1291
1292         As a result, this patch also drops support for the DoNotProcessIncomingMessagesWhenWaitingForSyncReply
1293         IPC::SendOption which is no longer needed and has some code complexity.
1294
1295         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1296         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
1297         * Platform/IPC/Connection.cpp:
1298         (IPC::Connection::sendSyncMessage):
1299         (IPC::Connection::waitForSyncReply):
1300         * Platform/IPC/Connection.h:
1301         (IPC::Connection::sendSync):
1302         * PluginProcess/WebProcessConnection.cpp:
1303         (WebKit::WebProcessConnection::WebProcessConnection):
1304         * StorageProcess/StorageToWebProcessConnection.cpp:
1305         (WebKit::StorageToWebProcessConnection::StorageToWebProcessConnection):
1306         * UIProcess/WebProcessProxy.cpp:
1307         (WebKit::WebProcessProxy::connectionWillOpen):
1308         * UIProcess/WebProcessProxy.h:
1309         * UIProcess/WebProcessProxy.messages.in:
1310         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1311         (WebKit::InjectedBundle::postSynchronousMessage):
1312         * WebProcess/Network/WebLoaderStrategy.cpp:
1313         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1314         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
1315         (WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
1316         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
1317         * WebProcess/Plugins/PluginProxy.cpp:
1318         (WebKit::PluginProxy::destroy):
1319         (WebKit::PluginProxy::supportsSnapshotting const):
1320         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1321         (WebKit::WebPluginInfoProvider::populatePluginCache):
1322         * WebProcess/Storage/WebSWClientConnection.cpp:
1323         (WebKit::WebSWClientConnection::WebSWClientConnection):
1324         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1325         * WebProcess/WebCoreSupport/WebChromeClient.h:
1326         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1327         (WebKit::WebFrameLoaderClient::savePlatformDataToCachedFrame):
1328         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1329         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1330         * WebProcess/WebPage/WebPage.cpp:
1331         (WebKit::WebPage::rootViewToScreen):
1332         * WebProcess/WebProcess.cpp:
1333         (WebKit::getNetworkProcessConnection):
1334         * WebProcess/WebProcess.h:
1335         * WebProcess/WebProcess.messages.in:
1336
1337 2018-09-27  Antoine Quint  <graouts@apple.com>
1338
1339         [Web Animations] Turn Web Animations with CSS integration on
1340         https://bugs.webkit.org/show_bug.cgi?id=184819
1341         <rdar://problem/39597337>
1342
1343         Reviewed by Dean Jackson.
1344
1345         * Shared/WebPreferences.yaml:
1346
1347 2018-09-26  James Savage  <james.savage@apple.com>
1348
1349         Allow override of viewport configuration.
1350         https://bugs.webkit.org/show_bug.cgi?id=188772.
1351         <rdar://problem/43538892>.
1352
1353         Reviewed by Simon Fraser.
1354
1355         * Shared/WebPreferences.yaml:
1356         * UIProcess/API/Cocoa/WKPreferences.mm:
1357         (-[WKPreferences _setShouldIgnoreMetaViewport:]):
1358         (-[WKPreferences _shouldIgnoreMetaViewport]):
1359         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1360         * WebProcess/WebPage/WebPage.cpp:
1361         (WebKit::WebPage::viewportPropertiesDidChange): If we are ignoring the
1362         <meta> viewport, short circuit calling setViewportArguments() and do not
1363         do any updates.
1364         (WebKit::WebPage::didCommitLoad): Ditto.
1365         * WebProcess/WebPage/ios/WebPageIOS.mm:
1366         (WebKit::WebPage::resetViewportDefaultConfiguration): Select the default
1367         configuration based on UIProcess setting.
1368
1369 2018-09-26  Chris Dumez  <cdumez@apple.com>
1370
1371         Regression(r236512): WKWebViewCandidateTests.SoftSpaceReplacementAfterCandidateInsertionWithoutReplacement API test is failing
1372         https://bugs.webkit.org/show_bug.cgi?id=190007
1373
1374         Reviewed by Alex Christensen.
1375
1376         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption from EditorStateChanged IPC calls to restore
1377         pre-r236512 behavior. Before r236512, this option had no effect on IPC from the WebContent to the UIProcess
1378         because the m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage flag was set
1379         on that IPC::Connection. However, after r236512, m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
1380         is no longer set on the connection, and the DispatchMessageEvenWhenWaitingForSyncReply SendOption was
1381         causing this message to get processed out of order with regards to other async IPC, thus causing the
1382         API test failure.
1383
1384         * WebProcess/WebPage/WebPage.cpp:
1385         (WebKit::WebPage::sendEditorStateUpdate):
1386         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
1387
1388 2018-09-26  Alex Christensen  <achristensen@webkit.org>
1389
1390         Fix UAF after r236463
1391         https://bugs.webkit.org/show_bug.cgi?id=190011
1392
1393         Reviewed by Chris Dumez.
1394
1395         I had removed an early return in NetworkResourceLoader::continueDidReceiveResponse.
1396         Reading the (probably) null m_responseCompletionHandler was reading after the object had been destroyed.
1397
1398         * NetworkProcess/NetworkResourceLoader.cpp:
1399         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
1400
1401 2018-09-26  Ryosuke Niwa  <rniwa@webkit.org>
1402
1403         Selection should work across shadow boundary when initiated by a mouse drag
1404         https://bugs.webkit.org/show_bug.cgi?id=151380
1405         <rdar://problem/24363872>
1406
1407         Reviewed by Antti Koivisto.
1408
1409         Added SelectionAcrossShadowBoundariesEnabled as an internal debug feature,
1410         and moved CSSCustomPropertiesAndValuesEnabled to where other experimental features are located.
1411
1412         * Shared/WebPreferences.yaml:
1413
1414 2018-09-26  Chris Dumez  <cdumez@apple.com>
1415
1416         Unreviewed, apply post-landing review comments after r236512.
1417
1418         * UIProcess/WebPageProxy.cpp:
1419         (WebKit::WebPageProxy::didCreateMainFrame):
1420         (WebKit::WebPageProxy::didCreateSubframe):
1421
1422 2018-09-26  Chris Dumez  <cdumez@apple.com>
1423
1424         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
1425         https://bugs.webkit.org/show_bug.cgi?id=189927
1426
1427         Reviewed by Geoffrey Garen.
1428
1429         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
1430         in order to avoid deadlocks. This is not an issue currently because the WebProcess does process
1431         incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future
1432         in order to avoid bugs caused by re-entering WebCore at unsafe times.
1433
1434         The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing
1435         a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame /
1436         DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync
1437         IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about
1438         the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial
1439         about:blank and fragment navigations.
1440
1441         * UIProcess/WebPageProxy.cpp:
1442         (WebKit::WebPageProxy::didCreateMainFrame):
1443         (WebKit::WebPageProxy::didCreateSubframe):
1444         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1445         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1446         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1447         * UIProcess/WebPageProxy.h:
1448         * UIProcess/WebPageProxy.messages.in:
1449         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1450         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1451
1452         * WebProcess/WebPage/WebFrame.cpp:
1453         (WebKit::WebFrame::createWithCoreMainFrame):
1454         (WebKit::WebFrame::createSubframe):
1455         Drop DispatchMessageEvenWhenWaitingForSyncReply SendOption when sending the
1456         DidCreateMainFrame / DidCreateSubframe IPC. Previously, this SendOption has
1457         no effect because the IPC::Connection would have the
1458         m_onlySendMessagesAsDispatchWhenWaitingForSyncReplyWhenProcessingSuchAMessage
1459         flag set to true. However, now that we stop setting this flag on the IPC
1460         connection from the WebProcess to the UIProcess, it would lead to those
1461         IPC messages getting processed out of order with regards to the
1462         DecidePolicyForNavigationAsync asynchronous IPC. DidCreateMainFrame would
1463         sometimes get processed *after* the DecidePolicyForNavigationAsync IPC
1464         and we would not know about the frameID yet.
1465
1466         * WebProcess/WebProcess.cpp:
1467         (WebKit::WebProcess::initializeConnection):
1468
1469 2018-09-26  Antti Koivisto  <antti@apple.com>
1470
1471         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on iOS
1472         https://bugs.webkit.org/show_bug.cgi?id=189695
1473         <rdar://problem/44551146>
1474
1475         Reviewed by Simon Fraser.
1476
1477         Freeze the layers on UI process side during process swap.
1478
1479         * UIProcess/API/Cocoa/WKWebView.mm:
1480         (-[WKWebView _processWillChange]):
1481
1482         Shared work of _processWillSwap and _processDidExit.
1483
1484         (-[WKWebView _processWillSwap]):
1485         (-[WKWebView _processDidExit]):
1486
1487         Split into two functions. Don't reset scroll position and similar when doing navigation swap.
1488
1489         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1490         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1491         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1492         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
1493         (WebKit::RemoteLayerTreeDrawingAreaProxy::detachRemoteLayerTreeHost):
1494
1495         Add to way to detach RemoteLayerTreeHost from the drawing area. Inert RemoteLayerTreeHost will host
1496         the frozen layers.
1497
1498         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1499         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
1500         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):
1501         (WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilAnyUpdate):
1502         (WebKit::RemoteLayerTreeDrawingAreaProxy::prepareForAppSuspension):
1503         (WebKit::RemoteLayerTreeDrawingAreaProxy::hasVisibleContent const):
1504         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
1505         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1506         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1507         (WebKit::RemoteLayerTreeHost::RemoteLayerTreeHost):
1508         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1509         (WebKit::RemoteLayerTreeHost::animationDidStart):
1510         (WebKit::RemoteLayerTreeHost::animationDidEnd):
1511         (WebKit::RemoteLayerTreeHost::detachFromDrawingArea):
1512
1513         Clear the DrawingArea backpointer.
1514
1515         * UIProcess/WebPageProxy.cpp:
1516         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1517         (WebKit::WebPageProxy::resetState):
1518
1519         Detach and save the current RemoteLayerTreeHost on navigation swap.
1520
1521         * UIProcess/WebPageProxy.h:
1522         * UIProcess/ios/PageClientImplIOS.mm:
1523         (WebKit::PageClientImpl::processWillSwap):
1524
1525         Avoid reseting the scroll position.
1526
1527         * UIProcess/ios/WebPageProxyIOS.mm:
1528         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1529
1530         Drop the frozen layers after setting the new root layer.
1531
1532         * UIProcess/mac/WebPageProxyMac.mm:
1533         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
1534
1535         For completeness do this also on Mac (where remote layers are currently not used).
1536
1537 2018-09-25  Ryosuke Niwa  <rniwa@webkit.org>
1538
1539         Make frame flattening an internal debug feature
1540         https://bugs.webkit.org/show_bug.cgi?id=189984
1541
1542         Reviewed by Simon Fraser.
1543
1544         Made frame flattening a runtime switchable from internal debug menu.
1545
1546         To avoid having to enumerate three distinct values in the settings, made it a boolean flag in WKPreference.
1547         That's what's exposd as an API anyway.
1548
1549         * Shared/WebPreferences.yaml:
1550         * Shared/WebPreferencesDefaultValues.h:
1551         * UIProcess/API/C/WKPreferences.cpp:
1552         (WKPreferencesSetFrameFlatteningEnabled):
1553         (WKPreferencesGetFrameFlatteningEnabled):
1554         * UIProcess/API/glib/WebKitSettings.cpp:
1555         (webkit_settings_get_enable_frame_flattening):
1556         (webkit_settings_set_enable_frame_flattening):
1557         * WebProcess/WebPage/WebPage.cpp:
1558         (WebKit::WebPage::updatePreferences):
1559
1560 2018-09-25  Eric Carlson  <eric.carlson@apple.com>
1561
1562         [MediaStream] Add Mac window capture source
1563         https://bugs.webkit.org/show_bug.cgi?id=189958
1564         <rdar://problem/44767616>
1565
1566         Reviewed by Youenn Fablet.
1567
1568         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
1569         * UIProcess/WebPageProxy.cpp:
1570         (WebKit::WebPageProxy::beginMonitoringCaptureDevices): Sync with webcore prefs before listening
1571         to device changes so we listen on the correct devices.
1572
1573 2018-09-25  Chris Dumez  <cdumez@apple.com>
1574
1575         Unreviewed, rolling out r236471 and r236480.
1576
1577         Seems to be causing some flaky crashes
1578
1579         Reverted changesets:
1580
1581         "UIProcess should process incoming sync IPC from WebProcess
1582         when waiting for a sync IPC reply from it"
1583         https://bugs.webkit.org/show_bug.cgi?id=189927
1584         https://trac.webkit.org/changeset/236471
1585
1586         "Revert some of the changes in r236471"
1587         https://bugs.webkit.org/show_bug.cgi?id=189973
1588         https://trac.webkit.org/changeset/236480
1589
1590 2018-09-25  Conrad Shultz  <conrad_shultz@apple.com>
1591
1592         Enable customization of the file upload panel
1593         https://bugs.webkit.org/show_bug.cgi?id=189970
1594
1595         Reviewed by Wenson Hsieh.
1596
1597         With this change, platform implementations can override, or implement in a category,
1598         +[WKContentView _fileUploadPanelClass] as needed.
1599
1600         * UIProcess/ios/WKContentViewInteraction.h:
1601         * UIProcess/ios/WKContentViewInteraction.mm:
1602         (-[WKContentView _showRunOpenPanel:resultListener:]):
1603
1604 2018-09-25  Chris Dumez  <cdumez@apple.com>
1605
1606         Unreviewed, rolling out r236420 and r236458.
1607
1608         This change is not fully correct
1609
1610         Reverted changesets:
1611
1612         "Do not do early processing of incoming sync IPC unless we're
1613         waiting for a sync IPC reply"
1614         https://bugs.webkit.org/show_bug.cgi?id=186941
1615         https://trac.webkit.org/changeset/236420
1616
1617         "Unreviewed, update bug number of http/tests/misc/blob-
1618         size.html crash on Windows"
1619         https://trac.webkit.org/changeset/236458
1620
1621 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
1622
1623         Unreviewed, a quick fix after r236481.
1624
1625         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1626         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
1627         Add an early return, so we don't end up with setting MockWebAuthenticationConfiguration twice.
1628
1629 2018-09-25  John Wilander  <wilander@apple.com>
1630
1631         Change from HAVE(CFNETWORK_STORAGE_PARTITIONING) to ENABLE(RESOURCE_LOAD_STATISTICS)
1632         https://bugs.webkit.org/show_bug.cgi?id=189959
1633         <rdar://problem/44767642>
1634
1635         Reviewed by Chris Dumez.
1636
1637         We no longer make use of CFNetwork's cookie partitioning so we should
1638         change the compile-time flag to something that makes sense. This should
1639         also make it easier/cleaner for other ports.
1640
1641         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1642         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1643         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1644         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1645         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1646         * NetworkProcess/NetworkProcess.cpp:
1647         (WebKit::NetworkProcess::initializeNetworkProcess):
1648         * NetworkProcess/NetworkProcess.h:
1649         * NetworkProcess/NetworkProcess.messages.in:
1650         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1651         (WebKit::NetworkProcessCreationParameters::encode const):
1652         (WebKit::NetworkProcessCreationParameters::decode):
1653         * NetworkProcess/NetworkProcessCreationParameters.h:
1654         * NetworkProcess/NetworkResourceLoader.cpp:
1655         (WebKit::NetworkResourceLoader::didFinishLoading):
1656         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
1657         * NetworkProcess/NetworkResourceLoader.h:
1658         * NetworkProcess/cache/NetworkCache.cpp:
1659         (WebKit::NetworkCache::Cache::retrieve):
1660         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1661         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1662         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
1663         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1664         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1665         * Shared/WebProcessCreationParameters.cpp:
1666         (WebKit::WebProcessCreationParameters::encode const):
1667         (WebKit::WebProcessCreationParameters::decode):
1668         * Shared/WebProcessCreationParameters.h:
1669         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1670         (WebKit::WebProcessPool::platformInitializeWebProcess):
1671         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1672         * UIProcess/Network/NetworkProcessProxy.cpp:
1673         * UIProcess/Network/NetworkProcessProxy.h:
1674         * UIProcess/Network/NetworkProcessProxy.messages.in:
1675         * UIProcess/WebPageProxy.cpp:
1676         * UIProcess/WebPageProxy.h:
1677         * UIProcess/WebPageProxy.messages.in:
1678         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1679         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1680         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
1681         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1682         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
1683         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler):
1684         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
1685         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1686         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1687         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
1688         (WebKit::WebsiteDataStore::networkProcessDidCrash):
1689         * UIProcess/WebsiteData/WebsiteDataStore.h:
1690         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1691         * WebProcess/WebCoreSupport/WebChromeClient.h:
1692         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1693         (WebKit::WebFrameLoaderClient::detachedFromParent2):
1694         (WebKit::WebFrameLoaderClient::dispatchWillChangeDocument):
1695         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1696         * WebProcess/WebPage/WebPage.cpp:
1697         * WebProcess/WebPage/WebPage.h:
1698         * WebProcess/WebPage/WebPage.messages.in:
1699         * WebProcess/WebProcess.cpp:
1700         (WebKit::WebProcess::initializeWebProcess):
1701
1702 2018-09-25  Philippe Normand  <pnormand@igalia.com>
1703
1704         [WPE] Export jsc_ symbols
1705         https://bugs.webkit.org/show_bug.cgi?id=189964
1706
1707         Reviewed by Michael Catanzaro.
1708
1709         * webkitglib-symbols.map: Keep jsc_* symbols as visible so they
1710         can be used by applications depending on WPE.
1711
1712 2018-09-25  Jiewen Tan  <jiewen_tan@apple.com>
1713
1714         [WebAuthN] Make AuthenticatorManager
1715         https://bugs.webkit.org/show_bug.cgi?id=189279
1716         <rdar://problem/44116792>
1717
1718         Reviewed by Chris Dumez.
1719
1720         This patch introduces AuthenticatorManager which is the central of WebAuthentication that 1) handles
1721         web requests, 2) discovers authenticators, 3) manages authetnicators and 4) in the future interacts with UI.
1722         The lifetime of the AuthenticatorManager is managed by WebsiteDataStore such that it is almost a singleton
1723         per UI Process.
1724
1725         1) Requests come from WebAuthenticatorCoordinatorProxy and then cached in AuthenticatorManager which will
1726         then distribute requests whenever a new authenticator is discovered.
1727
1728         2) An ABC AuthenticatorTransportService is provided as an interface for AuthenticatorManager to invoke
1729         startDiscovery. Actual work will be done in corresponding derived classes, say, LocalService. LocalService
1730         is the one that discover attached platform authenticators, for example, TouchID or FaceID.
1731
1732         Eache service is unique per AuthetnicatorManager, which means we will have at most 4 services, Local, USB,
1733         NFC, and BLE. The latter three will be implemented soon. Also, AuthenticatorManager serves as an observer to
1734         *Service, so the latter can inform the former whenever an authenticator is added or removed.
1735
1736         When a new authenticator is discovered, the corresponding service will create an Authetnicator object that
1737         binds to the physical authenticator device through a *Connection object. There is no ABC for connection for
1738         now as I forsee every *Connection will be quite different. The *Connection object is the one that send/receive
1739         messages from the physicla device. So far, a LocalConnection is provided even though normally local authenticators
1740         are attached. This class is provided solely for separating UI and network traffic from LocalAuthenticator's
1741         request handling process. So we can override them in a mock test environment. I will talk about this in the
1742         next section.
1743
1744         3) An ABC Authenticator is provided as an interface for AuthenticatorManager to distribute requests on. Requests
1745         will then be handled by the derived classes, say, LocalAuthenticator. Each authenticator object is a FSM that
1746         works asynchronously.
1747
1748         For LocalAuthenticator, it has 4 states for MakeCredential: Init => RequestReceived => UserConsented => Attested => End,
1749         and 3 states for GetAssertion: Init => RequestReceived => UserConsented => End. In the transit from RequestReceived to
1750         UserConsented, it will invoke LocalConnection to talk to LocalAuthentication.framework that prompt users for TouchID
1751         or FaceID. And then the transit from UserConsented => Attested, it will invoke LocalConnection to talk to
1752         DeviceIdentity.framework that does Apple attestation. Most of the work are from the original LocalAuthenticator
1753         implementation, and this patch converts it to a FSM and simplify the callback and threading model.
1754
1755         When a respond is ready, each authenticator will notify their observer which is the AuthenticatorManager.
1756         AuthenticatorManager will only reply to Web Process whenever there is a valid respond or a terminating error. Otherwise,
1757         the request will time out. I will explore the time out mechanism in a more detailed manner in Bug 189642.
1758
1759         The above is a briefing of the AuthetnicatorManager architecture in functional. The asynchronous model is explained here:
1760         1) Since most discovery and request handling processes are asynchronous, I enforced them to be executed asyncrhonous in
1761         the interface of the ABC.
1762         2) There is no dedicated secondary threads here. However, underlying framework might decide to perform works on a dedicated
1763         thread and then execute the provided callback. Whenever such situation happens, the policy here is to wrap the actual callback
1764         into a callback that will post the actual callback back to the main thread and pass the wrapping callback to the APIs. Hence,
1765         weak pointers in the actual callback are guaranteed to work.
1766         3) Callbacks are used only if it is one way, and they are CompletionHandlers.
1767         4) Potential multi ways asynchronous operations are encapsulated in regarding Observer interfaces.
1768
1769         Finally, let me explain how the mock test works:
1770         1) Mock testing is done in WebKitTestRunner instead of Internals because a considerable large portion of work is in UIProcess
1771         instead of WebProcess, says, the AuthenticatorManager.
1772         2) The basic idea is to override functionality of *Connection classes and then make them thin such that we can get the best
1773         possible coverage in auto tests.
1774         3) In order to enable layout tests to configure the Mock*Connection classes, a MockWebAuthenticationConfiguration struct is
1775         provided. A corresponding JS dictionary will be created by each test and passed from the TestRunner to the connection object.
1776         4) To bridge the above tunnel, a MockAuthenticatorManager is constructed. It is instrumented to return every error.
1777         5) Also, Mock*Service classes are made to mock the discovery process as well.
1778         6) Noted, every mock overrided methods are made thin.
1779
1780         * CMakeLists.txt:
1781         * Configurations/WebKit.xcconfig:
1782         * Platform/spi/Cocoa/DeviceIdentitySPI.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1783         * SourcesCocoa.txt:
1784         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1785         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1786         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1787         * UIProcess/WebAuthentication/Authenticator.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1788         (WebKit::Authenticator::handleRequest):
1789         (WebKit::Authenticator::receiveRespond const):
1790         * UIProcess/WebAuthentication/Authenticator.h: Renamed from Source/WebCore/Modules/webauthn/cocoa/LocalAuthenticator.h.
1791         (WebKit::Authenticator::setObserver):
1792         (WebKit::Authenticator::observer const):
1793         (WebKit::Authenticator::requestData const):
1794         * UIProcess/WebAuthentication/AuthenticatorManager.cpp: Added.
1795         (WebKit::AuthenticatorManagerInternal::collectTransports):
1796         (WebKit::AuthenticatorManager::makeCredential):
1797         (WebKit::AuthenticatorManager::getAssertion):
1798         (WebKit::AuthenticatorManager::clearState):
1799         (WebKit::AuthenticatorManager::authenticatorAdded):
1800         (WebKit::AuthenticatorManager::respondReceived):
1801         (WebKit::AuthenticatorManager::createService const):
1802         (WebKit::AuthenticatorManager::respondReceivedInternal):
1803         (WebKit::AuthenticatorManager::startDiscovery):
1804         * UIProcess/WebAuthentication/AuthenticatorManager.h: Added.
1805         (WebKit::AuthenticatorManager::pendingCompletionHandler):
1806         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1807         (WebKit::AuthenticatorTransportService::create):
1808         (WebKit::AuthenticatorTransportService::createMock):
1809         (WebKit::AuthenticatorTransportService::AuthenticatorTransportService):
1810         (WebKit::AuthenticatorTransportService::startDiscovery const):
1811         * UIProcess/WebAuthentication/AuthenticatorTransportService.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1812         (WebKit::AuthenticatorTransportService::observer const):
1813         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1814         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1815         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Added.
1816         (WebKit::LocalAuthenticatorInternal::buildAuthData):
1817         (WebKit::LocalAuthenticatorInternal::transportsContain):
1818         (WebKit::LocalAuthenticatorInternal::produceHashSet):
1819         (WebKit::LocalAuthenticatorInternal::toVector):
1820         (WebKit::LocalAuthenticator::LocalAuthenticator):
1821         (WebKit::LocalAuthenticator::makeCredential):
1822         (WebKit::LocalAuthenticator::continueMakeCredentialAfterUserConsented):
1823         (WebKit::LocalAuthenticator::continueMakeCredentialAfterAttested):
1824         (WebKit::LocalAuthenticator::getAssertion):
1825         (WebKit::LocalAuthenticator::continueGetAssertionAfterUserConsented):
1826         * UIProcess/WebAuthentication/Cocoa/LocalConnection.h: Copied from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1827         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Added.
1828         (WebKit::LocalConnection::getUserConsent const):
1829         (WebKit::LocalConnection::getAttestation const):
1830         * UIProcess/WebAuthentication/Cocoa/LocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1831         * UIProcess/WebAuthentication/Cocoa/LocalService.mm: Renamed from Source/WebCore/PAL/pal/spi/cocoa/DeviceIdentitySPI.h.
1832         (WebKit::LocalService::LocalService):
1833         (WebKit::LocalService::isAvailable):
1834         (WebKit::LocalService::startDiscoveryInternal const):
1835         (WebKit::LocalService::platformStartDiscovery const):
1836         (WebKit::LocalService::createLocalConnection const):
1837         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1838         (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
1839         (WebKit::MockAuthenticatorManager::createService const):
1840         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1841         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1842         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1843         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm: Added.
1844         (WebKit::MockLocalConnection::MockLocalConnection):
1845         (WebKit::MockLocalConnection::getUserConsent const):
1846         (WebKit::MockLocalConnection::getAttestation const):
1847         * UIProcess/WebAuthentication/Mock/MockLocalService.cpp: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1848         (WebKit::MockLocalService::MockLocalService):
1849         (WebKit::MockLocalService::platformStartDiscovery const):
1850         (WebKit::MockLocalService::createLocalConnection const):
1851         * UIProcess/WebAuthentication/Mock/MockLocalService.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1852         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Copied from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1853         * UIProcess/WebAuthentication/WebAuthenticationRequestData.h: Renamed from Source/WebCore/platform/cocoa/LocalAuthenticationSoftLink.h.
1854         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:
1855         (WebKit::WebAuthenticatorCoordinatorProxy::WebAuthenticatorCoordinatorProxy):
1856         (WebKit::WebAuthenticatorCoordinatorProxy::makeCredential):
1857         (WebKit::WebAuthenticatorCoordinatorProxy::getAssertion):
1858         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailable):
1859         (WebKit::WebAuthenticatorCoordinatorProxy::isUserVerifyingPlatformAuthenticatorAvailableReply): Deleted.
1860         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.h:
1861         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1862         (WebKit::WebsiteDataStore::WebsiteDataStore):
1863         (WebKit::WebsiteDataStore::setMockWebAuthenticationConfiguration):
1864         * UIProcess/WebsiteData/WebsiteDataStore.h:
1865         (WebKit::WebsiteDataStore::authenticatorManager):
1866         * WebKit.xcodeproj/project.pbxproj:
1867
1868 2018-09-25  Chris Dumez  <cdumez@apple.com>
1869
1870         Revert some of the changes in r236471
1871         https://bugs.webkit.org/show_bug.cgi?id=189973
1872
1873         Reviewed by Alex Christensen.
1874
1875         Revert some of the changes in r236471 as they should not be needed. In particular,
1876         it should not be possible for the DecidePolicyForNavigationActionSync IPC to get
1877         processed *before* the DidCreateMainFrame / DidCreateSubframe ones because those
1878         use IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply. They are thus
1879         processed early when necessary, the same way as synchronous IPC messages.
1880
1881         * UIProcess/WebPageProxy.cpp:
1882         (WebKit::WebPageProxy::didCreateMainFrame):
1883         (WebKit::WebPageProxy::didCreateSubframe):
1884         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1885         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1886         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1887         * UIProcess/WebPageProxy.h:
1888         * UIProcess/WebPageProxy.messages.in:
1889         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1890         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1891         * WebProcess/WebPage/WebFrame.cpp:
1892         (WebKit::WebFrame::createWithCoreMainFrame):
1893         (WebKit::WebFrame::createSubframe):
1894
1895 2018-09-25  Sihui Liu  <sihui_liu@apple.com>
1896
1897         Move Service Worker Management from Storage Process to Network Process
1898         https://bugs.webkit.org/show_bug.cgi?id=189422
1899
1900         Reviewed by Youenn Fablet.
1901
1902         After r236035, this is another piece to move functionality of storage process to network process. When 
1903         we enable Service Workers, network process instead of storage process will be launched. 
1904         This patch will not change the behavior of Service Worker.
1905
1906         * CMakeLists.txt:
1907         * DerivedSources.make:
1908         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1909         (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess):
1910         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
1911         (WebKit::NetworkConnectionToWebProcess::didReceiveSyncMessage):
1912         (WebKit::NetworkConnectionToWebProcess::didClose):
1913         (WebKit::NetworkConnectionToWebProcess::unregisterSWConnections):
1914         (WebKit::NetworkConnectionToWebProcess::establishSWServerConnection):
1915         * NetworkProcess/NetworkConnectionToWebProcess.h:
1916         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1917         * NetworkProcess/NetworkProcess.cpp:
1918         (WebKit::NetworkProcess::didReceiveMessage):
1919         (WebKit::NetworkProcess::initializeNetworkProcess):
1920         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
1921         (WebKit::NetworkProcess::addWebsiteDataStore):
1922         (WebKit::NetworkProcess::destroySession):
1923         (WebKit::NetworkProcess::fetchWebsiteData):
1924         (WebKit::NetworkProcess::deleteWebsiteData):
1925         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1926         (WebKit::NetworkProcess::connectionToContextProcessFromIPCConnection):
1927         (WebKit::NetworkProcess::connectionToContextProcessWasClosed):
1928         (WebKit::NetworkProcess::needsServerToContextConnectionForOrigin const):
1929         (WebKit::NetworkProcess::swServerForSession):
1930         (WebKit::NetworkProcess::swOriginStoreForSession):
1931         (WebKit::NetworkProcess::existingSWOriginStoreForSession const):
1932         (WebKit::NetworkProcess::serverToContextConnectionForOrigin):
1933         (WebKit::NetworkProcess::createServerToContextConnection):
1934         (WebKit::NetworkProcess::didFailFetch):
1935         (WebKit::NetworkProcess::didNotHandleFetch):
1936         (WebKit::NetworkProcess::didReceiveFetchResponse):
1937         (WebKit::NetworkProcess::didReceiveFetchData):
1938         (WebKit::NetworkProcess::didReceiveFetchFormData):
1939         (WebKit::NetworkProcess::didFinishFetch):
1940         (WebKit::NetworkProcess::postMessageToServiceWorkerClient):
1941         (WebKit::NetworkProcess::postMessageToServiceWorker):
1942         (WebKit::NetworkProcess::registerSWServerConnection):
1943         (WebKit::NetworkProcess::unregisterSWServerConnection):
1944         (WebKit::NetworkProcess::swContextConnectionMayNoLongerBeNeeded):
1945         (WebKit::NetworkProcess::disableServiceWorkerProcessTerminationDelay):
1946         (WebKit::NetworkProcess::addServiceWorkerSession):
1947         * NetworkProcess/NetworkProcess.h:
1948         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
1949         * NetworkProcess/NetworkProcess.messages.in:
1950         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1951         (WebKit::NetworkProcessCreationParameters::encode const):
1952         (WebKit::NetworkProcessCreationParameters::decode):
1953         * NetworkProcess/NetworkProcessCreationParameters.h:
1954         * NetworkProcess/ServiceWorker/WebSWOriginStore.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp.
1955         (WebKit::WebSWOriginStore::WebSWOriginStore):
1956         (WebKit::WebSWOriginStore::addToStore):
1957         (WebKit::WebSWOriginStore::removeFromStore):
1958         (WebKit::WebSWOriginStore::clearStore):
1959         (WebKit::WebSWOriginStore::importComplete):
1960         (WebKit::WebSWOriginStore::registerSWServerConnection):
1961         (WebKit::WebSWOriginStore::unregisterSWServerConnection):
1962         (WebKit::WebSWOriginStore::sendStoreHandle):
1963         (WebKit::WebSWOriginStore::didInvalidateSharedMemory):
1964         * NetworkProcess/ServiceWorker/WebSWOriginStore.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.h.
1965         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp.
1966         (WebKit::WebSWServerConnection::WebSWServerConnection):
1967         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1968         (WebKit::WebSWServerConnection::rejectJobInClient):
1969         (WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
1970         (WebKit::WebSWServerConnection::resolveUnregistrationJobInClient):
1971         (WebKit::WebSWServerConnection::startScriptFetchInClient):
1972         (WebKit::WebSWServerConnection::updateRegistrationStateInClient):
1973         (WebKit::WebSWServerConnection::fireUpdateFoundEvent):
1974         (WebKit::WebSWServerConnection::setRegistrationLastUpdateTime):
1975         (WebKit::WebSWServerConnection::setRegistrationUpdateViaCache):
1976         (WebKit::WebSWServerConnection::notifyClientsOfControllerChange):
1977         (WebKit::WebSWServerConnection::updateWorkerStateInClient):
1978         (WebKit::WebSWServerConnection::cancelFetch):
1979         (WebKit::WebSWServerConnection::startFetch):
1980         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1981         (WebKit::WebSWServerConnection::scheduleJobInServer):
1982         (WebKit::WebSWServerConnection::didReceiveFetchResponse):
1983         (WebKit::WebSWServerConnection::didReceiveFetchData):
1984         (WebKit::WebSWServerConnection::didReceiveFetchFormData):
1985         (WebKit::WebSWServerConnection::didFinishFetch):
1986         (WebKit::WebSWServerConnection::didFailFetch):
1987         (WebKit::WebSWServerConnection::didNotHandleFetch):
1988         (WebKit::WebSWServerConnection::postMessageToServiceWorkerClient):
1989         (WebKit::WebSWServerConnection::matchRegistration):
1990         (WebKit::WebSWServerConnection::registrationReady):
1991         (WebKit::WebSWServerConnection::getRegistrations):
1992         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1993         (WebKit::WebSWServerConnection::unregisterServiceWorkerClient):
1994         (WebKit::WebSWServerConnection::sendToContextProcess):
1995         * NetworkProcess/ServiceWorker/WebSWServerConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h.
1996         (WebKit::WebSWServerConnection::ipcConnection const):
1997         (WebKit::WebSWServerConnection::sessionID const):
1998         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.messages.in.
1999         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp.
2000         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2001         (WebKit::WebSWServerToContextConnection::messageSenderConnection):
2002         (WebKit::WebSWServerToContextConnection::messageSenderDestinationID):
2003         (WebKit::WebSWServerToContextConnection::connectionClosed):
2004         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
2005         (WebKit::WebSWServerToContextConnection::fireInstallEvent):
2006         (WebKit::WebSWServerToContextConnection::fireActivateEvent):
2007         (WebKit::WebSWServerToContextConnection::terminateWorker):
2008         (WebKit::WebSWServerToContextConnection::syncTerminateWorker):
2009         (WebKit::WebSWServerToContextConnection::findClientByIdentifierCompleted):
2010         (WebKit::WebSWServerToContextConnection::matchAllCompleted):
2011         (WebKit::WebSWServerToContextConnection::claimCompleted):
2012         (WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
2013         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
2014         (WebKit::WebSWServerToContextConnection::terminate):
2015         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h.
2016         (WebKit::WebSWServerToContextConnection::create):
2017         (WebKit::WebSWServerToContextConnection::ipcConnection const):
2018         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: Renamed from Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in.
2019         * NetworkProcess/ios/NetworkProcessIOS.mm:
2020         (WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):
2021         * Shared/Storage/StorageProcessCreationParameters.cpp:
2022         (WebKit::StorageProcessCreationParameters::encode const):
2023         (WebKit::StorageProcessCreationParameters::decode):
2024         * Shared/Storage/StorageProcessCreationParameters.h:
2025         (): Deleted.
2026         * Shared/WebsiteDataStoreParameters.cpp:
2027         (WebKit::WebsiteDataStoreParameters::encode const):
2028         (WebKit::WebsiteDataStoreParameters::decode):
2029         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
2030         * Shared/WebsiteDataStoreParameters.h:
2031         * Sources.txt:
2032         * StorageProcess/StorageProcess.cpp:
2033         (WebKit::StorageProcess::didReceiveMessage):
2034         (WebKit::StorageProcess::initializeWebsiteDataStore):
2035         (WebKit::StorageProcess::createStorageToWebProcessConnection):
2036         (WebKit::StorageProcess::destroySession):
2037         (WebKit::StorageProcess::fetchWebsiteData):
2038         (WebKit::StorageProcess::deleteWebsiteData):
2039         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
2040         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection): Deleted.
2041         (WebKit::StorageProcess::connectionToContextProcessWasClosed): Deleted.
2042         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const): Deleted.
2043         (WebKit::StorageProcess::swServerForSession): Deleted.
2044         (WebKit::StorageProcess::swOriginStoreForSession): Deleted.
2045         (WebKit::StorageProcess::existingSWOriginStoreForSession const): Deleted.
2046         (WebKit::StorageProcess::serverToContextConnectionForOrigin): Deleted.
2047         (WebKit::StorageProcess::createServerToContextConnection): Deleted.
2048         (WebKit::StorageProcess::didFailFetch): Deleted.
2049         (WebKit::StorageProcess::didNotHandleFetch): Deleted.
2050         (WebKit::StorageProcess::didReceiveFetchResponse): Deleted.
2051         (WebKit::StorageProcess::didReceiveFetchData): Deleted.
2052         (WebKit::StorageProcess::didReceiveFetchFormData): Deleted.
2053         (WebKit::StorageProcess::didFinishFetch): Deleted.
2054         (WebKit::StorageProcess::postMessageToServiceWorkerClient): Deleted.
2055         (WebKit::StorageProcess::postMessageToServiceWorker): Deleted.
2056         (WebKit::StorageProcess::registerSWServerConnection): Deleted.
2057         (WebKit::StorageProcess::unregisterSWServerConnection): Deleted.
2058         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded): Deleted.
2059         (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay): Deleted.
2060         * StorageProcess/StorageProcess.h:
2061         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted.
2062         (): Deleted.
2063         * StorageProcess/StorageProcess.messages.in:
2064         * StorageProcess/StorageToWebProcessConnection.cpp:
2065         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
2066         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2067         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
2068         (WebKit::StorageToWebProcessConnection::didClose):
2069         (WebKit::StorageToWebProcessConnection::unregisterSWConnections): Deleted.
2070         (WebKit::StorageToWebProcessConnection::establishSWServerConnection): Deleted.
2071         * StorageProcess/StorageToWebProcessConnection.h:
2072         * StorageProcess/StorageToWebProcessConnection.messages.in:
2073         * StorageProcess/ios/StorageProcessIOS.mm:
2074         (WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement const): Deleted.
2075         * UIProcess/Network/NetworkProcessProxy.cpp:
2076         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2077         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2078         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2079         (WebKit::NetworkProcessProxy::didFinishLaunching):
2080         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcess):
2081         (WebKit::NetworkProcessProxy::establishWorkerContextConnectionToNetworkProcessForExplicitSession):
2082         * UIProcess/Network/NetworkProcessProxy.h:
2083         * UIProcess/Network/NetworkProcessProxy.messages.in:
2084         * UIProcess/ServiceWorkerProcessProxy.cpp:
2085         (WebKit::ServiceWorkerProcessProxy::start):
2086         * UIProcess/Storage/StorageProcessProxy.cpp:
2087         (WebKit::StorageProcessProxy::getStorageProcessConnection):
2088         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess): Deleted.
2089         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession): Deleted.
2090         * UIProcess/Storage/StorageProcessProxy.h:
2091         * UIProcess/Storage/StorageProcessProxy.messages.in:
2092         * UIProcess/WebProcessPool.cpp:
2093         (WebKit::WebProcessPool::ensureNetworkProcess):
2094         (WebKit::WebProcessPool::networkProcessCrashed):
2095         (WebKit::WebProcessPool::getNetworkProcessConnection):
2096         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2097         (WebKit::WebProcessPool::establishWorkerContextConnectionToNetworkProcess):
2098         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay):
2099         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2100         (WebKit::WebProcessPool::registerURLSchemeServiceWorkersCanHandle):
2101         (WebKit::WebProcessPool::postMessageToServiceWorkerClient):
2102         (WebKit::WebProcessPool::postMessageToServiceWorker):
2103         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess): Deleted.
2104         * UIProcess/WebProcessPool.h:
2105         * UIProcess/WebProcessProxy.cpp:
2106         (WebKit::WebProcessProxy::getNetworkProcessConnection):
2107         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2108         (WebKit::WebsiteDataStore::parameters):
2109         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2110         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2111         (WebKit::WebsiteDataStore::fetchDataAndApply):
2112         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2113         (WebKit::WebsiteDataStore::removeData):
2114         (WebKit::WebsiteDataStore::storageProcessParameters):
2115         (WebKit::WebsiteDataStore::parameters):
2116         * WebKit.xcodeproj/project.pbxproj:
2117         * WebProcess/Network/NetworkProcessConnection.cpp:
2118         (WebKit::NetworkProcessConnection::didReceiveMessage):
2119         (WebKit::NetworkProcessConnection::didReceiveSyncMessage):
2120         (WebKit::NetworkProcessConnection::didClose):
2121         (WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
2122         * WebProcess/Network/NetworkProcessConnection.h:
2123         (WebKit::NetworkProcessConnection::existingServiceWorkerConnectionForSession):
2124         * WebProcess/Storage/WebSWClientConnection.cpp:
2125         (WebKit::WebSWClientConnection::WebSWClientConnection):
2126         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2127         (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection):
2128         (WebKit::WebSWContextManagerConnection::serviceWorkerStartedWithMessage):
2129         (WebKit::WebSWContextManagerConnection::startFetch):
2130         (WebKit::WebSWContextManagerConnection::didFinishInstall):
2131         (WebKit::WebSWContextManagerConnection::didFinishActivation):
2132         (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
2133         (WebKit::WebSWContextManagerConnection::skipWaiting):
2134         (WebKit::WebSWContextManagerConnection::setScriptResource):
2135         (WebKit::WebSWContextManagerConnection::workerTerminated):
2136         (WebKit::WebSWContextManagerConnection::findClientByIdentifier):
2137         (WebKit::WebSWContextManagerConnection::matchAll):
2138         (WebKit::WebSWContextManagerConnection::claim):
2139         * WebProcess/Storage/WebSWContextManagerConnection.h:
2140         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
2141         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
2142         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
2143         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
2144         (WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
2145         (WebKit::WebServiceWorkerFetchTaskClient::didFail):
2146         (WebKit::WebServiceWorkerFetchTaskClient::didFinish):
2147         (WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
2148         * WebProcess/Storage/WebServiceWorkerProvider.cpp:
2149         (WebKit::WebServiceWorkerProvider::serviceWorkerConnectionForSession):
2150         (WebKit::WebServiceWorkerProvider::existingServiceWorkerConnectionForSession):
2151         (WebKit::WebServiceWorkerProvider::handleFetch):
2152         * WebProcess/Storage/WebToStorageProcessConnection.cpp:
2153         (WebKit::WebToStorageProcessConnection::didReceiveMessage):
2154         (WebKit::WebToStorageProcessConnection::didReceiveSyncMessage):
2155         (WebKit::WebToStorageProcessConnection::didClose):
2156         (WebKit::WebToStorageProcessConnection::serviceWorkerConnectionForSession): Deleted.
2157         * WebProcess/Storage/WebToStorageProcessConnection.h:
2158         (WebKit::WebToStorageProcessConnection::existingServiceWorkerConnectionForSession): Deleted.
2159         * WebProcess/WebProcess.cpp:
2160         (WebKit::WebProcess::networkProcessConnectionClosed):
2161         (WebKit::WebProcess::webToStorageProcessConnectionClosed):
2162         (WebKit::WebProcess::establishWorkerContextConnectionToNetworkProcess):
2163         (WebKit::WebProcess::establishWorkerContextConnectionToStorageProcess): Deleted.
2164         * WebProcess/WebProcess.h:
2165         (WebKit::WebProcess::existingNetworkProcessConnection):
2166         (WebKit::WebProcess::existingWebToStorageProcessConnection): Deleted.
2167         * WebProcess/WebProcess.messages.in:
2168
2169 2018-09-25  Chris Dumez  <cdumez@apple.com>
2170
2171         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
2172         https://bugs.webkit.org/show_bug.cgi?id=189927
2173
2174         Reviewed by Alex Christensen.
2175
2176         UIProcess should process incoming sync IPC from WebProcess when waiting for a sync IPC reply from it
2177         in order to avoid deadlocks. This is not an issue currently because the WebProcess does process
2178         incoming sync IPC when waiting for a sync IPC reply. However, we plan to change this in the future
2179         in order to avoid bugs caused by re-entering WebCore at unsafe times.
2180
2181         The reason the UIProcess previously did not do out of order sync IPC process was to avoid processing
2182         a synchronous policy decision IPC for a frameID it did not know about yet, due to the DidCreateMainFrame /
2183         DidCreateSubframe IPC messages being asynchronous. To address this issue, the decidePolicyForNavigationActionSync
2184         IPC handler now calls didCreateMainFrame() / didCreateSubframe() as needed if it does not know about
2185         the frame yet. Note that synchronous policy decisions are rare and are currently only needed by initial
2186         about:blank and fragment navigations.
2187
2188         * UIProcess/WebPageProxy.cpp:
2189         (WebKit::WebPageProxy::didCreateMainFrame):
2190         (WebKit::WebPageProxy::didCreateSubframe):
2191         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2192         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2193         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2194         * UIProcess/WebPageProxy.h:
2195         * UIProcess/WebPageProxy.messages.in:
2196         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2197         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2198         * WebProcess/WebProcess.cpp:
2199         (WebKit::WebProcess::initializeConnection):
2200
2201 2018-09-25  Chris Dumez  <cdumez@apple.com>
2202
2203         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer
2204         https://bugs.webkit.org/show_bug.cgi?id=189851
2205         <rdar://problem/44696263>
2206
2207         Reviewed by Alex Christensen.
2208
2209         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer:
2210         - NetworkProcessProxy::m_processPool
2211         - StorageProcessProxy::m_processPool
2212
2213         Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and
2214         StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code
2215         extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes
2216         so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, it is very
2217         tempting for people to simply ref the NetworkProcessProxy / StorageProcessProxy given that they are refcounted.
2218         For this reason, this patch updates NetworkProcessProxy / StorageProcessProxy so that they are no longer RefCounted
2219         and so that the WebProcessPool truly owns them via std::unique_ptr<>.
2220
2221         * UIProcess/ChildProcessProxy.h:
2222         * UIProcess/Network/NetworkProcessProxy.cpp:
2223         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2224         (WebKit::NetworkProcessProxy::didClose):
2225         (WebKit::NetworkProcessProxy::create): Deleted.
2226         * UIProcess/Network/NetworkProcessProxy.h:
2227         (WebKit::NetworkProcessProxy::throttler): Deleted.
2228         (WebKit::NetworkProcessProxy::processPool): Deleted.
2229         * UIProcess/Plugins/PluginProcessProxy.h:
2230         (WebKit::PluginProcessProxy::pluginProcessAttributes const): Deleted.
2231         (WebKit::PluginProcessProxy::pluginProcessToken const): Deleted.
2232         (WebKit::PluginProcessProxy::isValid const): Deleted.
2233         * UIProcess/Storage/StorageProcessProxy.cpp:
2234         (WebKit::StorageProcessProxy::create): Deleted.
2235         * UIProcess/Storage/StorageProcessProxy.h:
2236         * UIProcess/WebProcessPool.cpp:
2237         (WebKit::WebProcessPool::ensureNetworkProcess):
2238         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2239         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
2240         * UIProcess/WebProcessPool.h:
2241         * UIProcess/WebProcessProxy.h:
2242
2243 2018-09-25  Alex Christensen  <achristensen@webkit.org>
2244
2245         NetworkLoad::didReceiveResponse should pass its completion handler to its client
2246         https://bugs.webkit.org/show_bug.cgi?id=188701
2247
2248         Reviewed by Michael Catanzaro.
2249
2250         Right now we have a confusing enum ShouldContinueDidReceiveResponse and a complicated flow
2251         that involves many objects and implicitly using NetworkLoad's destructor as part of the
2252         loading flow.  This makes the responsibilities of the objects clear.
2253
2254         * NetworkProcess/Downloads/PendingDownload.cpp:
2255         (WebKit::PendingDownload::didReceiveResponse):
2256         * NetworkProcess/Downloads/PendingDownload.h:
2257         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2258         (WebKit::NetworkCORSPreflightChecker::didReceiveResponse):
2259         (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession): Deleted.
2260         * NetworkProcess/NetworkCORSPreflightChecker.h:
2261         * NetworkProcess/NetworkDataTask.cpp:
2262         (WebKit::NetworkDataTask::didReceiveResponse):
2263         * NetworkProcess/NetworkDataTask.h:
2264         * NetworkProcess/NetworkLoad.cpp:
2265         (WebKit::NetworkLoad::~NetworkLoad):
2266         (WebKit::NetworkLoad::convertTaskToDownload):
2267         (WebKit::NetworkLoad::didReceiveResponse):
2268         (WebKit::NetworkLoad::notifyDidReceiveResponse):
2269         (WebKit::NetworkLoad::continueDidReceiveResponse): Deleted.
2270         (WebKit::NetworkLoad::didReceiveResponseNetworkSession): Deleted.
2271         * NetworkProcess/NetworkLoad.h:
2272         * NetworkProcess/NetworkLoadClient.h:
2273         * NetworkProcess/NetworkResourceLoader.cpp:
2274         (WebKit::NetworkResourceLoader::~NetworkResourceLoader):
2275         (WebKit::NetworkResourceLoader::didReceiveResponse):
2276         (WebKit::NetworkResourceLoader::didFinishWithRedirectResponse):
2277         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
2278         * NetworkProcess/NetworkResourceLoader.h:
2279         * NetworkProcess/PingLoad.cpp:
2280         (WebKit::PingLoad::didReceiveResponse):
2281         (WebKit::PingLoad::didReceiveResponseNetworkSession): Deleted.
2282         * NetworkProcess/PingLoad.h:
2283         * NetworkProcess/PreconnectTask.cpp:
2284         (WebKit::PreconnectTask::didReceiveResponse):
2285         * NetworkProcess/PreconnectTask.h:
2286         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
2287         (WebKit::NetworkCache::SpeculativeLoad::didReceiveResponse):
2288         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
2289         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2290         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2291
2292 2018-09-24  Alex Christensen  <achristensen@webkit.org>
2293
2294         Build fix.
2295         https://bugs.webkit.org/show_bug.cgi?id=189929
2296
2297         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
2298
2299 2018-09-24  Alex Christensen  <achristensen@webkit.org>
2300
2301         Prepare to replace WKBundleFileHandleCreateWithPath with a version that takes a WKBundlePageRef
2302         https://bugs.webkit.org/show_bug.cgi?id=189929
2303
2304         Reviewed by Andy Estes.
2305
2306         This will be needed for rdar://problem/24576194
2307
2308         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.cpp:
2309         (WKBundleFileHandleCreateWithPathForPage):
2310         * WebProcess/InjectedBundle/API/c/WKBundleFileHandleRef.h:
2311
2312 2018-09-24  Alex Christensen  <achristensen@webkit.org>
2313
2314         Begin deprecating C API
2315         https://bugs.webkit.org/show_bug.cgi?id=189810
2316
2317         Reviewed by Andy Estes.
2318
2319         * Shared/API/c/WKDeprecated.h: Added.
2320         * UIProcess/API/C/WKPage.h:
2321         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
2322         (setUpPagePolicyClient):
2323         (-[WKBrowsingContextController setPolicyDelegate:]):
2324         * WebKit.xcodeproj/project.pbxproj:
2325
2326 2018-09-24  Chris Dumez  <cdumez@apple.com>
2327
2328         Unreviewed, rolling out r236368.
2329
2330         Caused WebKit.NetworkProcessCrashWithPendingConnection API
2331         test to crash (Bug 189926)
2332
2333         Reverted changeset:
2334
2335         "Extending the lifetime of a NetworkProcessProxy /
2336         StorageProcessProxy may cause it to have a stale
2337         WebProcessPool pointer"
2338         https://bugs.webkit.org/show_bug.cgi?id=189851
2339         https://trac.webkit.org/changeset/236368
2340
2341 2018-09-21  Simon Fraser  <simon.fraser@apple.com>
2342
2343         Remove the old "AcceleratedCompositingForOverflowScroll" code
2344         https://bugs.webkit.org/show_bug.cgi?id=189870
2345
2346         Reviewed by Zalan Bujtas.
2347
2348         The "AcceleratedCompositingForOverflowScroll" code was added to allow overflow:scroll to use
2349         composited scrolling if an overflow:scroll could be made a stacking context without affecting
2350         z-order. We need overflow:scroll to be accelerated always, so a different approach is needed.
2351         Remove this old code (unused by any platform?) to make working on new code easier.
2352
2353         * Shared/WebPreferences.yaml:
2354         * UIProcess/API/C/WKPreferences.cpp:
2355         (WKPreferencesSetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
2356         (WKPreferencesGetAcceleratedCompositingForOverflowScrollEnabled): Deleted.
2357         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2358
2359 2018-09-24  Chris Dumez  <cdumez@apple.com>
2360
2361         Do not do early processing of incoming sync IPC unless we're waiting for a sync IPC reply
2362         https://bugs.webkit.org/show_bug.cgi?id=186941
2363
2364         Reviewed by Alex Christensen.
2365
2366         The comment was claiming we were processing incoming sync messages while waiting for a
2367         sync IPC reply to prevent deadlocks. However, the code was failing to check if we were
2368         waiting for a sync IPC reply. As a result, incoming sync IPC messages would get processed
2369         early no matter what, jumping the line. This was the source of the flakiness in the blob
2370         tests since the IPC to register the blob in the network process was async and the follow-up
2371         IPC to ask the network process for the blob size was sync. The sync message to get the blob
2372         size would jump the line and get processed before the async message to register the blob.
2373         As a result, the network process would not know about the blob yet and return size 0. Of
2374         course, this could happen if the network process was sending sync IPC at the time. However,
2375         the network process never sends any sync IPC and therefore, should never process incoming
2376         IPC messages out of order.
2377
2378         * Platform/IPC/Connection.cpp:
2379         (IPC::Connection::processIncomingMessage):
2380
2381 2018-09-24  Daniel Bates  <dabates@apple.com>
2382
2383         [iOS] Key code is 0 for many hardware keyboard keys
2384         https://bugs.webkit.org/show_bug.cgi?id=189604
2385
2386         Reviewed by Wenson Hsieh.
2387
2388         For a hardware keyboard-generated event (an event with a non-nill event._hidEvent) pass
2389         the key code for the event. Otherwise, do what we do now and pass 0 as the event is likely
2390         a software keyboard-generated event.
2391
2392         * Platform/spi/ios/UIKitSPI.h: Add some more SPI.
2393         * UIProcess/ios/WKContentViewInteraction.mm:
2394         (-[WKContentView handleKeyEvent:]):
2395
2396 2018-09-24  Brian Burg  <bburg@apple.com>
2397
2398         Web Inspector: topContentInset is not accounted for when inspecting a WKWebView and docked to side
2399         https://bugs.webkit.org/show_bug.cgi?id=189859
2400
2401         Reviewed by Joseph Pecoraro.
2402
2403         * UIProcess/mac/WebInspectorProxyMac.mm:
2404         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2405         Add special cases for inspecting a WKWebView. We already special-case for WKView.
2406
2407 2018-09-24  Miguel Gomez  <magomez@igalia.com>
2408
2409         [GTK][WPE] Compositing indicators are not working
2410         https://bugs.webkit.org/show_bug.cgi?id=189915
2411
2412         Reviewed by Žan Doberšek.
2413
2414         Pass the debugBorder and repaintCount parameters to the TextureMapperLayer when required.
2415
2416         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2417         (WebKit::CoordinatedGraphicsScene::updateSceneState):
2418
2419 2018-09-21  Dean Jackson  <dino@apple.com>
2420
2421         Add PointerEvent, plus feature flag, plus Web Platform Tests
2422         https://bugs.webkit.org/show_bug.cgi?id=189867
2423         <rdar://problem/44697384>
2424
2425         Reviewed by Simon Fraser.
2426
2427         Add PointerEvents as an experimental feature.
2428
2429         * Shared/WebPreferences.yaml:
2430
2431 2018-09-21  Brian Burg  <bburg@apple.com>
2432
2433         Web Inspector: dock buttons disappear if Web Inspector goes fullscreen
2434         https://bugs.webkit.org/show_bug.cgi?id=189865
2435         <rdar://problem/42600534>
2436
2437         Reviewed by Matt Baker.
2438
2439         When a fullscreen Safari tab has a docked Inspector, and the "detach" button
2440         is clicked, Inspector goes into its own fullscreen window. In that window,
2441         there are no buttons for docking to side or bottom.
2442
2443         It turns out that we always send setDockingUnavailable(true) if the inspector
2444         window is fullscreen. This eventually causes the inspector to reflect that
2445         by hiding the docking-related buttons.
2446
2447         * UIProcess/mac/WebInspectorProxyMac.mm:
2448         (WebKit::WebInspectorProxy::platformCanAttach):
2449         This early exit does not seem to serve any purpose, so remove it.
2450
2451 2018-09-21  Chris Dumez  <cdumez@apple.com>
2452
2453         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer
2454         https://bugs.webkit.org/show_bug.cgi?id=189851
2455
2456         Reviewed by Alex Christensen.
2457
2458         Extending the lifetime of a NetworkProcessProxy / StorageProcessProxy may cause it to have a stale WebProcessPool pointer:
2459         - NetworkProcessProxy::m_processPool
2460         - StorageProcessProxy::m_processPool
2461
2462         Those data members are C++ references because it is expected that the WebProcessPool owns the NetworkProcessProxy and
2463         StorageProcessProxy. However, since NetworkProcessProxy / StorageProcessProxy are refcounted, it has happened that code
2464         extends the lifetime of those past their process pool, leading to stale prrocess pool usage. The fix for these crashes
2465         so far as been to ref the WebProcessPool instead of the NetworkProcessProxy / StorageProcessProxy. However, given how
2466         error-prone this is, this patch updates NetworkProcessProxy / StorageProcessProxy so that they forward their refcounting
2467         to the WebProcessPool.
2468
2469         * UIProcess/ChildProcessProxy.h:
2470         * UIProcess/Network/NetworkProcessProxy.cpp:
2471         (WebKit::NetworkProcessProxy::ref):
2472         (WebKit::NetworkProcessProxy::deref):
2473         (WebKit::NetworkProcessProxy::didClose):
2474         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
2475         (WebKit::NetworkProcessProxy::create): Deleted.
2476         * UIProcess/Network/NetworkProcessProxy.h:
2477         * UIProcess/Plugins/PluginProcessProxy.h:
2478         * UIProcess/Storage/StorageProcessProxy.cpp:
2479         (WebKit::StorageProcessProxy::ref):
2480         (WebKit::StorageProcessProxy::deref):
2481         (WebKit::StorageProcessProxy::create): Deleted.
2482         * UIProcess/Storage/StorageProcessProxy.h:
2483         * UIProcess/WebProcessPool.cpp:
2484         (WebKit::WebProcessPool::ensureNetworkProcess):
2485         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
2486         * UIProcess/WebProcessPool.h:
2487         * UIProcess/WebProcessProxy.h:
2488
2489 2018-09-21  Alex Christensen  <achristensen@webkit.org>
2490
2491         Use a Variant for FormDataElement
2492         https://bugs.webkit.org/show_bug.cgi?id=189777
2493
2494         Reviewed by Chris Dumez.
2495
2496         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2497         (WebKit::NetworkResourceLoadParameters::encode const):
2498         * NetworkProcess/NetworkResourceLoader.cpp:
2499         * Shared/SessionState.h:
2500         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2501         (WebKit::toHTTPBody):
2502
2503 2018-09-21  Alex Christensen  <achristensen@webkit.org>
2504
2505         Simply authentication code even more!
2506         https://bugs.webkit.org/show_bug.cgi?id=189719
2507
2508         Reviewed by Andy Estes.
2509
2510         Just when you thought it couldn't get simpler and more elegant, it can!
2511
2512         * NetworkProcess/Downloads/Download.cpp:
2513         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2514         * NetworkProcess/NetworkLoad.cpp:
2515         * NetworkProcess/PingLoad.cpp:
2516         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2517         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2518         * Shared/Authentication/AuthenticationChallengeDisposition.h: Added.
2519         * Shared/Authentication/AuthenticationManager.cpp:
2520         (WebKit::AuthenticationManager::completeAuthenticationChallenge):
2521         (WebKit::AuthenticationManager::useCredentialForChallenge): Deleted.
2522         (WebKit::AuthenticationManager::useCredentialForSingleChallenge): Deleted.
2523         (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): Deleted.
2524         (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): Deleted.
2525         (WebKit::AuthenticationManager::cancelChallenge): Deleted.
2526         (WebKit::AuthenticationManager::cancelSingleChallenge): Deleted.
2527         (WebKit::AuthenticationManager::performDefaultHandling): Deleted.
2528         (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): Deleted.
2529         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): Deleted.
2530         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): Deleted.
2531         * Shared/Authentication/AuthenticationManager.h:
2532         * Shared/Authentication/AuthenticationManager.messages.in:
2533         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2534         (WebKit::AuthenticationManager::initializeConnection):
2535         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
2536         (WKAuthenticationDecisionListenerUseCredential):
2537         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
2538         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
2539         * UIProcess/API/glib/WebKitAuthenticationRequest.cpp:
2540         (webkit_authentication_request_authenticate):
2541         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
2542         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
2543         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
2544         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
2545         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
2546         (WebKit::AuthenticationDecisionListener::useCredential):
2547         (WebKit::AuthenticationDecisionListener::cancel):
2548         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
2549         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
2550         * UIProcess/Authentication/AuthenticationDecisionListener.h:
2551         (WebKit::AuthenticationDecisionListener::create):
2552         * UIProcess/Cocoa/DownloadClient.mm:
2553         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
2554         * UIProcess/Cocoa/NavigationState.mm:
2555         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
2556         * WebKit.xcodeproj/project.pbxproj:
2557
2558 2018-09-21  Chris Dumez  <cdumez@apple.com>
2559
2560         Regression(Mojave): Resuming a WK2 download crashes
2561         https://bugs.webkit.org/show_bug.cgi?id=189838
2562         <rdar://problem/44618538>
2563
2564         Reviewed by Alex Christensen.
2565
2566         Update our workaround to tweak the download resume data to include the actual download path so that
2567         it works on macOS Mojave and up. Unfortunately, the resume data internal representation has changed,
2568         causing our previous workaround to fail.
2569
2570         * NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
2571         (WebKit::Download::resume):
2572
2573 2018-09-21  Youenn Fablet  <youenn@apple.com>
2574
2575         Whitelist two additional plugins
2576         https://bugs.webkit.org/show_bug.cgi?id=189832
2577         <rdar://problem/44628127>
2578
2579         Reviewed by Brent Fulgham.
2580
2581         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2582         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
2583
2584 2018-09-21  Woodrow Wang  <woodrow_wang@apple.com>
2585
2586         Clear persistent storage between tests for resourceLoadStatistics
2587         https://bugs.webkit.org/show_bug.cgi?id=189684
2588         <rdar://problem/44540099>
2589
2590         Reviewed by Chris Dumez.
2591
2592         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2593         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2594         * UIProcess/Network/NetworkProcessProxy.cpp:
2595         (WebKit::NetworkProcessProxy::didClose):
2596         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
2597         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2598         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2599
2600         Remove function only called in testing for resetting statistics to consistent
2601         state. 
2602
2603         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
2604
2605         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2606         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
2607         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
2608
2609 2018-09-20  Ryan Haddad  <ryanhaddad@apple.com>
2610
2611         Unreviewed, rolling out r236289.
2612
2613         Caused 8 TestWebKitAPI.ContentFiltering test failures.
2614
2615         Reverted changeset:
2616
2617         "InjectedBundle parameters often need initialization function
2618         called before unarchiving"
2619         https://bugs.webkit.org/show_bug.cgi?id=189709
2620         https://trac.webkit.org/changeset/236289
2621
2622 2018-09-20  Youenn Fablet  <youenn@apple.com>
2623
2624         Allow additional plug-ins to run unsandboxed
2625         https://bugs.webkit.org/show_bug.cgi?id=189791
2626         <rdar://problem/44628127>
2627
2628         Reviewed by Brent Fulgham.
2629
2630         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2631         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed):
2632
2633 2018-09-20  Brent Fulgham  <bfulgham@apple.com>
2634
2635         InjectedBundle parameters often need initialization function called before unarchiving
2636         https://bugs.webkit.org/show_bug.cgi?id=189709
2637         <rdar://problem/44573653>
2638
2639         Reviewed by Chris Dumez.
2640
2641         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2642         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2643         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2644         register additional classes that are safe for serialization.
2645         
2646         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2647         This new method returns 'true' if the serialization was successful, otherwise it returns false.
2648
2649         Revise 'initialize' to call this new method and check the return value. If it fails, try decoding the
2650         bundle parameters after the bundle's initialization function is called.
2651
2652         * WebProcess/InjectedBundle/InjectedBundle.h:
2653         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2654         (WebKit::InjectedBundle::initialize): Use the new method.
2655         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2656         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2657         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2658         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2659         NSDictionary object may itself hold other kinds of objects.
2660
2661 2018-09-20  Jer Noble  <jer.noble@apple.com>
2662
2663         Enable Modern EME by default
2664         https://bugs.webkit.org/show_bug.cgi?id=189794
2665
2666         Reviewed by Jon Lee.
2667
2668         * Shared/WebPreferences.yaml:
2669
2670 2018-09-20  Thibault Saunier  <tsaunier@igalia.com>
2671
2672         [GTK][WPE] Make sure MediaDeviceEnabled and PeerConnectionEnabled are always synced with enable-media-stream
2673         https://bugs.webkit.org/show_bug.cgi?id=188704
2674
2675         By default m_isMediaDevicesEnabled and m_isScreenCaptureEnabled are false but
2676         m_isMediaStreamEnabled is true meaning that in the WPE minibrowser getUserMedia
2677         was disabled even if we explicitly set `"enable-media-stream", TRUE`.
2678
2679         Reviewed by Michael Catanzaro.
2680
2681         * UIProcess/API/glib/WebKitSettings.cpp:
2682         (webKitSettingsConstructed):
2683
2684 2018-09-20  Justin Michaud  <justin_michaud@apple.com>
2685
2686         Implement CSS Custom Properties and Values Skeleton
2687         https://bugs.webkit.org/show_bug.cgi?id=189694
2688
2689         Reviewed by Simon Fraser.
2690
2691         Add feature flag for CSS custom properties and values api
2692
2693         * Shared/WebPreferences.yaml:
2694         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2695         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2696
2697 2018-09-19  Dean Jackson  <dino@apple.com>
2698
2699         Temporarily move fullscreen back to experimental features
2700         https://bugs.webkit.org/show_bug.cgi?id=189770
2701         <rdar://problem/44619282>
2702
2703         Revert this change now that there is a commit to cherry-pick.
2704
2705         * Shared/WebPreferences.yaml:
2706
2707 2018-09-20  Chris Dumez  <cdumez@apple.com>
2708
2709         Unreviewed crash fix after r236226.
2710
2711         We need to protect |this| in WebProcessProxy::requestTermination().
2712
2713         * UIProcess/WebProcessProxy.cpp:
2714         (WebKit::WebProcessProxy::requestTermination):
2715
2716 2018-09-20  Antti Koivisto  <antti@apple.com>
2717
2718         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
2719         https://bugs.webkit.org/show_bug.cgi?id=189663
2720         <rdar://problem/44184955>
2721
2722         Reviewed by Geoff Garen and Chris Dumez.
2723
2724         We need to keep the layer tree of the previous page alive and visible until we have something
2725         to render on the new page. With PSON on Mac this means that we should keep displaying the
2726         layer tree from the previus process.
2727
2728         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
2729         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
2730         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
2731
2732         * UIProcess/DrawingAreaProxy.h:
2733         (WebKit::DrawingAreaProxy::attachInWebProcess):
2734         * UIProcess/SuspendedPageProxy.cpp:
2735         (WebKit::messageNamesToIgnoreWhileSuspended):
2736         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
2737
2738         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
2739         message for it.
2740
2741         * UIProcess/SuspendedPageProxy.h:
2742         * UIProcess/WebPageProxy.cpp:
2743         (WebKit::WebPageProxy::didCompletePageTransition):
2744
2745         Attach the drawing area if appropriate.
2746
2747         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2748
2749         Call PageClien::processWillSwap instead of processDidExit when appropriate.
2750
2751         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
2752
2753         This is called when we have switched to the new layer tree.
2754         Tear down the drawing area in the previus process.
2755
2756         * UIProcess/WebPageProxy.h:
2757         * UIProcess/WebPageProxy.messages.in:
2758         * UIProcess/ios/PageClientImplIOS.h:
2759         * UIProcess/ios/PageClientImplIOS.mm:
2760         (WebKit::PageClientImpl::processWillSwap):
2761
2762         On iOS this just call processDidExit for now.
2763
2764         * UIProcess/mac/PageClientImplMac.h:
2765         * UIProcess/mac/PageClientImplMac.mm:
2766         (WebKit::PageClientImpl::processWillSwap):
2767         (WebKit::PageClientImpl::processDidExit):
2768
2769         Add processWillSwap separately from processDidExit. They are currently the same
2770         except processWillSwap doesn't clear the root layer.
2771
2772         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2773         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2774         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
2775
2776         Send a message to the web process to attach the drawing area.
2777
2778         * WebProcess/WebPage/DrawingArea.h:
2779         (WebKit::DrawingArea::attach):
2780         (WebKit::DrawingArea::attachDrawingArea): Deleted.
2781
2782         Rename to be less redundant.
2783
2784         * WebProcess/WebPage/DrawingArea.messages.in:
2785         * WebProcess/WebPage/WebPage.cpp:
2786         (WebKit::WebPage::reinitializeWebPage):
2787
2788         Don't attach drawing area automatically. It will be done by a message from UI process.
2789
2790         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2791
2792         Layer tree is always frozen in a suspended process (if it exists).
2793
2794         (WebKit::WebPage::didReceivePolicyDecision):
2795
2796         Suspend immediately when receiving policy decision to avoid flash on 'about:blank' loading.
2797
2798         (WebKit::WebPage::didStartPageTransition):
2799         (WebKit::WebPage::didCompletePageTransition):
2800
2801         Notify UI process of transition completion.
2802
2803         (WebKit::WebPage::setIsSuspended):
2804         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
2805         * WebProcess/WebPage/WebPage.h:
2806         * WebProcess/WebPage/WebPage.messages.in:
2807         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2808         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2809         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2810
2811         Don't attach drawing area automatically. It will be done by a message from UI process.
2812
2813         (WebKit::TiledCoreAnimationDrawingArea::attach):
2814         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
2815
2816 2018-09-20  Tomas Popela  <tpopela@redhat.com>
2817
2818         [GTK] Always prints in portrait when landscape is requested
2819         https://bugs.webkit.org/show_bug.cgi?id=189543
2820
2821         Reviewed by Michael Catanzaro.
2822
2823         We have to change the surface size based on the requested orientation.
2824         Otherwise only portrait will be printed as it's hardcoded.
2825
2826         * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
2827
2828 2018-09-19  Dean Jackson  <dino@grorg.org>
2829
2830         Temporarily move fullscreen back to experimental features
2831         https://bugs.webkit.org/show_bug.cgi?id=189770
2832         <rdar://problem/44619282>
2833
2834         Reviewed by Simon Fraser.
2835
2836         Make fullscreen an experimental feature again.
2837
2838         * Shared/WebPreferences.yaml:
2839
2840 2018-09-19  Dawei Fenton  <realdawei@apple.com>
2841
2842         Unreviewed, rolling out r236229.
2843
2844         caused API timouts on mac and ios
2845
2846         Reverted changeset:
2847
2848         "Clear persistent storage between tests for
2849         resourceLoadStatistics"
2850         https://bugs.webkit.org/show_bug.cgi?id=189684
2851         https://trac.webkit.org/changeset/236229
2852
2853 2018-09-19  Alex Christensen  <achristensen@webkit.org>
2854
2855         REGRESSION(236154) C API clients not using WKPageSetPageNavigationClient couldn't complete HTTPS requests
2856         https://bugs.webkit.org/show_bug.cgi?id=189771
2857
2858         Reviewed by Tim Horton.
2859
2860         * UIProcess/API/APINavigationClient.h:
2861         (API::NavigationClient::didReceiveAuthenticationChallenge):
2862         Perform default behavior if there's an authentication challenge but we're using the default navigation client.
2863         I wish we had infrastructure to test this but WebKitTestRunner uses WKPageSetNavigationClient
2864         and we don't have the ability to do networking from API tests.  This is a growing problem I intend to solve.
2865
2866 2018-09-19  Woodrow Wang  <woodrow_wang@apple.com>
2867
2868         Clear persistent storage between tests for resourceLoadStatistics
2869         https://bugs.webkit.org/show_bug.cgi?id=189684
2870         <rdar://problem/44540099>
2871
2872         Reviewed by Chris Dumez.
2873
2874         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2875         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2876         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2877         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2878
2879         Remove function only called in testing for resetting statistics to consistent
2880         state. 
2881         
2882         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
2883
2884 2018-09-19  Chris Dumez  <cdumez@apple.com>
2885
2886         Crash under WebPageProxy::decidePolicyForNavigationAction()
2887         https://bugs.webkit.org/show_bug.cgi?id=189763
2888         <rdar://problem/44597111>
2889
2890         Reviewed by Alex Christensen.
2891
2892         Update WebNavigationState::navigation() / WebNavigationState::takeNavigation()
2893         to return a pointer instead of a reference as we have evidence that they can
2894         return null. I kept the debug assertions to try and catch the cases where we
2895         return null but at least we stop crashing in release builds.
2896
2897         * UIProcess/WebNavigationState.cpp:
2898         (WebKit::WebNavigationState::navigation):
2899         (WebKit::WebNavigationState::takeNavigation):
2900         * UIProcess/WebNavigationState.h:
2901         * UIProcess/WebPageProxy.cpp:
2902         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2903         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2904         (WebKit::WebPageProxy::didCommitLoadForFrame):
2905         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2906         (WebKit::WebPageProxy::didFinishLoadForFrame):
2907         (WebKit::WebPageProxy::didFailLoadForFrame):
2908         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2909         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2910         (WebKit::WebPageProxy::decidePolicyForResponse):
2911
2912 2018-09-19  Chris Dumez  <cdumez@apple.com>
2913
2914         Crash under WebProcessProxy::suspendedPageWasDestroyed(WebKit::SuspendedPageProxy&)
2915         https://bugs.webkit.org/show_bug.cgi?id=189721
2916         <rdar://problem/44359788>
2917
2918         Reviewed by Geoffrey Garen.
2919
2920         Fix crash when destroying a SuspendedPageProxy whose WebProcessProxy was already
2921         destroyed.
2922
2923         * UIProcess/SuspendedPageProxy.cpp:
2924         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2925         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2926         * UIProcess/SuspendedPageProxy.h:
2927         (WebKit::SuspendedPageProxy::process const):
2928         Update SuspendedPageProxy::m_process to be a RefPtr<> instead of a raw pointer, similarly
2929         to what we do in WebPageProxy. Relying on the WebProcessProxy to not get destroyed is
2930         risky as this crash demonstrates.
2931
2932         * UIProcess/WebProcessProxy.cpp:
2933         (WebKit::WebProcessProxy::requestTermination):
2934         When a WebProcessProxy is terminated (by client or WebKit due to memory / cpu usage), call
2935         webProcessDidClose() on all SuspendedPages, similarly to what we do in case of a crash in
2936         processDidTerminateOrFailedToLaunch(). Failing to do so means that the SuspendedPageProxy
2937         may still have a pointer to this WebProcessProxy, even though WebProcessProxy::shutDown()
2938         has been called (which may destroy the WebProcessProxy).
2939
2940 2018-09-19  John Wilander  <wilander@apple.com>
2941
2942         Resource Load Statistics: Add optional cap on partitioned cache max age
2943         https://bugs.webkit.org/show_bug.cgi?id=189711
2944         <rdar://problem/39246837>
2945
2946         Reviewed by Antti Koivisto and Chris Dumez.
2947
2948         These changes add the capability to set a max age cap for prevalent resources
2949         and consults it when retrieving cache entries. If an entry is capped and found
2950         to be too old, it will not be used but instead removed from the cache.
2951
2952         This functionality is off by default because no cap is set by default.
2953
2954         * NetworkProcess/NetworkProcess.cpp:
2955         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
2956         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
2957             Infrastructure for testing.
2958         * NetworkProcess/NetworkProcess.h:
2959         * NetworkProcess/NetworkProcess.messages.in:
2960         * NetworkProcess/NetworkResourceLoader.cpp:
2961         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2962             Now sends in the session ID in the retrieve call.
2963         * NetworkProcess/cache/NetworkCache.cpp:
2964         (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap):
2965             Static convenience function.
2966         (WebKit::NetworkCache::makeUseDecision):
2967             Now receives an optional maxAge parameter and checks
2968             hasReachedPrevalentResourceAgeCap() first.
2969         (WebKit::NetworkCache::Cache::retrieve):
2970             Now takes a session ID.
2971         * NetworkProcess/cache/NetworkCache.h:
2972         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
2973         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
2974             Added UseDecision::NoDueToPrevalentResourceAgeCap which causes a
2975             return of WebCore::DiagnosticLoggingKeys::otherKey().
2976         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2977         (WKWebsiteDataStoreSetStatisticsCacheMaxAgeCap):
2978         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2979             Infrastructure for testing.
2980         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2981         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2982         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2983             Now supports a user default ResourceLoadStatisticsCacheMaxAgeCap.
2984         * UIProcess/Network/NetworkProcessProxy.cpp:
2985         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
2986         (WebKit::NetworkProcessProxy::grantStorageAccess):
2987         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
2988         (WebKit::NetworkProcessProxy::getAllStorageAccessEntries):
2989         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
2990         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
2991         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
2992         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources):
2993         (WebKit::nextRequestStorageAccessContextId): Deleted.
2994             Deleted this to make all code use the generic generateCallbackID().
2995         * UIProcess/Network/NetworkProcessProxy.h:
2996         * UIProcess/Network/NetworkProcessProxy.messages.in:
2997             Used to transfer the setting from the UI process to the network process. 
2998         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2999         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
3000         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
3001         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3002         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
3003         * UIProcess/WebResourceLoadStatisticsStore.h:
3004         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3005         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
3006         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
3007         * UIProcess/WebsiteData/WebsiteDataStore.h:
3008
3009 2018-09-18  Brent Fulgham  <bfulgham@apple.com>
3010
3011         [iOS] Allow WebContent process to check the "Protocol Characteristics" of files to which it has access
3012         https://bugs.webkit.org/show_bug.cgi?id=189712
3013         <rdar://problem/44386429>
3014
3015         Reviewed by Alex Christensen.
3016
3017         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3018
3019 2018-09-18  Chris Dumez  <cdumez@apple.com>
3020
3021         [iOS] Crash under WebPageProxy::navigationGestureSnapshotWasRemoved()
3022         https://bugs.webkit.org/show_bug.cgi?id=189714
3023         <rdar://problem/32839498>
3024
3025         Reviewed by Tim Horton.
3026
3027         The ViewGestureController::removeSwipeSnapshot() implementation for iOS calls
3028         navigationGestureSnapshotWasRemoved() on m_webPageProxyForBackForwardListForCurrentSwipe.
3029         m_webPageProxyForBackForwardListForCurrentSwipe can differ from m_webPageProxy, and
3030         is a RefPtr<>. This means that this WebPageProxy's WKWebView might have been deallocated,
3031         in which case we'll crash when trying to use the pageClient in
3032         WebPageProxy::navigationGestureSnapshotWasRemoved(). To address the issue, we now return
3033         early in WebPageProxy::navigationGestureSnapshotWasRemoved() if m_isClosed is true,
3034         after resetting m_isShowingNavigationGestureSnapshot to false but *before* trying to use
3035         the pageClient. When a WKWebView is deallocated, it calls WebPageProxy::close(), which
3036         sets m_isClosed to true.
3037
3038         * UIProcess/WebPageProxy.cpp:
3039         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
3040
3041 2018-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3042
3043         [Curl] Limit capturing extra metrics for Web Inspector when not required.
3044         https://bugs.webkit.org/show_bug.cgi?id=189520
3045
3046         Reviewed by Alex Christensen.
3047
3048         Respect the value of NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() to reduce the process
3049         time when they are not needed.
3050
3051         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3052         (WebKit::NetworkDataTaskCurl::createCurlRequest):
3053
3054 2018-09-18  Alex Christensen  <achristensen@webkit.org>
3055
3056         Make WebPageProxy always have a API::NavigationClient instead of always having a API::LoaderClient and API::PolicyClient
3057         https://bugs.webkit.org/show_bug.cgi?id=189012
3058
3059         Reviewed by Andy Estes.
3060
3061         When WebKit2 was being developed, we initially made the C API WKPageSetPagePolicyClient and WKPageSetPageLoaderClient.
3062         When we released WKWebView, it was using WKNavigationDelegate, equivalent to WKPageSetPageNavigationClient.
3063         To support one or the other, we would use the navigation client if it was present, but if not we would fall back to the
3064         loader or policy client.  Since the loader and policy clients are now being minimally supported only until legacy
3065         software migrates to the navigation client, we are adding new functionality to the navigation client.
3066         Making the navigation client the default and using the loader or policy client only if they are present supports
3067         the legacy software and makes us have fewer forgotten null checks when adding new functionality to the navigation client.
3068
3069         * UIProcess/API/C/WKPage.cpp:
3070         (WKPageSetPageNavigationClient):
3071         * UIProcess/Cocoa/NavigationState.h:
3072         * UIProcess/Cocoa/NavigationState.mm:
3073         (WebKit::NavigationState::createNavigationClient):
3074         * UIProcess/WebPageProxy.cpp:
3075         (WebKit::WebPageProxy::WebPageProxy):
3076         (WebKit::WebPageProxy::setNavigationClient):
3077         (WebKit::WebPageProxy::setLoaderClient):
3078         (WebKit::WebPageProxy::setPolicyClient):
3079         (WebKit::WebPageProxy::close):
3080         (WebKit::WebPageProxy::didChangeBackForwardList):
3081         (WebKit::WebPageProxy::willGoToBackForwardListItem):
3082         (WebKit::WebPageProxy::findPlugin):
3083         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3084         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3085         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3086         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3087         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3088         (WebKit::WebPageProxy::didCommitLoadForFrame):
3089         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3090         (WebKit::WebPageProxy::didFinishLoadForFrame):
3091         (WebKit::WebPageProxy::didFailLoadForFrame):
3092         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3093         (WebKit::WebPageProxy::didReachLayoutMilestone):
3094         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
3095         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
3096         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3097         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3098         (WebKit::WebPageProxy::decidePolicyForResponse):
3099         (WebKit::WebPageProxy::contentRuleListNotification):
3100         (WebKit::WebPageProxy::webGLPolicyForURL):
3101         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
3102         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
3103         (WebKit::WebPageProxy::processDidBecomeResponsive):
3104         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
3105         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
3106         (WebKit::WebPageProxy::wrapCryptoKey):
3107         (WebKit::WebPageProxy::unwrapCryptoKey):
3108         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
3109         (WebKit::WebPageProxy::navigationGestureDidBegin):
3110         (WebKit::WebPageProxy::navigationGestureWillEnd):
3111         (WebKit::WebPageProxy::navigationGestureDidEnd):
3112         (WebKit::WebPageProxy::navigationGestureSnapshotWasRemoved):
3113         * UIProcess/WebPageProxy.h:
3114
3115 2018-09-18  Alex Christensen  <achristensen@webkit.org>
3116
3117         Clean up AuthenticationChallengeProxy
3118         https://bugs.webkit.org/show_bug.cgi?id=189668
3119
3120         Reviewed by Youenn Fablet.
3121
3122         At its core, it's a CompletionHandler with some information.
3123         Make it more elegant and simple with no change in behavior and reduce the complexity of this security-sensitive object.
3124
3125         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3126         (toNSURLSessionAuthChallengeDisposition):
3127         * Shared/Authentication/AuthenticationManager.cpp:
3128         (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge):
3129         * Shared/Authentication/AuthenticationManager.h:
3130         * UIProcess/API/C/WKAuthenticationChallenge.cpp:
3131         (WKAuthenticationChallengeGetDecisionListener):
3132         (WKAuthenticationChallengeGetProtectionSpace):
3133         (WKAuthenticationChallengeGetProposedCredential):
3134         (WKAuthenticationChallengeGetPreviousFailureCount):
3135         * UIProcess/API/C/WKPage.cpp:
3136         (WKPageSetPageNavigationClient):
3137         * UIProcess/API/Cocoa/WKNSURLAuthenticationChallenge.mm:
3138         (-[WKNSURLAuthenticationChallengeSender cancelAuthenticationChallenge:]):
3139         (-[WKNSURLAuthenticationChallengeSender continueWithoutCredentialForAuthenticationChallenge:]):
3140         (-[WKNSURLAuthenticationChallengeSender useCredential:forAuthenticationChallenge:]):
3141         (-[WKNSURLAuthenticationChallengeSender performDefaultHandlingForAuthenticationChallenge:]):
3142         (-[WKNSURLAuthenticationChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]):
3143         * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
3144         (WebKit::AuthenticationChallengeProxy::AuthenticationChallengeProxy):
3145         (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy): Deleted.
3146         (WebKit::AuthenticationChallengeProxy::useCredential): Deleted.
3147         (WebKit::AuthenticationChallengeProxy::cancel): Deleted.
3148         (WebKit::AuthenticationChallengeProxy::performDefaultHandling): Deleted.
3149         (WebKit::AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue): Deleted.
3150         (WebKit::AuthenticationChallengeProxy::proposedCredential const): Deleted.
3151         (WebKit::AuthenticationChallengeProxy::protectionSpace const): Deleted.
3152         (WebKit::AuthenticationChallengeProxy::setSecKeyProxyStore): Deleted.
3153         * UIProcess/Authentication/AuthenticationChallengeProxy.h:
3154         (WebKit::AuthenticationChallengeProxy::create):
3155         (WebKit::AuthenticationChallengeProxy::listener const):
3156         (WebKit::AuthenticationChallengeProxy::previousFailureCount const): Deleted.
3157         * UIProcess/Authentication/AuthenticationDecisionListener.cpp:
3158         (WebKit::AuthenticationDecisionListener::AuthenticationDecisionListener):
3159         (WebKit::AuthenticationDecisionListener::~AuthenticationDecisionListener):
3160         (WebKit::AuthenticationDecisionListener::useCredential):
3161         (WebKit::AuthenticationDecisionListener::cancel):
3162         (WebKit::AuthenticationDecisionListener::performDefaultHandling):
3163         (WebKit::AuthenticationDecisionListener::rejectProtectionSpaceAndContinue):
3164         (WebKit::AuthenticationDecisionListener::detachChallenge): Deleted.
3165         * UIProcess/Authentication/AuthenticationDecisionListener.h:
3166         (WebKit::AuthenticationDecisionListener::create):
3167         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
3168         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
3169         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const): Deleted.
3170         * UIProcess/Cocoa/DownloadClient.mm:
3171         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
3172         * UIProcess/Cocoa/NavigationState.mm:
3173         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
3174         * UIProcess/Downloads/DownloadProxy.cpp:
3175         (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
3176         * UIProcess/Network/NetworkProcessProxy.cpp:
3177         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
3178         * UIProcess/ServiceWorkerProcessProxy.cpp:
3179         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
3180         * UIProcess/WebPageProxy.cpp:
3181         (WebKit::WebPageProxy::secKeyProxyStore):
3182         (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
3183         * UIProcess/WebPageProxy.h:
3184
3185 2018-09-18  Ben Richards  <benton_richards@apple.com>
3186
3187         Add script to generate WebContent service resource files and change XPC service main SPI to have it's own header
3188         https://bugs.webkit.org/show_bug.cgi?id=188601
3189
3190         Reviewed by Dan Bernstein.
3191
3192         Added a script to the process entitlements build phase of the WebContent service that copies resource
3193         files to WebKit.framework/PrivateHeaders/CustomWebContentResources. These resource files are to
3194         be used by clients who would like to make a custom WebContent service.
3195
3196         * Scripts/copy-webcontent-resources-to-private-headers.sh: Added.
3197         * WebKit.xcodeproj/project.pbxproj:
3198         * WebProcess/API/Cocoa/WKWebProcess.h: Drive-by fix to make this header compileable alone.
3199
3200 2018-09-18  Ryan Haddad  <ryanhaddad@apple.com>
3201
3202         Unreviewed, rolling out r236138.
3203
3204         Caused API test and layout test failures on iOS.
3205
3206         Reverted changeset:
3207
3208         "REGRESSION (PSON): White or Black flash occurs when process
3209         swapping on navigation on Mac"
3210         https://bugs.webkit.org/show_bug.cgi?id=189663
3211         https://trac.webkit.org/changeset/236138
3212
3213 2018-09-18  Eric Carlson  <eric.carlson@apple.com>
3214
3215         Always log when granting/revoking capture sandbox extensions
3216         https://bugs.webkit.org/show_bug.cgi?id=189701
3217         <rdar://problem/44564029>
3218
3219         Reviewed by Youenn Fablet.
3220
3221         * UIProcess/UserMediaProcessManager.cpp:
3222         (WebKit::UserMediaProcessManager::willCreateMediaStream): Always log.
3223         (WebKit::UserMediaProcessManager::endedCaptureSession): Ditto.
3224
3225         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3226         (WebKit::UserMediaPermissionRequestManager::grantUserMediaDeviceSandboxExtensions): Ditto.
3227         (WebKit::UserMediaPermissionRequestManager::revokeUserMediaDeviceSandboxExtensions): Ditto.
3228
3229 2018-09-18  Youenn Fablet  <youenn@apple.com>
3230
3231         Enable Unified Plan by default
3232         https://bugs.webkit.org/show_bug.cgi?id=189675
3233
3234         Reviewed by Eric Carlson.
3235
3236         * Shared/WebPreferences.yaml:
3237
3238 2018-09-18  Antti Koivisto  <antti@apple.com>
3239
3240         REGRESSION (PSON): White or Black flash occurs when process swapping on navigation on Mac
3241         https://bugs.webkit.org/show_bug.cgi?id=189663
3242         <rdar://problem/44184955>
3243
3244         Reviewed by Geoff Garen.
3245
3246         We need to keep the layer tree of the previous page alive and visible until we have something
3247         to render on the new page. With PSON on Mac this means that we should keep displaying the
3248         layer tree from the previus process.
3249
3250         This patch moves the management of 'attaching' the drawing area (Mac only concept) from web process
3251         to UI process. This is when we parent the layer tree to the view root layer. It also ensures that
3252         the layer tree is not deleted too early on process swap and that it still eventually gets deleted.
3253
3254         * UIProcess/DrawingAreaProxy.h:
3255         (WebKit::DrawingAreaProxy::attachInWebProcess):
3256         * UIProcess/SuspendedPageProxy.cpp:
3257         (WebKit::messageNamesToIgnoreWhileSuspended):
3258         (WebKit::SuspendedPageProxy::tearDownDrawingAreaInWebProcess):
3259
3260         We no longer tear down drawing area (layer tree) for suspended pages automatically. Send an explicit
3261         message for it.
3262
3263         * UIProcess/SuspendedPageProxy.h:
3264         * UIProcess/WebPageProxy.cpp:
3265         (WebKit::WebPageProxy::reattachToWebProcess):
3266
3267         Only call didRelaunchProcess when process actually relaunched (not navigation process launch) to
3268         match not calling processDidExit in resetStateAfterProcessExited.
3269
3270         (WebKit::WebPageProxy::didCompletePageTransition):
3271
3272         Attach the drawing area if appropriate.
3273
3274         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3275
3276         Send suspend message to WebPage immediately instead waiting for the runloop callback. This is needed so we
3277         can avoid flashing the initial empty document load when the new Page object is created.
3278
3279         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3280
3281         Don't call processDidExit when suspending, not exiting the process (this function needs a new name or rafactoring).
3282         This avoids clearing the drawing area and flashing to black.
3283
3284         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3285
3286         This is called when we have switched to the new layer tree.
3287         Tear down the drawing area in the previus process.
3288
3289         * UIProcess/WebPageProxy.h:
3290         * UIProcess/WebPageProxy.messages.in:
3291         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3292         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3293         (WebKit::TiledCoreAnimationDrawingAreaProxy::attachInWebProcess):
3294
3295         Send a message to the web process to attach the drawing area.
3296
3297         * WebProcess/WebPage/DrawingArea.h:
3298         (WebKit::DrawingArea::attach):
3299         (WebKit::DrawingArea::attachDrawingArea): Deleted.
3300
3301         Rename to be less redundant.
3302
3303         * WebProcess/WebPage/DrawingArea.messages.in:
3304         * WebProcess/WebPage/WebPage.cpp:
3305         (WebKit::WebPage::reinitializeWebPage):
3306
3307         Don't attach drawing area automatically. It will be done by a message from UI process.
3308
3309         (WebKit::WebPage::setLayerTreeStateIsFrozen):
3310
3311         Layer tree is always frozen in a suspended process (if it exists).
3312
3313         (WebKit::WebPage::didStartPageTransition):
3314         (WebKit::WebPage::didCompletePageTransition):
3315
3316         Notify UI process of transition completion.
3317
3318         (WebKit::WebPage::setIsSuspended):
3319         (WebKit::WebPage::tearDownDrawingAreaForSuspend):
3320         * WebProcess/WebPage/WebPage.h:
3321         * WebProcess/WebPage/WebPage.messages.in:
3322         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3323         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3324         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3325
3326         Don't attach drawing area automatically. It will be done by a message from UI process.
3327
3328         (WebKit::TiledCoreAnimationDrawingArea::attach):
3329         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Deleted.
3330
3331 2018-09-18  Claudio Saavedra  <csaavedra@igalia.com>
3332
3333         [WPE] Implement mouse event modifiers
3334         https://bugs.webkit.org/show_bug.cgi?id=189697
3335
3336         Reviewed by Carlos Garcia Campos.
3337
3338         Only "CapsLocks" is missing, as WPE doesn't support that modifier.
3339         * Shared/wpe/WebEventFactory.cpp:
3340         (WebKit::modifiersForEventModifiers):
3341         (WebKit::WebEventFactory::createWebKeyboardEvent):
3342         (WebKit::WebEventFactory::createWebMouseEvent):
3343         (WebKit::modifiersForEvent): Deleted.
3344
3345 2018-09-17  Zan Dobersek  <zdobersek@igalia.com>
3346
3347         Unreviewed build fix after r236101.
3348
3349         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3350         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
3351         Correct a BinarySemaphore::wait() call which now accepts no arguments.
3352
3353 2018-09-17  Yusuke Suzuki  <utatane.tea@gmail.com>
3354
3355         [WTF] Use Semaphore and BinarySemaphore instead of dispatch_semaphore_t
3356         https://bugs.webkit.org/show_bug.cgi?id=185339
3357
3358         Reviewed by Mark Lam.
3359
3360         * Platform/IPC/Connection.cpp:
3361         (IPC::Connection::SyncMessageState::wait):
3362         * Shared/mac/SecItemShim.cpp:
3363         (WebKit::sendSecItemRequest):
3364         Use BinarySemaphore.
3365
3366         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
3367         (WebKit::ResourceLoadStatisticsPersistentStorage::finishAllPendingWorkSynchronously):
3368         * UIProcess/WebStorage/StorageManager.cpp:
3369         (WebKit::StorageManager::applicationWillTerminate):
3370         * UIProcess/ios/WKActionSheetAssistant.mm:
3371         (appLinkForURL):
3372         Use BinarySemaphore to wait for async completion handler. We also fix memory leak
3373         since the old code does not call dispatch_release for the used semaphore.
3374
3375 2018-09-17  Simon Fraser  <simon.fraser@apple.com>
3376
3377         Many modern media control tests leak documents in testing
3378         https://bugs.webkit.org/show_bug.cgi?id=189437
3379
3380         Reviewed by Darin Adler.
3381
3382         In order to accurately detect leaks in media controls tests which use lots of
3383         SVGImages, we have to:
3384         - Fire a zero-delay timer after the postTask, in order for ImagesLoader's m_derefElementTimer
3385           to clear references to elements.
3386         - Have releaseCriticalMemory() call CachedResourceLoader's garbageCollectDocumentResources()
3387           to drop the last handle to the CachedResource for an SVGImage.
3388         - Call WKBundleReleaseMemory() after the GC and timer, since we need garbageCollectDocumentResources()
3389           to run again after that timer has fired.
3390         
3391         This should fix most of the spurious leak reports involving SVGImage documents.
3392
3393         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3394         (WKBundlePageCallAfterTasksAndTimers):
3395         (WKBundlePagePostTask): Deleted.
3396         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
3397
3398 2018-09-17  Dan Bernstein  <mitz@apple.com>
3399
3400         Try to fix Apple internal builds with the iOS 12.0 SDK.
3401
3402         * Configurations/WebKit.xcconfig: Disable framework header postprocessing for iOS 12.0.
3403
3404 2018-09-17  Ryan Haddad  <ryanhaddad@apple.com>
3405
3406         Unreviewed, rolling out r236092 because it breaks internal builds. Also,  remove stray '+' character from ChangeLog file.
3407
3408         * Scripts/copy-webcontent-resources-to-private-headers.sh: Removed.
3409         * WebKit.xcodeproj/project.pbxproj:
3410