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