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