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