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