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