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