Web Inspector: REGRESSION(r238378): reloading WebInspector after a settings change...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-11-28  Joseph Pecoraro  <pecoraro@apple.com>
2
3         Web Inspector: REGRESSION(r238378): reloading WebInspector after a settings change doesn't re-show WebInspector
4         https://bugs.webkit.org/show_bug.cgi?id=191971
5
6         Reviewed by Matt Baker.
7
8         * WebProcess/WebPage/WebInspector.cpp:
9         (WebKit::WebInspector::reopen): Deleted.
10         * WebProcess/WebPage/WebInspector.h:
11         * WebProcess/WebPage/WebInspector.messages.in:
12         Move reopen out of the WebProcess...
13
14         * UIProcess/WebInspectorProxy.cpp:
15         (WebKit::WebInspectorProxy::reopen):
16         * UIProcess/WebInspectorProxy.h:
17         * UIProcess/WebInspectorProxy.messages.in:
18         And into the UIProcess where the order of messages won't
19         be as problematic.
20
21         * WebProcess/WebPage/WebInspectorUI.cpp:
22         (WebKit::WebInspectorUI::reopen):
23         Send a message to the WebInspectorProxy instead.
24
25 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
26
27         Remove another OS version check from NetworkDataTaskCocoa.mm
28         https://bugs.webkit.org/show_bug.cgi?id=192046
29
30         Reviewed by Alex Christensen.
31
32         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
33         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
34
35 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
36
37         Modernize version checks for same site cookie support
38         https://bugs.webkit.org/show_bug.cgi?id=192054
39
40         Reviewed by Tim Horton.
41
42         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
43         Also removed runtime checks, which are no longer relevant.
44
45 2018-11-27  Mark Lam  <mark.lam@apple.com>
46
47         ENABLE_FAST_JIT_PERMISSIONS should be false for iosmac.
48         https://bugs.webkit.org/show_bug.cgi?id=192055
49         <rdar://problem/46288783>
50
51         Reviewed by Saam Barati.
52
53         * Configurations/FeatureDefines.xcconfig:
54
55 2018-11-27  Alex Christensen  <achristensen@webkit.org>
56
57         Make synchronous IPC introduced in r237267 asynchronous
58         https://bugs.webkit.org/show_bug.cgi?id=190757
59
60         Reviewed by Chris Dumez.
61
62         * UIProcess/API/Cocoa/WKProcessPool.mm:
63         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:completionHandler:]):
64         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:]): Deleted.
65         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
66         * UIProcess/WebProcessPool.cpp:
67         (WebKit::WebProcessPool::activePagesOriginsInWebProcessForTesting):
68         * UIProcess/WebProcessPool.h:
69         * UIProcess/WebProcessProxy.cpp:
70         (WebKit::WebProcessProxy::activePagesDomainsForTesting):
71         * UIProcess/WebProcessProxy.h:
72         * WebProcess/WebProcess.cpp:
73         (WebKit::WebProcess::getActivePagesOriginsForTesting):
74         * WebProcess/WebProcess.messages.in:
75         * WebProcess/cocoa/WebProcessCocoa.mm:
76         (WebKit::WebProcess::getActivePagesOriginsForTesting):
77
78 2018-11-27  Alex Christensen  <achristensen@webkit.org>
79
80         Safe browsing warning text needs to be visible on High Sierra
81         https://bugs.webkit.org/show_bug.cgi?id=192022
82
83         Reviewed by Tim Horton.
84
85         Something about AppKit, autolayout, view insertion order, and NSTextView makes the text lay
86         out with initial size of {0, 0} on High Sierra. Using an NSTextField instead makes the details visible.
87
88         Covered by an API test.
89
90         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
91         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
92         (makeLabel):
93         (-[WKSafeBrowsingWarning addContent]):
94         (-[WKSafeBrowsingWarning showDetailsClicked]):
95         (-[WKSafeBrowsingWarning layoutText]):
96         (makeTitleLabel): Deleted.
97
98 2018-11-27  Tim Horton  <timothy_horton@apple.com>
99
100         WKNavigation.AutomaticViewReloadAfterWebProcessCrash asserts after r238538
101         https://bugs.webkit.org/show_bug.cgi?id=192038
102         <rdar://problem/46288457>
103
104         Reviewed by Wenson Hsieh.
105
106         * UIProcess/WebPageProxy.cpp:
107         (WebKit::m_resetRecentCrashCountTimer):
108         (WebKit::WebPageProxy::finishAttachingToWebProcess):
109         (WebKit::WebPageProxy::resetState):
110         (WebKit::m_editableImageController): Deleted.
111         Properly invalidate m_editableImageController when resetting WebPageProxy.
112         Otherwise, the MessageReceiverMaps get invalidated, then later when
113         EditableImageController goes away we assert trying to remove the receiver.
114
115 2018-11-27  Jiewen Tan  <jiewen_tan@apple.com>
116
117         (r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html is Crashing
118         https://bugs.webkit.org/show_bug.cgi?id=191757
119
120         Reviewed by Chris Dumez.
121
122         Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
123         behavior for mock testing. However, the main thread could time out when MockHidConnection::send
124         is excuting the block on another thread. The block will then return without invoking the callback,
125         which triggers this WTFCrash. The solution is always invoking the callback before return in the
126         block.
127
128         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
129         (WebKit::MockHidConnection::send):
130
131 2018-11-27  Keith Rollin  <krollin@apple.com>
132
133         Better parsing of comments in generate-message*.py
134         https://bugs.webkit.org/show_bug.cgi?id=191866
135         <rdar://problem/46189563>
136
137         Reviewed by Chris Dumez.
138
139         The script parsing the *.messages.in files would treat a line starting
140         with '#' as a comment, but not a line starting with '<whitespace>#'.
141         This means that jamming a '#' right in front of the first character of
142         a message definition (as opposed to the beginning of a line) will have
143         no effect and the line will get treated just the same as a
144         non-commented line. Fix this by trimming all white space from the
145         beginning and ending of the line before processing it.
146
147         * Scripts/webkit/parser.py:
148         (parse):
149         * Scripts/webkit/test-messages.in:
150
151 2018-11-27  Thibault Saunier  <tsaunier@igalia.com>
152
153         [GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var
154         https://bugs.webkit.org/show_bug.cgi?id=192024
155
156         Reviewed by Michael Catanzaro.
157
158         * UIProcess/API/glib/WebKitSettings.cpp:
159         (webKitSettingsConstructed):
160
161 2018-11-27  Alexey Proskuryakov  <ap@apple.com>
162
163         Modernize the check for async _saveCookies existence
164         https://bugs.webkit.org/show_bug.cgi?id=191987
165
166         Reviewed by Dean Jackson.
167
168         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
169         (WebKit::NetworkProcess::platformSyncAllCookies):
170
171 2018-11-27  Tim Horton  <timothy_horton@apple.com>
172
173         Serialize and deserialize editable image strokes
174         https://bugs.webkit.org/show_bug.cgi?id=192002
175         <rdar://problem/30900149>
176
177         Reviewed by Dean Jackson.
178
179         * UIProcess/API/APIAttachment.cpp:
180         (API::Attachment::updateAttributes):
181         * UIProcess/WebPageProxy.cpp:
182         (WebKit::WebPageProxy::willUpdateAttachmentAttributes):
183         * UIProcess/WebPageProxy.h:
184         When an attachment would update its DOM attributes, plumb a notification
185         to EditableImageController, and allow it to block the update (because
186         we don't really want to set src for editable image attachments,
187         we just want the UI process to fully own the data).
188
189         * Platform/spi/ios/PencilKitSPI.h:
190         Add some SPI.
191
192         * UIProcess/ios/EditableImageController.h:
193         * UIProcess/ios/EditableImageController.mm:
194         (WebKit::EditableImageController::loadStrokesFromAttachment):
195         Add a helper to load strokes from an attachment.
196
197         (WebKit::EditableImageController::associateWithAttachment):
198         Try to load strokes from the attachment when initially associated.
199         Don't create a file wrapper around a null image, so it will be regenerated later.
200
201         (WebKit::EditableImageController::willUpdateAttachmentAttributes):
202         The aforementioned plumbing at update time.
203
204         * UIProcess/ios/WKDrawingView.h:
205         * UIProcess/ios/WKDrawingView.mm:
206         (-[WKDrawingView layoutSubviews]):
207         Invalidate the attachment (so it will be regenerated upon request) if the
208         canvas size changes.
209
210         (-[WKDrawingView PNGRepresentation]):
211         Serialize strokes into the EXIF User Comment field.
212         We will find a different field to use (ideally a custom vendor-specific
213         field that nobody else will use for anything), but this works for now.
214
215         Don't try to render an image if we don't have a size or scale;
216         PKImageRenderer will just fail anyway, so bail early.
217
218         In the iOS Simulator, PKImageRenderer currently returns an unusable image.
219         Instead, so that we have a image on which to serialize the strokes,
220         create a transparent 1x1 image. This makes it possible to serialize strokes
221         even though we don't have a usable rendered image, so that we can still test
222         this change (and future changes).
223
224         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
225         If available, deserialize strokes from the EXIF User Comment field.
226
227         (-[WKDrawingView drawingDidChange:]):
228         (-[WKDrawingView invalidateAttachment]):
229         Factor invalidateAttachment out of drawingDidChange so we can call
230         it from layoutSubviews too!
231
232 2018-11-27  Chris Dumez  <cdumez@apple.com>
233
234         Regression(PSON) crash under WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame()
235         https://bugs.webkit.org/show_bug.cgi?id=191983
236         <rdar://problem/46246863>
237
238         Reviewed by Geoffrey Garen.
239
240         * UIProcess/WebPageProxy.cpp:
241         (WebKit::WebPageProxy::continueNavigationInNewProcess):
242         Make sure the navigation still exists in m_mainFrameCreationHandler and return early if it
243         does not.
244
245         (WebKit::WebPageProxy::resetState):
246         Clear out m_mainFrameCreationHandler / m_mainFrameWindowCreationHandler if we resetting the state
247         after a crash. At this point, there is no chance the WebProcess will send us the IPC that will
248         cause these to get called and we do not want old state to remain for future navigations.
249
250 2018-11-16  Jiewen Tan  <jiewen_tan@apple.com>
251
252         Disallow loading webarchives as iframes
253         https://bugs.webkit.org/show_bug.cgi?id=191728
254         <rdar://problem/45524528>
255
256         Reviewed by Youenn Fablet.
257
258         * UIProcess/WebPageProxy.cpp:
259         (WebKit::WebPageProxy::unableToImplementPolicy):
260         Add a check to prevent null pointer dereference.
261
262 2018-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
263
264         WebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515
265         https://bugs.webkit.org/show_bug.cgi?id=191996
266
267         Reviewed by Tim Horton.
268
269         This assertion is hit because `decode(Decoder& decoder, NSArray<Class> *allowedClasses)` expects the decoded
270         object (of class `_NSArrayM`) to be equal to `NSArray.class`.
271
272         We fix the crash by relaxing the debug assertion when decoding securely-codable objects over IPC. Instead of
273         checking that the class of the decoded object is equal to one of the allowed classes, check that the object is a
274         kind of any of the allowed classes.
275
276         * Shared/Cocoa/ArgumentCodersCocoa.h:
277         (IPC::isObjectClassAllowed):
278         (IPC::decode):
279
280 2018-11-27  Tomas Popela  <tpopela@redhat.com>
281
282         [GTK][WPE] Remove temporary workaround in Source/WebKit/Platform*.cmake
283         https://bugs.webkit.org/show_bug.cgi?id=192008
284
285         Reviewed by Michael Catanzaro.
286
287         Looks like it's not needed anymore as the code compiles fine without
288         it.
289
290         * PlatformGTK.cmake:
291         * PlatformWPE.cmake:
292
293 2018-11-27  Antti Koivisto  <antti@apple.com>
294
295         Factor mask layer applying in RemoteLayerTreePropertyApplier into a shared function
296         https://bugs.webkit.org/show_bug.cgi?id=192001
297
298         Reviewed by Tim Horton.
299
300         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
301         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
302         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
303         (WebKit::RemoteLayerTreePropertyApplier::updateMask):
304
305         Shared function, with some special tricks for iOS backdrop layers.
306
307         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
308
309 2018-11-27  Antti Koivisto  <antti@apple.com>
310
311         Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
312         https://bugs.webkit.org/show_bug.cgi?id=192003
313
314         Reviewed by Tim Horton.
315
316         We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
317         to add anything except an extra hash lookup.
318
319         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
320         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
321         (WebKit::RemoteLayerTreeHost::updateLayerTree):
322
323         Pass m_nodes directly.
324         Some random cleanups.
325
326 2018-11-27  Antti Koivisto  <antti@apple.com>
327
328         Remote tile layers shouldn't be UIViews
329         https://bugs.webkit.org/show_bug.cgi?id=191953
330
331         Reviewed by Tim Horton.
332
333         They don't need any UIView functionality, nor do they ever have UIView descendants.
334         We can use lighter weight objects.
335
336         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
337         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
338         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
339         (WebKit::RemoteLayerTreePropertyApplier::updateChildren):
340
341         Factor to a function shared between platforms.
342         Support having both views and plain layers in the same tree.
343         Assert that all siblings are of the same type and that we don't attempt to add views to layers.
344
345         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
346         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
347         (WebKit::RemoteLayerTreeHost::makeNode):
348
349         Use new plain layer on Mac too.
350
351         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
352         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
353         (-[WKPlainRemoteLayer description]):
354
355         Add a CALayer subclass so we can have a description, similar to WKCompositingView and pals.
356
357         (WebKit::RemoteLayerTreeNode::createWithPlainLayer):
358         (WebKit::RemoteLayerTreeNode::detachFromParent):
359
360         Support having null view.
361
362         (WebKit::RemoteLayerTreeNode::appendLayerDescription):
363
364         Helper for layer descriptions.
365
366         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
367         (WebKit::RemoteLayerTreeHost::makeNode):
368
369         Construct plain layers for tiles.
370
371         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
372         (-[WKCompositingView description]):
373         (-[WKUIRemoteView description]):
374         (-[WKBackdropView description]):
375
376 2018-11-27  Fujii Hironori  <Hironori.Fujii@sony.com>
377
378         Remove "using namespace WebCore" under Source/WebKit/WebProcess/InjectedBundle/API
379         https://bugs.webkit.org/show_bug.cgi?id=191995
380
381         Reviewed by Alex Christensen.
382
383         The statement "using namespace WebCore" should be placed inside
384         namespace WebKit for unified source builds. But, source files
385         defining WebKit API can't be enclosed by namespace WebKit { }
386         becuase they are defined in the global scope.
387
388         "using namespace WebCore" in global scope and unified source
389         builds may cause build breaks (Bug 191853).
390
391         Remove "using namespace WebCore" in the global scope. Use
392         "WebCore::" prefix instead.
393
394         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
395         (WKBundleClearAllDatabases):
396         (WKBundleSetDatabaseQuota):
397         (WKBundleClearResourceLoadStatistics):
398         (WKBundleResourceLoadStatisticsNotifyObserver):
399         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
400         (WKBundleFrameGetFrameLoadState):
401         (WKBundleFrameClearOpener):
402         (WKBundleFrameCallShouldCloseOnWebView):
403         (WKBundleFrameCopySecurityOrigin):
404         (WKBundleFrameFocus):
405         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
406         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
407
408 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
409
410         [Cocoa] No way for clients to tell whether the content view is in the responder chain when the web view is
411         https://bugs.webkit.org/show_bug.cgi?id=169212
412         <rdar://problem/30899656>
413
414         Reviewed by Tim Horton.
415
416         Add an SPI hook to allow internal WKWebView clients to determine whether the WKWebView's content view is the
417         first responder. Intended for use by clients, such as Mail, that embed native text input views and other views
418         that may become first responder within the view hierarchy of the WKWebView.
419
420         * UIProcess/API/Cocoa/WKWebView.mm:
421         (-[WKWebView _contentViewIsFirstResponder]):
422         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
423
424 2018-11-26  Tim Horton  <timothy_horton@apple.com>
425
426         Insert <attachment> elements under editable images to make their backing data accessible
427         https://bugs.webkit.org/show_bug.cgi?id=191844
428         <rdar://problem/30900149>
429
430         Reviewed by Simon Fraser.
431
432         * DerivedSources.make:
433         * SourcesCocoa.txt:
434         * UIProcess/API/APIAttachment.h:
435         fileWrapper() is no longer a trivial getter; it can now construct
436         the file wrapper from a file wrapper generator if necessary.
437
438         Add setFileWrapperGenerator() and invalidateGeneratedFileWrapper().
439
440         Make m_fileWrapper mutable so it can be adjusted inside its own getter.
441
442         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
443         (API::Attachment::fileWrapper const):
444         If we have a fileWrapperGenerator and don't have a cached file wrapper,
445         create one before returning it.
446
447         (API::Attachment::invalidateGeneratedFileWrapper):
448         Invalidate the currently-cached file wrapper. The next time a client
449         requests the file wrapper it will be regenerated.
450
451         (API::Attachment::fileName const):
452         (API::Attachment::fileSizeForDisplay const):
453         (API::Attachment::enclosingImageData const):
454         (API::Attachment::isEmpty const):
455         (API::Attachment::createSerializedRepresentation const):
456         Make use of fileWrapper() instead of m_fileWrapper directly, to ensure
457         that it is created lazily if necessary.
458
459         (API::Attachment::setFileWrapperGenerator):
460         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
461         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
462         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
463         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
464         (-[WKEmbeddedView initWithEmbeddedViewID:]):
465         Defer to EditableImageController for creating WKDrawingViews for
466         editable images. This is done primarily so we don't have to pollute
467         Remote Layer Tree and DrawingArea interfaces with editable-image-specific messages.
468
469         * UIProcess/WebPageProxy.cpp:
470         (WebKit::m_editableImageController):
471         (WebKit::m_resetRecentCrashCountTimer): Deleted.
472         * UIProcess/WebPageProxy.h:
473         (WebKit::WebPageProxy::editableImageController):
474         Keep an EditableImageController on the WebPageProxy.
475
476         * UIProcess/ios/EditableImageController.h: Added.
477         * UIProcess/ios/EditableImageController.messages.in: Added.
478         * UIProcess/ios/EditableImageController.mm: Added.
479         (WebKit::EditableImageController::EditableImageController):
480         (WebKit::EditableImageController::~EditableImageController):
481         (WebKit::EditableImageController::ensureEditableImage):
482         (WebKit::EditableImageController::editableImage):
483         (WebKit::EditableImageController::didCreateEditableImage):
484         (WebKit::EditableImageController::didDestroyEditableImage):
485         (WebKit::EditableImageController::associateWithAttachment):
486         (WebKit::EditableImageController::invalidateAttachmentForEditableImage):
487         Add EditableImageController, which keeps track of EditableImages.
488         It can be messaged directly to create or destroy the UI-side state
489         of an editable image, and also to associate a WKDrawingView with
490         a particular attachment.
491
492         * UIProcess/ios/WKDrawingView.h:
493         * UIProcess/ios/WKDrawingView.mm:
494         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
495         Store the WebPageProxy (weakly) so that we can get to the EditableImageController.
496
497         (-[WKDrawingView layoutSubviews]):
498         (-[WKDrawingView PNGRepresentation]):
499         Synchronously render the PKCanvasView to PNG.
500
501         (-[WKDrawingView drawingDidChange:]):
502         If the drawing changes, inform the APIAttachment that it needs
503         to discard its NSFileWrapper; a new one will be generated lazily.
504
505         (-[WKDrawingView init]): Deleted.
506         * WebKit.xcodeproj/project.pbxproj:
507         * WebProcess/WebCoreSupport/WebChromeClient.h:
508         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
509         (WebKit::WebChromeClient::associateEditableImageWithAttachment):
510         (WebKit::WebChromeClient::didCreateEditableImage):
511         (WebKit::WebChromeClient::didDestroyEditableImage):
512
513 2018-11-26  Jer Noble  <jer.noble@apple.com>
514
515         Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
516         https://bugs.webkit.org/show_bug.cgi?id=190951
517         <rdar://problem/45213065>
518
519         Reviewed by Alex Christensen.
520
521         Add an asyncronous reply request to VideoFullscreenManager.
522
523         * Platform/IPC/MessageSender.h:
524         (IPC::MessageSender::sendWithAsyncReply):
525         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
526         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
527         (WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
528         * WebProcess/cocoa/VideoFullscreenManager.h:
529         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
530         * WebProcess/cocoa/VideoFullscreenManager.mm:
531         (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID):
532
533 2018-11-26  Alex Christensen  <achristensen@webkit.org>
534
535         Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
536         https://bugs.webkit.org/show_bug.cgi?id=191981
537
538         Reviewed by Tim Horton.
539
540         * UIProcess/API/Cocoa/WKWebView.mm:
541         (-[WKWebView _safeBrowsingWarning]):
542         (-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
543         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
544
545 2018-11-26  Daniel Bates  <dabates@apple.com>
546
547         REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
548         https://bugs.webkit.org/show_bug.cgi?id=191967
549         <rdar://problem/45976390>
550
551         Reviewed by Tim Horton.
552
553         Fixes an issue where pressing Command + Down Arrow does not scroll the view to the end of the page.
554
555         Following r237738 the value of the enumerations used to identify modifier keys (e.g. Shift) changed
556         to match the values of the corresponding enumerations in GraphicsServices, which are the
557         enumerations UIKit uses to computes the modifier flags bitmask when instantiating a WebEvent to
558         pass to WebKit. Before r237738 WebKit was using enumerations whose values matched the values
559         of the corresponding UIKit public API UIKeyModifier* enumerations. For non-content editable elements,
560         WebKit intercepts UIKit events in -_handleKeyUIEvent, synthesizes and dispatches its own WebEvent.
561         However it was creating WebEvents with a modifier flags bitmask built from the UIKeyModifier* enumerations,
562         -_modifierFlags, as opposed to a bitmask from the GraphicsServices enumerations, -_gsModifierFlags.
563         Instead WebKit should call -_gsModifierFlags to compute the GraphicsServices-compatible modifier
564         flags bitmask when instantiating a WebEvent.
565
566         * Platform/spi/ios/UIKitSPI.h: Expose -_gsModifierFlags and remove -_modifierFlags.
567         * UIProcess/ios/WKContentViewInteraction.mm:
568         (-[WKContentView _handleKeyUIEvent:]): Remove unnecessary code to update the current modifier state.
569         This will be done by the WebProcess when it receives the keyboard event.
570         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Do not pass modifier flags changed events
571         to the scrolling animator as it does not know how to handle these kinds of events and triggers an
572         assertion failure when it tries to read the input string from the event (calls -charactersIgnoringModifiers).
573         FlagsChanged WebEvents events do not have an input string just like a FlagsChanged NSEvent that
574         they model on Mac.
575         * UIProcess/ios/WKWebEvent.mm:
576         (-[WKWebEvent initWithEvent:]): Pass the value of -_gsModifierFlags for the modifier flags bitmask
577         instead of the value of -_modifierFlags.
578
579 2018-11-26  Chris Dumez  <cdumez@apple.com>
580
581         [PSON] process pre-warming should not be on for everyone
582         https://bugs.webkit.org/show_bug.cgi?id=191966
583         <rdar://problem/46138499>
584
585         Reviewed by Ryosuke Niwa.
586
587         If automatic process-prewarming is not explicitly turned on/off by the client, then we now only
588         turn it on automatically after the first process swap. Previously, it was always enabled if
589         process-swap on cross-site navigation was enabled (which is the case by default for all apps).
590
591         This is important because some apps do not actually browse (only display static content) or never
592         browse cross-site, and thus would not benefit from process prewarming and yet pay a memory cost.
593
594         * UIProcess/API/APIProcessPoolConfiguration.h:
595         Add m_clientWouldBenefitFromAutomaticProcessPrewarming flag which is false by default and is used
596         as a fallback if the client did not call setIsAutomaticProcessWarmingEnabled().
597
598         * UIProcess/API/C/WKContextConfigurationRef.cpp:
599         (WKContextConfigurationPrewarmsProcessesAutomatically):
600         (WKContextConfigurationSetPrewarmsProcessesAutomatically):
601         Add C API to toggle automatic process prewarming. It is needed for Safari to turn on this feature
602         by default for browsing. This way Safari does not have to wait for the first process swap to
603         start prewarming.
604
605         * UIProcess/API/C/WKContextConfigurationRef.h:
606         * UIProcess/WebProcessPool.cpp:
607         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
608         Only do automatic process prewarming if process-swap on cross-site navigation is also enabled.
609         This is needed for clients like Safari that explicitly enable automatic process prewarming but
610         only want to have it enabled if PSON is also enabled via experimental features.
611
612         (WebKit::WebProcessPool::processForNavigation):
613         On first process swap, if the client did not explicitly turn on or off automatic process prewarming
614         then we enable it then. This avoids paying the cost of process prewarming in apps that would not
615         benefit from it.
616
617 2018-11-26  Andy Estes  <aestes@apple.com>
618
619         [Cocoa] Make it easier to encode NSObjects
620         https://bugs.webkit.org/show_bug.cgi?id=191948
621
622         Reviewed by Dean Jackson.
623
624         It should be easier to encode objects that conform to NSSecureCoding for WebKit IPC. Right
625         now, several argument coders duplicate the logic for encoding and decoding objects using
626         NSKeyedArchiver and NSKeyedUnarchiver.
627
628         This patch adds encodeObject() and decodeObject() primitives for encoding and decoding using
629         Foundation keyed archiving. It then partially specializes ArgumentCoder for raw pointers and
630         RetainPtrs whose pointee conforms to NSSecureCoding to call these new primitives.
631
632         This allows us to use Encoder::operator<< to encode raw pointers or RetainPtrs and use
633         Decoder::operator>> to decode to an optional RetainPtr. By default, IPC::decode infers the
634         allowed class for decoding by calling `[T class]`. We can also specify the allowed classes
635         explicitly for containers and classes that are loaded at runtime.
636
637         * Shared/Cocoa/ArgumentCodersCocoa.h: Added.
638         * Shared/Cocoa/ArgumentCodersCocoa.mm: Added.
639         * Shared/Cocoa/DataDetectionResult.mm:
640         (WebKit::DataDetectionResult::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
641         (WebKit::DataDetectionResult::decode): Ditto.
642         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
643         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
644         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
645         (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Ditto.
646         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
647         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
648         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
649         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
650         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
651         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
652         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): Ditto.
653         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
654         (WebKit::RemoteLayerTreeTransaction::description const): Added some needed namespaces due to unified source shuffling.
655         * Shared/WebCoreArgumentCoders.h: Modernized several decoders.
656         * Shared/ios/InteractionInformationAtPosition.mm:
657         (WebKit::InteractionInformationAtPosition::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
658         (WebKit::InteractionInformationAtPosition::decode): Ditto.
659         * Shared/mac/WebCoreArgumentCodersMac.mm:
660         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::encodePlatformData): Ditto.
661         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::decodePlatformData): Ditto.
662         (IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData): Ditto.
663         (IPC::ArgumentCoder<WebCore::Credential>::decodePlatformData): Ditto.
664         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Ditto.
665         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Ditto.
666         (IPC::deviceContextKey): Deleted.
667         * Shared/mac/WebHitTestResultData.mm:
668         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
669         (WebKit::WebHitTestResultData::platformDecode): Ditto.
670         * SourcesCocoa.txt: Added ArgumentCodersCocoa.mm.
671         * WebKit.xcodeproj/project.pbxproj: Ditto.
672
673 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
674
675         CompletionHandler-based async IPC messages only work when the completion handler takes a single argument
676         https://bugs.webkit.org/show_bug.cgi?id=191965
677
678         Reviewed by Tim Horton.
679
680         Teach `messages.py` to handle the case where an async IPC completion handler takes no arguments, or takes more
681         than a single argument. Currently, the generated code attempts to wrap all arguments in a `WTFMove(*~)`, but
682         this either results in `WTFMove(*)` in the case where there are no arguments, or `WTFMove(*foo, *bar, *baz)` in
683         the case where there are several arguments. Both of these results fail to compile.
684
685         Instead, emit `completionHandler()` when there are no arguments, and
686         `completionHandler(WTFMove(*foo), WTFMove(*bar), WTFMove(*baz))` when there are multiple arguments.
687
688         Tests:  TestAsyncMessageWithNoArguments
689                 TestAsyncMessageWithMultipleArguments
690
691         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
692         (Messages::WebPage::TestAsyncMessageWithNoArguments::callReply):
693         (Messages::WebPage::TestAsyncMessageWithNoArguments::cancelReply):
694         (Messages::WebPage::TestAsyncMessageWithNoArguments::send):
695         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply):
696         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply):
697         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::send):
698         (WebKit::WebPage::didReceiveMessage):
699         * Scripts/webkit/MessagesSuperclass-expected.h:
700         (Messages::WebPage::TestAsyncMessageWithNoArguments::receiverName):
701         (Messages::WebPage::TestAsyncMessageWithNoArguments::name):
702         (Messages::WebPage::TestAsyncMessageWithNoArguments::asyncMessageReplyName):
703         (Messages::WebPage::TestAsyncMessageWithNoArguments::arguments const):
704         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::receiverName):
705         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::name):
706         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName):
707         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::arguments const):
708         * Scripts/webkit/messages.py:
709         * Scripts/webkit/messages_unittest.py:
710
711         Add new `messages.py` unit tests to cover these cases.
712
713         * Scripts/webkit/test-superclass-messages.in:
714
715 2018-11-26  Jeremy Jones  <jeremyj@apple.com>
716
717         Use Full Screen consistently in localizable strings.
718         https://bugs.webkit.org/show_bug.cgi?id=190363
719         rdar://problem/43882333
720
721         Reviewed by Jon Lee.
722
723         Rename "Fullscreen" to "Full Screen" in localizable strings for consistency.
724
725         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
726         (-[WKFullScreenViewController _showPhishingAlert]):
727
728 2018-11-26  Daniel Bates  <dabates@apple.com>
729
730         Wire up ChromeClient::takeFocus() on iOS
731         https://bugs.webkit.org/show_bug.cgi?id=191763
732         <rdar://problem/18584508>
733
734         Reviewed by Dan Bernstein.
735
736         Expose existing Mac SPI for use on iOS. This will allow Safari to be notified when
737         the engine has cycled through all the tab focusable elements on the page.
738
739         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
740         * UIProcess/Cocoa/UIDelegate.h:
741         * UIProcess/Cocoa/UIDelegate.mm:
742         (WebKit::UIDelegate::setDelegate):
743
744 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
745
746         Unreviewed, fix the internal 32-bit macOS 10.13 build after r238471
747
748         r238471 added an `#include WebPageMessages.h` in `WebPage.h`, which causes the 32-bit macOS build using an
749         internal macOS SDK ≤ 10.13 to fail. To address this, move the `#include` back under `PLATFORM(IOS_FAMILY)` by
750         changing the parameters of `WebPage::removeDataDetectedLinks` and `WebPage::detectDataInAllFrames` to completion
751         handlers rather than async IPC replies.
752
753         * WebProcess/WebPage/WebPage.cpp:
754         (WebKit::WebPage::removeDataDetectedLinks):
755         (WebKit::WebPage::detectDataInAllFrames):
756         * WebProcess/WebPage/WebPage.h:
757
758 2018-11-26  Antti Koivisto  <antti@apple.com>
759
760         Clean up layer tree freezing logic in WebPage
761         https://bugs.webkit.org/show_bug.cgi?id=191826
762
763         Reviewed by Dean Jackson.
764
765         Use OptionSet<LayerTreeFreezeReason> to track various reasons that can cause layer tree to get frozen.
766
767         * WebProcess/WebPage/WebPage.cpp:
768         (WebKit::WebPage::reinitializeWebPage):
769         (WebKit::WebPage::freezeLayerTree):
770         (WebKit::WebPage::unfreezeLayerTree):
771         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
772
773         Layer tree is unfrozen when there there are no reasons to freeze it.
774
775         (WebKit::WebPage::didStartPageTransition):
776         (WebKit::WebPage::didCompletePageTransition):
777         (WebKit::WebPage::beginPrinting):
778         (WebKit::WebPage::endPrinting):
779         (WebKit::WebPage::setIsSuspended):
780         (WebKit::WebPage::setLayerTreeStateIsFrozen): Deleted.
781         * WebProcess/WebPage/WebPage.h:
782         * WebProcess/WebPage/ios/WebPageIOS.mm:
783         (WebKit::WebPage::applicationDidEnterBackground):
784         (WebKit::WebPage::applicationWillEnterForeground):
785         * WebProcess/WebProcess.cpp:
786         (WebKit::WebProcess::actualPrepareToSuspend):
787         (WebKit::WebProcess::cancelPrepareToSuspend):
788         (WebKit::WebProcess::freezeAllLayerTrees):
789         (WebKit::WebProcess::unfreezeAllLayerTrees):
790         (WebKit::WebProcess::processDidResume):
791         (WebKit::WebProcess::setAllLayerTreeStatesFrozen): Deleted.
792         * WebProcess/WebProcess.h:
793
794 2018-11-25  Antti Koivisto  <antti@apple.com>
795
796         RemoteLayerTreeNode construction cleanups
797         https://bugs.webkit.org/show_bug.cgi?id=191951
798
799         Reviewed by Tim Horton.
800
801         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
802         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
803         (WebKit::RemoteLayerTreeHost::updateLayerTree):
804
805             Drop unused LayerProperties argument.
806
807         (WebKit::RemoteLayerTreeHost::createLayer):
808
809             Split the actual construction out to makeNode.
810             Map updating is shared between platforms.
811             Move setting of layerID and clearing default actions to RemoteLayerTreeNode.
812
813         (WebKit::RemoteLayerTreeHost::makeNode):
814
815             Returns RemoteLayerTreeNode.
816
817         (WebKit::RemoteLayerTreeHost::setLayerID): Deleted.
818         (WebKit::RemoteLayerTreeHost::layerID): Deleted.
819
820             Move to RemoteLayerTreeNode.
821
822         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
823         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
824         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
825         (WebKit::RemoteLayerTreeNode::setLayerID):
826         (WebKit::RemoteLayerTreeNode::layerID):
827         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
828         (WebKit::RemoteLayerTreeHost::makeNode):
829         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
830         (WebKit::RemoteLayerTreeHost::createLayer): Deleted.
831         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
832         (-[WKCompositingView description]):
833         (-[WKUIRemoteView description]):
834         (-[WKBackdropView description]):
835         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
836         (WebKit::addAnimationToLayer):
837
838 2018-11-25  Tim Horton  <timothy_horton@apple.com>
839
840         Make it possible to insert editable images with a gesture
841         https://bugs.webkit.org/show_bug.cgi?id=191937
842
843         Reviewed by Wenson Hsieh.
844
845         * UIProcess/API/Cocoa/WKWebView.mm:
846         (-[WKWebView _stylusTapGestureShouldCreateEditableImage]):
847         * UIProcess/API/Cocoa/WKWebViewInternal.h:
848         Add a internal getter for a WKWebViewConfiguration property.
849
850         * UIProcess/WebEditCommandProxy.cpp:
851         (WebKit::WebEditCommandProxy::nameForEditAction):
852         Add a undo name.
853
854         * UIProcess/WebPageProxy.h:
855         * UIProcess/ios/WKContentViewInteraction.h:
856         * UIProcess/ios/WKContentViewInteraction.mm:
857         (-[WKContentView setupInteraction]):
858         (-[WKContentView cleanupInteraction]):
859         (-[WKContentView _removeDefaultGestureRecognizers]):
860         (-[WKContentView _addDefaultGestureRecognizers]):
861         Add a single-stylus-tap gesture recognizer.
862
863         (-[WKContentView _stylusSingleTapRecognized:]):
864         If allowed, request to insert an editable image when a stylus tap occurs.
865
866         * UIProcess/ios/WebPageProxyIOS.mm:
867         (WebKit::WebPageProxy::handleStylusSingleTapAtPoint):
868         * WebProcess/WebPage/WebPage.h:
869         * WebProcess/WebPage/WebPage.messages.in:
870         * WebProcess/WebPage/ios/WebPageIOS.mm:
871         (WebKit::WebPage::handleStylusSingleTapAtPoint):
872         Do a hit test, select the hit position, insert an editable image, and
873         then de-assist any assisted node (to make the keyboard go away).
874         For now, we'll only insert if we hit non-replaced elements,
875         though this heuristic will need to be enhanced significantly once we
876         decide on a design.
877
878 2018-11-25  Tim Horton  <timothy_horton@apple.com>
879
880         Scrolling and drawing compete for incoming gestures
881         https://bugs.webkit.org/show_bug.cgi?id=191940
882
883         Reviewed by Wenson Hsieh.
884
885         * Platform/spi/ios/PencilKitSPI.h:
886         * UIProcess/API/Cocoa/WKWebView.mm:
887         (-[WKWebView _initializeWithConfiguration:]):
888         * UIProcess/ios/WKDrawingView.mm:
889         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
890         Make scrolling and drawing mutually exclusive if editable images
891         are enabled.
892
893 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
894
895         [Cocoa] Fix a few localizable string descriptions in WebEditCommandProxy.cpp and WebEditorClient.mm
896         https://bugs.webkit.org/show_bug.cgi?id=191945
897
898         Reviewed by Anders Carlsson.
899
900         Replace some a couple of command undo action name descriptions with "Undo action name", to match all other
901         edit commands.
902
903         * UIProcess/WebEditCommandProxy.cpp:
904         (WebKit::WebEditCommandProxy::nameForEditAction):
905
906 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
907
908         [Cocoa] Add WKWebView SPI to trigger and remove data detection
909         https://bugs.webkit.org/show_bug.cgi?id=191918
910         <rdar://problem/36185051>
911
912         Reviewed by Tim Horton.
913
914         Adds support for two new WKWebView SPI methods, `-_detectDataWithTypes:completionHandler:` and
915         `-_removeAllDataDetectedLinks:`, to allow internal WebKit clients to run data detection and add links to data
916         detected content, or remove all data detected links from the document.
917
918         Test: WebKit.AddAndRemoveDataDetectors
919
920         * Shared/Cocoa/DataDetectionResult.h:
921         * Shared/Cocoa/DataDetectionResult.mm:
922         (WebKit::DataDetectionResult::decode):
923
924         Modernize DataDetectionResult's IPC decoding, so that it can be used with reply-based async IPC.
925
926         * UIProcess/API/Cocoa/WKWebView.mm:
927         (-[WKWebView _removeDataDetectedLinks:]):
928         (-[WKWebView _detectDataWithTypes:completionHandler:]):
929         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
930         * UIProcess/WebPageProxy.cpp:
931         (WebKit::WebPageProxy::detectDataInAllFrames):
932         (WebKit::WebPageProxy::removeDataDetectedLinks):
933
934         Add or remove data detected links from each frame in the page, and then propagate the new data detector
935         results of the main frame to the UI process (this matches current behavior, where the results of -[WKWebView
936         _dataDetectionResults] only reflects data detection results in the main frame of the page).
937
938         * UIProcess/WebPageProxy.h:
939         * WebProcess/WebPage/WebPage.cpp:
940         (WebKit::WebPage::removeDataDetectedLinks):
941         (WebKit::WebPage::detectDataInAllFrames):
942         * WebProcess/WebPage/WebPage.h:
943         * WebProcess/WebPage/WebPage.messages.in:
944
945 2018-11-24  Andy Estes  <aestes@apple.com>
946
947         [Cocoa] SOFT_LINK_CLASS_FOR_{HEADER,SOURCE} should generate a more concise getter function
948         https://bugs.webkit.org/show_bug.cgi?id=191899
949
950         Reviewed by Dean Jackson.
951
952         * Shared/cocoa/WebCoreArgumentCodersCocoa.mm:
953         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
954         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
955
956 2018-11-23  Antti Koivisto  <antti@apple.com>
957
958         Replace LayerOrView typedef with a class
959         https://bugs.webkit.org/show_bug.cgi?id=191927
960
961         Reviewed by Tim Horton.
962
963         This typedef restricts remote layer representation to be either a CA layer or a view. We might want
964         have more flexibility, for example tiles don't really need to be UIViews. It will also make it easier
965         to unify Mac and iOS code, and hopefully make it less confusing too.
966
967         This patch introduces RemoteLayerTreeNode class that replaces most uses of LayerOrView typedef
968         (the rest are converted to pure CALayer). It also does a bunch of related cleanup.
969
970         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
971         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
972         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
973         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
974         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
975         (WebKit::applyPropertiesToLayer): Deleted.
976         * SourcesCocoa.txt:
977         * UIProcess/API/Cocoa/WKWebView.mm:
978         (-[WKWebView _propertiesOfLayerWithID:]):
979         * UIProcess/Cocoa/LayerRepresentation.h: Removed.
980         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
981         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
982         * UIProcess/PageClient.h:
983         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
984         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
985         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
986         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
987         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
988         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
989         (WebKit::RemoteLayerTreeHost::rootNode const):
990         (WebKit::RemoteLayerTreeHost::rootLayer const): Deleted.
991         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
992         (WebKit::RemoteLayerTreeHost::updateLayerTree):
993         (WebKit::RemoteLayerTreeHost::nodeForID const):
994         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
995         (WebKit::RemoteLayerTreeHost::animationDidStart):
996         (WebKit::RemoteLayerTreeHost::animationDidEnd):
997         (WebKit::RemoteLayerTreeHost::clearLayers):
998         (WebKit::RemoteLayerTreeHost::layerWithIDForTesting const):
999         (WebKit::RemoteLayerTreeHost::layerForID const):
1000         (WebKit::RemoteLayerTreeHost::rootLayer const):
1001         (WebKit::RemoteLayerTreeHost::createLayer):
1002         (WebKit::RemoteLayerTreeHost::detachRootLayer):
1003         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
1004         (WebKit::RemoteLayerTreeHost::getLayer const): Deleted.
1005         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h: Added.
1006         (WebKit::RemoteLayerTreeNode::layer const):
1007         (WebKit::RemoteLayerTreeNode::uiView const):
1008         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm: Added.
1009         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
1010         (WebKit::RemoteLayerTreeNode::detachFromParent):
1011         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
1012         (WebKit::RemoteLayerTreeScrollingPerformanceData::blankPixelCount const):
1013         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1014         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1015         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1016         (WebKit::RemoteLayerTreeHost::createLayer):
1017         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1018         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1019         (WebKit::layerRepresentationFromLayerOrView): Deleted.
1020         * UIProcess/WebAuthentication/Cocoa/HidService.h:
1021         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
1022         * UIProcess/WebPageProxy.h:
1023         * UIProcess/ios/LayerRepresentation.mm: Removed.
1024         * UIProcess/ios/PageClientImplIOS.h:
1025         * UIProcess/ios/PageClientImplIOS.mm:
1026         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1027         (WebKit::PageClientImpl::acceleratedCompositingRootLayer const):
1028         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1029         * UIProcess/ios/WebPageProxyIOS.mm:
1030         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1031         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1032         * UIProcess/mac/PageClientImplMac.h:
1033         * UIProcess/mac/PageClientImplMac.mm:
1034         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1035         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1036         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1037         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1038         * UIProcess/mac/WebPageProxyMac.mm:
1039         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1040         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
1041         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1042         * WebKit.xcodeproj/project.pbxproj:
1043         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1044         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1045
1046 2018-11-23  Jiewen Tan  <jiewen_tan@apple.com>
1047
1048         [WebAuthN] Enable Web Authentication as an experimental feature for macOS
1049         https://bugs.webkit.org/show_bug.cgi?id=191932
1050         rdar://problem/46225210
1051
1052         Reviewed by Brent Fulgham.
1053
1054         * Shared/WebPreferences.yaml:
1055
1056 2018-11-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1057
1058         Enable drag and drop support for iOSMac
1059         https://bugs.webkit.org/show_bug.cgi?id=191818
1060         <rdar://problem/43907454>
1061
1062         Reviewed by Dean Jackson.
1063
1064         * Configurations/FeatureDefines.xcconfig:
1065         * Shared/WebPreferencesDefaultValues.cpp:
1066         (defaultCustomPasteboardDataEnabled):
1067
1068         Enable custom pasteboard data by default on iOSMac. While writing and reading custom pasteboard data is
1069         currently broken in iOSMac due to the lack of `teamData` and `preferredPresentationStyle`, opting into custom
1070         pasteboard data at least allows us to avoid writing unsanitized data types to the pasteboard.
1071
1072         * WebProcess/WebPage/ios/WebPageIOS.mm:
1073         (WebKit::WebPage::platformEditorState const):
1074
1075         Fix a regression from <https://trac.webkit.org/r236619> wherein the web process crashes when attempting to edit
1076         a text field. This happens because the call to `-[UIKeyboard isInHardwareKeyboardMode]` on the iOSMac platform
1077         attempts to initialize a `UHASWorkspace` from the web process, which then attempts to connect to the UIKit host
1078         application. Instead, we can skip this call altogether on iOSMac, where the platform never considers a hardware
1079         keyboard to be "connected", even when typing.
1080
1081 2018-11-23  Antti Koivisto  <antti@apple.com>
1082
1083         UI side compositing doesn't paint on Mac
1084         https://bugs.webkit.org/show_bug.cgi?id=191908
1085
1086         Reviewed by Tim Horton.
1087
1088         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1089         (WebKit::RemoteLayerBackingStore::bytesPerPixel const):
1090         (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const):
1091
1092         These deep color formats are not supported on Mac.
1093
1094 2018-11-22  Chris Dumez  <cdumez@apple.com>
1095
1096         Regression(r238353) Load sometimes hangs when navigating back after a cross-site navigation
1097         https://bugs.webkit.org/show_bug.cgi?id=191914
1098
1099         Reviewed by Ryosuke Niwa.
1100
1101         When process-swapping on a cross-site server-side redirect, we end up doing a decidePolicyForNavigationResponse
1102         policy check for the about:blank suspension load. This policy decision is ignored by the UIProcess because
1103         SuspendedPageProxy does not handle this particular IPC message. To handle the issue, make sure the WebProcess
1104         never sends a DecidePolicyForNavigationResponse IPC to the UIProcess for about:blank suspension loads and let
1105         the load proceed.
1106
1107         The issue was already there before r238353 but it was made obvious by r238353 which caused a hang when trying
1108         to reuse a Suspended page which is hanging while trying to suspend.
1109
1110         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1111         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1112
1113 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1114
1115         [Cocoa] clang emits a warning when building WebKit after r238293
1116         https://bugs.webkit.org/show_bug.cgi?id=191917
1117
1118         Reviewed by Dan Bernstein.
1119
1120         Move the implementations of -setSafeBrowsingEnabled: and -isSafeBrowsingEnabled to the main implementation of
1121         WKPreferences to fix the warning.
1122
1123         * UIProcess/API/Cocoa/WKPreferences.mm:
1124         (-[WKPreferences setSafeBrowsingEnabled:]):
1125         (-[WKPreferences isSafeBrowsingEnabled]):
1126
1127 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1128
1129         Address post-review feedback after r238438
1130         https://bugs.webkit.org/show_bug.cgi?id=191913
1131
1132         Reviewed by Ryosuke Niwa.
1133
1134         Replace boolean arguments to setSelectedRange, replaceSelectionWithText and replaceSelectionWithFragment with
1135         enum flags, and tweak a couple of functions to take `const Vector&` instead of `Vector&&`.
1136
1137         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1138         (WKBundlePageReplaceStringMatches):
1139         * WebProcess/WebPage/FindController.cpp:
1140         (WebKit::FindController::replaceMatches):
1141         * WebProcess/WebPage/FindController.h:
1142         * WebProcess/WebPage/WebPage.cpp:
1143         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1144         (WebKit::WebPage::replaceMatches):
1145         (WebKit::WebPage::replaceSelectionWithText):
1146         * WebProcess/WebPage/WebPage.h:
1147         * WebProcess/WebPage/ios/WebPageIOS.mm:
1148         (WebKit::WebPage::selectWithGesture):
1149         (WebKit::WebPage::updateSelectionWithTouches):
1150         (WebKit::WebPage::selectWithTwoTouches):
1151         (WebKit::WebPage::extendSelection):
1152         (WebKit::WebPage::selectWordBackward):
1153         (WebKit::WebPage::moveSelectionByOffset):
1154         (WebKit::WebPage::selectPositionAtPoint):
1155         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1156         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1157         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1158         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1159         (WebKit::WebPage::updateSelectionWithExtentPoint):
1160         (WebKit::WebPage::replaceSelectedText):
1161         (WebKit::WebPage::replaceDictatedText):
1162         (WebKit::WebPage::syncApplyAutocorrection):
1163
1164 2018-11-22  Mark Lam  <mark.lam@apple.com>
1165
1166         Rollout r238432: Breaks internal Mac builds.
1167         https://bugs.webkit.org/show_bug.cgi?id=191909
1168         <rdar://problem/46214163>
1169
1170         Unreviewed. Rolling out r238432: Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1171
1172         * Sources.txt:
1173         * WebKit.xcodeproj/project.pbxproj:
1174
1175 2018-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1176
1177         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.1 release.
1178
1179         * gtk/NEWS: Add release notes for 2.23.1.
1180
1181 2018-11-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1182
1183         [Cocoa] [WebKit2] Add support for replacing find-in-page text matches
1184         https://bugs.webkit.org/show_bug.cgi?id=191786
1185         <rdar://problem/45813871>
1186
1187         Reviewed by Ryosuke Niwa.
1188
1189         * UIProcess/API/Cocoa/WKWebView.mm:
1190         (-[WKWebView replaceMatches:withString:inSelectionOnly:resultCollector:]):
1191         * UIProcess/WebPageProxy.cpp:
1192         (WebKit::WebPageProxy::replaceMatches):
1193         * UIProcess/WebPageProxy.h:
1194         * UIProcess/mac/WKTextFinderClient.mm:
1195         (-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]):
1196
1197         Implement this method to opt in to "Replace…" UI on macOS in the find bar. In this API, we're given a list of
1198         matches to replace. We propagate the indices of each match to the web process, where FindController maps them to
1199         corresponding replacement ranges. Currently, the given list of matches is only ever a list containing the first
1200         match, or a list containing all matches.
1201
1202         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1203         (WKBundlePageFindStringMatches):
1204         (WKBundlePageReplaceStringMatches):
1205         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1206         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1207         * WebProcess/WebPage/FindController.cpp:
1208         (WebKit::FindController::replaceMatches):
1209
1210         Map match indices to Ranges, and then call into WebCore::Page to do the heavy lifting (see WebCore ChangeLog for
1211         more details). Additionally add a hard find-and-replace limit here to prevent the web process from spinning
1212         indefinitely if there are an enormous number of find matches.
1213
1214         * WebProcess/WebPage/FindController.h:
1215         * WebProcess/WebPage/WebPage.cpp:
1216         (WebKit::WebPage::findStringMatchesFromInjectedBundle):
1217         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1218
1219         Add helpers to exercise find and replace in WebKit2.
1220
1221         (WebKit::WebPage::replaceMatches):
1222         * WebProcess/WebPage/WebPage.h:
1223         * WebProcess/WebPage/WebPage.messages.in:
1224
1225 2018-11-21  Andy Estes  <aestes@apple.com>
1226
1227         [Cocoa] Create a soft-linking file for PassKit
1228         https://bugs.webkit.org/show_bug.cgi?id=191875
1229         <rdar://problem/46203215>
1230
1231         Reviewed by Myles Maxfield.
1232
1233         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1234         * SourcesCocoa.txt: Removed @no-unify from WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm.
1235         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1236         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Ditto.
1237         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Ditto.
1238         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Included NSAttributedStringSPI.h.
1239         * UIProcess/mac/WebProcessProxyMac.mm: Included ProcessPrivilege.h.
1240         * WebKit.xcodeproj/project.pbxproj: Removed WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm from the WebKit target.
1241
1242 2018-11-21  Fujii Hironori  <Hironori.Fujii@sony.com>
1243
1244         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1245         https://bugs.webkit.org/show_bug.cgi?id=191853
1246
1247         Reviewed by Michael Catanzaro.
1248
1249         In r235845, I excluded InjectedBundleRangeHandle.cpp and
1250         InjectedBundleNodeHandle.cpp from unify source builds in order to
1251         work around a MSVC bug.
1252
1253         Then, I commited a different workaround for the MSVC bug in
1254         r238386. Now, we can include InjectedBundleRangeHandle.cpp and
1255         InjectedBundleNodeHandle.cpp in unified source builds. Revert
1256         r235845.
1257
1258         * Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
1259         and InjectedBundleNodeHandle.cpp
1260         * WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
1261         not to be compiled by XCode.
1262
1263 2018-11-20  Jeff Miller  <jeffm@apple.com>
1264
1265         Return nullptr immediately if the key doesn't exist in the HashMap.
1266         https://bugs.webkit.org/show_bug.cgi?id=191841
1267
1268         Reviewed by Chris Dumez.
1269
1270         * Shared/API/APIDictionary.h:
1271
1272 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1273
1274         WebPasteboard should USE(LIBWPE)
1275         https://bugs.webkit.org/show_bug.cgi?id=191846
1276
1277         Reviewed by Michael Catanzaro.
1278
1279         Add USE(LIBWPE) for Pasteboard related functionality within WebKit.
1280
1281         * UIProcess/WebPasteboardProxy.h:
1282         * UIProcess/WebPasteboardProxy.messages.in:
1283         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1284         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1285
1286 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1287
1288         [WPE] Fix some feature guards in WebKit
1289         https://bugs.webkit.org/show_bug.cgi?id=191847
1290
1291         Reviewed by Michael Catanzaro.
1292
1293         Some feature guards are not present in these files.
1294
1295         * UIProcess/API/wpe/PageClientImpl.cpp:
1296         * UIProcess/API/wpe/PageClientImpl.h:
1297         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1298         (WebKit::WebProcessPool::platformInitializeWebProcess):
1299
1300 2018-11-20  Antti Koivisto  <antti@apple.com>
1301
1302         Avoid potential longer than expected layer flush delays
1303         https://bugs.webkit.org/show_bug.cgi?id=191833
1304
1305         Reviewed by Dean Jackson.
1306
1307         Layer flush throttling also stops style recalcs and layouts. Layouts schedule layer flushes. Especially
1308         on a slow network we can in principle end up in situation where layer flush timer fires but there is no
1309         flush scheduled and so nothing happens. However there is a pending style recalc or layout that would
1310         actually schedule a flush (in practice various things force style recalcs and this doesn't occur
1311         commonly).
1312
1313         To avoid this we should flush unconditionally when the flush timer fires. This performs any pending
1314         style recalc and layout too. If there is nothing to do the flush will be cheap.
1315
1316         PLT doesn't appear to hit cases affected by this patch and there shouldn't be any impact.
1317
1318         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1319
1320         Remove now unnecessary m_hasPendingFlush bit, simplifying the logic.
1321
1322         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1323         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
1324
1325         Schedule unconditionally when unfreezing.
1326
1327         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
1328
1329         Remove branch that starts the flush timer. It is not needed as either it was already running
1330         or immediate flush is already scheduled and will start the timer anyway.
1331
1332         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1333         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
1334         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
1335
1336         Flush unconditionally.
1337
1338 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1339
1340         Simplify platform check in WebEditorClient
1341         https://bugs.webkit.org/show_bug.cgi?id=191848
1342
1343         Reviewed by Fujii Hironori.
1344
1345         !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WPE) can be better
1346         represented as PLATFORM(WIN).
1347
1348         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1349
1350 2018-11-19  Alex Christensen  <achristensen@webkit.org>
1351
1352         Add SPI to disable JIT in a WKWebView
1353         https://bugs.webkit.org/show_bug.cgi?id=191822
1354         <rdar://problem/28119360>
1355
1356         Reviewed by Geoffrey Garen.
1357
1358         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1359         (WebKit::XPCServiceInitializer):
1360         * UIProcess/API/APIProcessPoolConfiguration.h:
1361         * UIProcess/API/Cocoa/WKWebView.mm:
1362         (-[WKWebView _canUseJIT:]):
1363         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1364         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1365         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1366         (-[_WKProcessPoolConfiguration enableJIT]):
1367         (-[_WKProcessPoolConfiguration setEnableJIT:]):
1368         * UIProcess/Launcher/ProcessLauncher.h:
1369         (WebKit::ProcessLauncher::Client::enableJIT const):
1370         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1371         (WebKit::ProcessLauncher::launchProcess):
1372         * UIProcess/WebPageProxy.cpp:
1373         (WebKit::WebPageProxy::canUseJIT):
1374         * UIProcess/WebPageProxy.h:
1375         * UIProcess/WebProcessProxy.cpp:
1376         (WebKit::WebProcessProxy::enableJIT const):
1377         * UIProcess/WebProcessProxy.h:
1378         (WebKit::WebProcessProxy::processPool const):
1379         (WebKit::WebProcessProxy::processPool): Deleted.
1380         * WebProcess/WebProcess.cpp:
1381         (WebKit::WebProcess::canUseJIT):
1382         * WebProcess/WebProcess.h:
1383         * WebProcess/WebProcess.messages.in:
1384
1385 2018-11-19  Basuke Suzuki  <basuke.suzuki@sony.com>
1386
1387         [Curl] Add API for CertificateInfo.
1388         https://bugs.webkit.org/show_bug.cgi?id=191647
1389
1390         Reviewed by Alex Christensen.
1391
1392         Added API for CertificateInfo to create, fetch contents.
1393
1394         Tests: TestWebKitAPI/Tests/WebKit/curl/Certificates.cpp
1395
1396         * PlatformWin.cmake:
1397         * Shared/API/c/curl/WKCertificateInfoCurl.cpp: Added.
1398         (WKCertificateInfoCreateWithCertficateChain):
1399         (WKCertificateInfoGetVerificationError):
1400         (WKCertificateInfoGetCertificateChainSize):
1401         (WKCertificateInfoCopyCertificateAtIndex):
1402         * Shared/API/c/curl/WKCertificateInfoCurl.h: Copied from Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp.
1403         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1404         (IPC::ArgumentCoder<CertificateInfo>::encode):
1405         (IPC::ArgumentCoder<CertificateInfo>::decode):
1406
1407 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1408
1409         Add USE(LIBWPE) for WebKit events
1410         https://bugs.webkit.org/show_bug.cgi?id=191842
1411
1412         Reviewed by Michael Catanzaro.
1413
1414         Moves all WPE events to USE(LIBWPE) instead of PLATFORM(WPE). Updates
1415         filenames to LibWPE.
1416
1417         * PlatformWPE.cmake:
1418         * Shared/NativeWebKeyboardEvent.h:
1419         * Shared/NativeWebMouseEvent.h:
1420         * Shared/NativeWebTouchEvent.h:
1421         * Shared/NativeWebWheelEvent.h:
1422         * Shared/WebCoreArgumentCoders.cpp:
1423         * Shared/WebCoreArgumentCoders.h:
1424         * Shared/WebEvent.h:
1425         * Shared/WebKeyboardEvent.cpp:
1426         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1427         * Shared/libwpe/NativeWebKeyboardEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp.
1428         * Shared/libwpe/NativeWebMouseEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebMouseEventWPE.cpp.
1429         * Shared/libwpe/NativeWebTouchEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebTouchEventWPE.cpp.
1430         * Shared/libwpe/NativeWebWheelEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebWheelEventWPE.cpp.
1431         * Shared/libwpe/WebEventFactory.cpp: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.cpp.
1432         * Shared/libwpe/WebEventFactory.h: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.h.
1433         * SourcesWPE.txt:
1434
1435 2018-11-19  David Quesada  <david_quesada@apple.com>
1436
1437         EXC_BAD_ACCESS when invoking a DownloadProxy's destination decision handler after the download has been canceled
1438         https://bugs.webkit.org/show_bug.cgi?id=191762
1439         rdar://problem/46151509
1440
1441         Reviewed by Dean Jackson.
1442
1443         When the DownloadClient calls the decision handler with a destination path, check if
1444         m_processPool is null before trying to access its network process. This can happen
1445         if a download is canceled before the client decides its destination.
1446
1447         * UIProcess/Downloads/DownloadProxy.cpp:
1448         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
1449
1450 2018-11-19  Tomoki Imai  <Tomoki.Imai@sony.com>
1451
1452         [cairo] BackingStore::incorporateUpdate should use CompositeCopy to support drawsBackground=false in general Cairo ports
1453         https://bugs.webkit.org/show_bug.cgi?id=191577
1454
1455         Reviewed by Carlos Garcia Campos.
1456
1457         We should use CompositeCopy operator to update bitmap to overwrite existing bitmap even if source contains
1458         transparent parts. It enables ports which uses Cairo to set drawsBackground to false.
1459         GTK ports has custom background extension, and in such case, we need to use CompositeSourceOver to retain
1460         custom background.
1461
1462         * UIProcess/cairo/BackingStoreCairo.cpp:
1463         (WebKit::BackingStore::incorporateUpdate): Use CompositeCopy operator to update bitmap.
1464
1465 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1466
1467         Web Inspector: "Reload Web Inspector" button no longer partially works
1468         https://bugs.webkit.org/show_bug.cgi?id=191773
1469         <rdar://problem/46139932>
1470
1471         Reviewed by Devin Rousso.
1472
1473         * UIProcess/RemoteWebInspectorProxy.cpp:
1474         (WebKit::RemoteWebInspectorProxy::load):
1475         (WebKit::RemoteWebInspectorProxy::reopen):
1476         * UIProcess/RemoteWebInspectorProxy.h:
1477         * UIProcess/RemoteWebInspectorProxy.messages.in:
1478         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1479         (WebKit::RemoteWebInspectorUI::reopen):
1480         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1481         * WebProcess/WebPage/WebInspector.cpp:
1482         (WebKit::WebInspector::reopen):
1483         * WebProcess/WebPage/WebInspector.h:
1484         * WebProcess/WebPage/WebInspector.messages.in:
1485         * WebProcess/WebPage/WebInspectorUI.cpp:
1486         (WebKit::WebInspectorUI::reopen):
1487         * WebProcess/WebPage/WebInspectorUI.h:
1488
1489 2018-11-19  Alejandro G. Castro  <alex@igalia.com>
1490
1491         [GTK][WPE] Solve some issues in the enumerateDevices code
1492         https://bugs.webkit.org/show_bug.cgi?id=191832
1493
1494         Reviewed by Carlos Garcia Campos.
1495
1496         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp:
1497         Increase the version to 2.24.
1498         (webkitDeviceInfoPermissionRequestAllow):
1499         (webkitDeviceInfoPermissionRequestDeny):
1500         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
1501         Replace the forward declaration with the include.
1502         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Typo.
1503         * UIProcess/API/gtk/WebKitWebsiteData.h:
1504         Increase the version to 2.24.
1505         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Typo.
1506         * UIProcess/API/wpe/WebKitWebsiteData.h:
1507         Increase the version to 2.24.
1508
1509 2018-11-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1510
1511         Unreviewed. Fix GTK+ build after r238318.
1512
1513         Add new symbols to API documentation files. They should have been added in r237031, but r238318 revealed it.
1514
1515         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1516         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1517         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1518
1519 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1520
1521         Regression(r238330): A lot of WebInspector tests are crashing on the bots
1522         https://bugs.webkit.org/show_bug.cgi?id=191814
1523
1524         Reviewed by Ryosuke Niwa.
1525
1526         Expose the expected connection type from the UIProcess into the WebProcess.
1527         When there is a local inspector connection to the UIProcess expose it as
1528         a local frontend channel to the inspector controllers in the Page.
1529
1530         * UIProcess/WebPageInspectorTargetAgent.h:
1531         * UIProcess/WebPageInspectorTargetAgent.cpp:
1532         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
1533         An additional FrontendChannel class is not needed, just use self.
1534
1535         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
1536         (WebKit::WebPageInspectorTargetAgent::connectionType const):
1537         (WebKit::WebPageInspectorTargetAgent::sendMessageToFrontend):
1538         Expose the channel to targets as local if there is a local frontend
1539         in the UIProcess.
1540
1541 2018-11-18  Joseph Pecoraro  <pecoraro@apple.com>
1542
1543         Regression(r238330) ProcessSwap.WebInspector API test is a flaky crash in debug
1544         https://bugs.webkit.org/show_bug.cgi?id=191812
1545
1546         Reviewed by Chris Dumez.
1547
1548         * WebProcess/WebPage/WebInspector.cpp:
1549         (WebKit::WebInspector::setFrontendConnection):
1550         It can be possible to receive a frontend connection multiple times
1551         if another WebProcess opened the inspector and this WebProcess got
1552         swapped in before the InspectorProcess notified the WebProcess of
1553         a connection to use. It is always best to use the latest connection
1554         we have received, since any others would have been invalidated.
1555
1556 2018-11-18  Chris Dumez  <cdumez@apple.com>
1557
1558         [PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
1559         https://bugs.webkit.org/show_bug.cgi?id=191828
1560
1561         Reviewed by Antti Koivisto.
1562
1563         WebPageProxy::didPerformClientRedirect() had a MESSAGE_CHECK_URL() for both the source
1564         and the destination URL. The macro calls WebProcessProxy::checkURLReceivedFromWebProcess()
1565         to make sure that both URLs were actually loaded by this WebContent process.
1566
1567         However, now that we're enabled process-swap on cross-site navigation, these checks are no
1568         longer fully valid. If the client-side redirect is cross-site, then the source and destination
1569         URLs get loaded by 2 different WebContent processes. Since didPerformClientRedirect() gets
1570         called after the redirect and gets set by the new WebContent process, only the destination URL
1571         is guaranteed to have been loaded by this process. The source URL may have been loaded in
1572         another process so this patch drops the message check for the source URL.
1573
1574         * UIProcess/WebPageProxy.cpp:
1575         (WebKit::WebPageProxy::didPerformClientRedirect):
1576
1577 2018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1578
1579         Use Box<BinarySemaphore> instead of dispatch_semaphore_t
1580         https://bugs.webkit.org/show_bug.cgi?id=189691
1581
1582         Reviewed by Ryosuke Niwa.
1583
1584         Use Box<BinarySemaphore> instead, which utilizes our WTF::Lock mechanism.
1585
1586         * NetworkProcess/watchos/NetworkProximityManager.mm:
1587         (WebKit::NetworkProximityManager::updateRecommendation):
1588
1589 2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1590
1591         [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
1592         https://bugs.webkit.org/show_bug.cgi?id=191819
1593
1594         Reviewed by Dan Bernstein.
1595
1596         Replace UIItemProvider (and related classes) with NSItemProvider.
1597
1598         * Platform/spi/ios/UIKitSPI.h:
1599         * UIProcess/ios/WKContentViewInteraction.mm:
1600         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
1601         (-[WKContentView dropInteraction:performDrop:]):
1602
1603 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
1604
1605         Unreviewed WinCairo build fix for r238353.
1606
1607         * UIProcess/WebPageProxy.cpp:
1608         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1609
1610 2018-11-17  Chris Dumez  <cdumez@apple.com>
1611
1612         ASSERTION FAILED: m_messageReceivers.contains(...) under ViewGestureController removeMessageReceiver
1613         https://bugs.webkit.org/show_bug.cgi?id=191734
1614         <rdar://problem/46151497>
1615
1616         Reviewed by Ryosuke Niwa.
1617
1618         When a WebProcess crashes, we destroy the ViewGestureController and reconstruct it later
1619         after we've relaunched a new WebProcess. The ViewGestureController controller takes care
1620         of adding itself as an IPC message receiver to the WebProcessProxy, and the destructor
1621         takes care of removing itself as an IPC message receiver.
1622
1623         However, when process-swapping on navigation, we do not destroy the ViewGestureController
1624         because doing so would take down the swipe gesture snapshot on cross-site swipe navigation.
1625         This led to hitting this assertion later on because the ViewGestureController is still
1626         registered as an IPC message receiver with the old process after process swapping.
1627
1628         To address the issue, we now make sure the ViewGestureController unregisters itself from
1629         the old process and registers itself with the new process on process-swap.
1630
1631         * UIProcess/Cocoa/ViewGestureController.cpp:
1632         (WebKit::ViewGestureController::ViewGestureController):
1633         (WebKit::ViewGestureController::~ViewGestureController):
1634         (WebKit::ViewGestureController::disconnectFromProcess):
1635         (WebKit::ViewGestureController::connectToProcess):
1636         * UIProcess/Cocoa/ViewGestureController.h:
1637         * UIProcess/Cocoa/WebViewImpl.mm:
1638         (WebKit::WebViewImpl::processWillSwap):
1639         (WebKit::WebViewImpl::didRelaunchProcess):
1640
1641 2018-11-17  Chris Dumez  <cdumez@apple.com>
1642
1643         [PSON] ASSERTION FAILED: m_uncommittedState.state == State::Committed
1644         https://bugs.webkit.org/show_bug.cgi?id=191781
1645
1646         Reviewed by Ryosuke Niwa.
1647
1648         The crash was happening when switching to a suspended page that is not yet done
1649         suspending (e.g. in case of very fast back/forward navigation). The WebPageProxy
1650         would reattach to the suspended process and get load notifications that it did
1651         not expect since it did not schedule any load yet. Those notifications are for
1652         the about:blank load we do for page suspension.
1653
1654         To address the issue, make swapToWebProcess() asynchronous and take a completion
1655         handler. When we try to unsuspend a SuspendedPageProxy, we first make sure it
1656         is actually done suspending. If it is not done suspending, we wait until it is
1657         before telling in to unsuspend and proceeding with the new load.
1658
1659         * UIProcess/SuspendedPageProxy.cpp:
1660         (WebKit::SuspendedPageProxy::unsuspend):
1661         (WebKit::SuspendedPageProxy::didFinishLoad):
1662         * UIProcess/SuspendedPageProxy.h:
1663         * UIProcess/WebPageProxy.cpp:
1664         (WebKit::WebPageProxy::swapToWebProcess):
1665         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1666         * UIProcess/WebPageProxy.h:
1667
1668 2018-11-17  Chris Dumez  <cdumez@apple.com>
1669
1670         Unreviewed follow-up to r238343 to address debug assertions in 2 API tests.
1671
1672         * UIProcess/Network/NetworkProcessProxy.cpp:
1673         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1674
1675 2018-11-17  Devin Rousso  <drousso@apple.com>
1676
1677         Web Inspector: Network: add button to show system certificate dialog
1678         https://bugs.webkit.org/show_bug.cgi?id=191458
1679         <rdar://problem/45977019>
1680
1681         Reviewed by Joseph Pecoraro.
1682
1683         * UIProcess/WebInspectorProxy.messages.in:
1684         * UIProcess/WebInspectorProxy.h:
1685         * UIProcess/WebInspectorProxy.cpp:
1686         (WebKit::WebInspectorProxy::showCertificate): Added.
1687         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1688         * UIProcess/mac/WebInspectorProxyGtk.cpp:
1689         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1690         * UIProcess/mac/WebInspectorProxyMac.mm:
1691         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1692         * UIProcess/mac/WebInspectorProxyWPE.cpp:
1693         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1694         * UIProcess/mac/WebInspectorProxyWin.cpp:
1695         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
1696         * WebProcess/WebPage/WebInspectorUI.h:
1697         * WebProcess/WebPage/WebInspectorUI.cpp:
1698         (WebKit::WebInspectorUI::showCertificate): Added.
1699
1700         * UIProcess/RemoteWebInspectorProxy.messages.in:
1701         * UIProcess/RemoteWebInspectorProxy.h:
1702         * UIProcess/RemoteWebInspectorProxy.cpp:
1703         (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
1704         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1705         * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
1706         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1707         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
1708         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
1709         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1710         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1711         (WebKit::RemoteWebInspectorUI::showCertificate): Added.
1712
1713         * NetworkProcess/cache/NetworkCacheCoders.h:
1714         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
1715         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
1716         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
1717         Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
1718         respective platform's CertificateInfo.h file.
1719
1720         * UIProcess/Authentication/mac/WebCredentialMac.mm:
1721
1722         * Configurations/WebKit.xcconfig:
1723         * PlatformMac.cmake:
1724         * PlatformWin.cmake:
1725         * SourcesCocoa.txt:
1726         * SourcesGTK.txt:
1727         * SourcesWPE.txt:
1728         * WebKit.xcodeproj/project.pbxproj:
1729
1730 2018-11-16  Chris Dumez  <cdumez@apple.com>
1731
1732         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
1733         https://bugs.webkit.org/show_bug.cgi?id=191800
1734
1735         Reviewed by Ryosuke Niwa.
1736
1737         Make sure the NetworkProcessProxy destructor calls its remaining m_pendingConnectionReplies
1738         completion handlers to avoid hitting an assertion in the CompletionHandler destructor.
1739
1740         Prewarmed WebProcess do not keep the ProcessPool alive and thus not the NetworkProcessProxy
1741         either. As a result, it is possible for NetworkProcessProxy to have pending connection
1742         requests from those prewarmed processes when it is destroyed. Similar story for the
1743         suspended page processes when they are destroyed.
1744
1745         * UIProcess/Network/NetworkProcessProxy.cpp:
1746         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1747
1748 2018-11-16  Alex Christensen  <achristensen@webkit.org>
1749
1750         Tweak _showSafeBrowsingWarningWithTitle SPI
1751         https://bugs.webkit.org/show_bug.cgi?id=191799
1752
1753         Reviewed by Wenson Hsieh.
1754
1755         * UIProcess/API/Cocoa/WKWebView.mm:
1756         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
1757         (+[WKWebView _visitUnsafeWebsiteSentinel]):
1758         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1759         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1760         (-[WKSafeBrowsingWarning clickedOnLink:]):
1761         I need to localize "Continue" and "Cancel" so they aren't always in English.
1762
1763 2018-11-16  Chris Dumez  <cdumez@apple.com>
1764
1765         WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView API test is crashing in debug
1766         https://bugs.webkit.org/show_bug.cgi?id=191797
1767
1768         Reviewed by Ryosuke Niwa.
1769
1770         We were hitting the assertion because the error handler was first getting called. It would
1771         deallocate the send right, cancel/null out the XPC connection and call
1772         didFinishLaunchingProcess(0, IPC::Connection::Identifier()).
1773
1774         Then the xpc_connection_send_message_with_reply() block would get called later and
1775         would try to deallocate the send right again, and call
1776         didFinishLaunchingProcess(0, IPC::Connection::Identifier()) again because the xpc
1777         connection is null.
1778
1779         Handle this case by having the xpc_connection_send_message_with_reply() block check
1780         that we're still launching (i.e. didFinishLaunchingProcess() has not been called
1781         yet).
1782
1783         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1784         (WebKit::ProcessLauncher::launchProcess):
1785
1786 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
1787
1788         Unreviewed follow-up to r238330.
1789
1790         * UIProcess/WebPageProxy.cpp:
1791         (WebKit::WebPageProxy::close):
1792         Don't clear the pointer after invalidating since the pointer is
1793         used later one. We don't mind it being used after invalidation
1794         it will do the right thing, we'd rather have the WebInspectorProxy
1795         lifetime match the WebPageProxy.
1796
1797 2018-11-16  Chris Dumez  <cdumez@apple.com>
1798
1799         ProcessSwap.NavigationWithLockedHistoryWithoutPSON API test is a flaky crash in debug
1800         https://bugs.webkit.org/show_bug.cgi?id=191795
1801
1802         Reviewed by Alex Christensen.
1803
1804         If the WebProcessPool is getting destroyed while there is a prewarmed WebContent process
1805         that is awaiting its connnection to the network process, then we'll hit the
1806         process->hasOneRef() assertion in the WebProcessPool destructor. This is because
1807         NetworkProcessProxy::m_pendingConnectionReplies keeps a RefPtr to the WebProcessProxy
1808         that is awaiting the connection. The NetworkProcessProxy does not really need to keep
1809         the WebProcessProxy alive in this case so this patch switches to using a WeakPtr instead.
1810
1811         * UIProcess/Network/NetworkProcessProxy.cpp:
1812         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1813         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1814         * UIProcess/Network/NetworkProcessProxy.h:
1815         * UIProcess/WebProcessProxy.h:
1816
1817 2018-11-16  Chris Dumez  <cdumez@apple.com>
1818
1819         [macOS] Label "prewarmed" WebContent processes in Activity Monitor
1820         https://bugs.webkit.org/show_bug.cgi?id=191765
1821         <rdar://problem/45953463>
1822
1823         Reviewed by Geoffrey Garen.
1824
1825         Label "prewarmed" WebContent processes in Activity Monitor to facilitate debugging.
1826
1827         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1828         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1829         * UIProcess/WebProcessProxy.cpp:
1830         (WebKit::WebProcessProxy::getLaunchOptions):
1831         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
1832         * WebProcess/WebProcess.cpp:
1833         (WebKit::WebProcess::markIsNoLongerPrewarmed):
1834         * WebProcess/WebProcess.h:
1835         * WebProcess/WebProcess.messages.in:
1836         * WebProcess/cocoa/WebProcessCocoa.mm:
1837         (WebKit::WebProcess::initializeProcessName):
1838         (WebKit::WebProcess::updateProcessName):
1839         (WebKit::WebProcess::platformInitializeProcess):
1840
1841 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
1842
1843         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
1844         https://bugs.webkit.org/show_bug.cgi?id=191740
1845         <rdar://problem/45470897>
1846
1847         Reviewed by Timothy Hatcher.
1848
1849         When a web page asks to open a local Web Inspector, that inspector
1850         will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
1851         instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
1852
1853         Previously a WebInspectorProxy was re-created every time the WebPageProxy's
1854         WebPage / WebProcess was changed, effectively closing the Web Inspector
1855         frontend when the WebPage was swapped or crashed.
1856
1857         This change keeps the WebInspectorProxy alive as long as the WebPageProxy
1858         is alive. During process swaps, or process crashes, the WebInspectorProxy
1859         is reset when the page is reset and updated when the page's WebProcess
1860         changes. Since WebInspectorProxy owns the Web Inspector view / window
1861         the Web Inspector window can be kept alive across (and attached state)
1862         across WebPage / WebProcess changes.
1863
1864         Previously the WebContentProcess's WebKit::WebInspector was the Local
1865         FrontendChannel for the WebCore::InspectorController. This can't
1866         outlive the single WebContentProcess.
1867
1868         This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
1869         for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
1870         now stays alive alongside the WebPageProxy this will live across process changes.
1871         This means that the WebInspectorUI process must send its backend messages to
1872         the WebInspectorProxy -> WebPageInspectorController now instead of the
1873         old path WebInspector -> WebCore::InspectorController.
1874
1875         A direct IPC connection is still maintained between the WebContentProcess's
1876         WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
1877         this connection was established by WebKit::WebInspector vending an
1878         IPC::Attachment to the WebInspectorUI process. This patch inverts that
1879         relationship, because the WebInspectorUI process now lives across multiple
1880         WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
1881         to the WebContentProcess each time the process changes. This way they can both
1882         still communicate through normal Messages::WebInspector/WebInspectorUI
1883         messages and everything behaves as previously expected.
1884
1885         * Scripts/webkit/messages.py:
1886         Header for Inspector::FrontendChannel::ConnectionType.
1887
1888         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1889         (WebKit::WebInspectorClient::openLocalFrontend):
1890         * WebProcess/WebPage/WebInspector.cpp:
1891         (WebKit::WebInspector::openLocalInspectorFrontend):
1892         (WebKit::WebInspector::setFrontendConnection):
1893         (WebKit::WebInspector::closeFrontendConnection):
1894         (WebKit::WebInspector::close):
1895         (WebKit::WebInspector::openFrontendConnection): Deleted.
1896         (WebKit::WebInspector::sendMessageToBackend): Deleted.
1897         (WebKit::WebInspector::sendMessageToFrontend): Deleted.
1898         On the WebProcess side we ask the UIProcess to open a local frontend and now
1899         receive instead of vend an IPC connection to the WebInspectorUI process.
1900
1901         * UIProcess/WebPageProxy.cpp:
1902         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1903         (WebKit::WebPageProxy::close):
1904         (WebKit::WebPageProxy::resetState):
1905         Keep the WebInspectorProxy alive alongside the WebPageProxy.
1906         Update it as processes / states change.
1907
1908         * UIProcess/WebInspectorProxy.h:
1909         * UIProcess/WebInspectorProxy.messages.in:
1910         * UIProcess/WebInspectorProxy.cpp:
1911         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
1912         (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
1913         (WebKit::WebInspectorProxy::sendMessageToFrontend):
1914         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
1915         Open and close a local frontend by being the FrontendChannel on the UIProcess side.
1916
1917         (WebKit::WebInspectorProxy::sendMessageToBackend):
1918         Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
1919         now that the InspectorController is here instead of in the WebProcess.
1920
1921         (WebKit::WebInspectorProxy::setFrontendConnection):
1922         Transfer the WebProcess <-> InspectorProcess IPC connection through us
1923         because we are the one link between them when processes change.
1924
1925         (WebKit::WebInspectorProxy::invalidate):
1926         (WebKit::WebInspectorProxy::frontendLoaded):
1927         Be safer and handle inspectedPage being potentially null.
1928
1929         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
1930         (WebKit::WebPageInspectorTargetController::connectInspector):
1931         * WebProcess/WebPage/WebPageInspectorTargetController.h:
1932         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
1933         (WebKit::WebPageInspectorTargetFrontendChannel::create):
1934         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
1935         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
1936         * UIProcess/InspectorTargetProxy.cpp:
1937         (WebKit::InspectorTargetProxy::connect):
1938         Proxy the ConnectionType received on the UIProcess side to the WebProcess side
1939         when connecting to sub-targets.
1940
1941         * WebProcess/WebPage/WebPage.cpp:
1942         (WebKit::WebPage::connectInspector):
1943         (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
1944         * WebProcess/WebPage/WebPage.h:
1945         * WebProcess/WebPage/WebPage.messages.in:
1946         * UIProcess/WebPageProxy.h:
1947         (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
1948         (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
1949         * UIProcess/WebPageProxy.messages.in:
1950         * UIProcess/WebProcessPool.cpp:
1951         (WebKit::WebProcessPool::processForNavigationInternal):
1952         Eliminate the hasLocalInspectorFrontend state that was only used
1953         to disable PSON. PSON no longer needs to be disabled for this reason.
1954
1955         * WebProcess/WebPage/WebInspector.h:
1956         * WebProcess/WebPage/WebInspector.messages.in:
1957         * WebProcess/WebPage/WebInspectorUI.cpp:
1958         (WebKit::WebInspectorUI::establishConnection):
1959         (WebKit::WebInspectorUI::updateConnection):
1960         (WebKit::WebInspectorUI::closeWindow):
1961         (WebKit::WebInspectorUI::sendMessageToBackend):
1962         * WebProcess/WebPage/WebInspectorUI.h:
1963         * WebProcess/WebPage/WebInspectorUI.messages.in:
1964         Vend an IPC connection on demand to the WebProcess side.
1965
1966 2018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1967
1968         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
1969         https://bugs.webkit.org/show_bug.cgi?id=191744
1970         <rdar://problem/46125461>
1971
1972         Unreviewed, install the file.
1973
1974         * PlatformGTK.cmake:
1975         * PlatformWPE.cmake:
1976
1977 2018-11-16  Zalan Bujtas  <zalan@apple.com>
1978
1979         Add DidFirstMeaningfulPaint milestone.
1980         https://bugs.webkit.org/show_bug.cgi?id=191754
1981
1982         Reviewed by Simon Fraser.
1983
1984         * Shared/API/c/WKPageLoadTypes.h:
1985         * Shared/API/c/WKSharedAPICast.h:
1986         (WebKit::toWKLayoutMilestones):
1987         (WebKit::toLayoutMilestones):
1988         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
1989         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
1990         (pageRenderingProgressEvents):
1991
1992 2018-11-16  Chris Dumez  <cdumez@apple.com>
1993
1994         Automatic process prewarming should be turned on if PSON is enabled via experimental features
1995         https://bugs.webkit.org/show_bug.cgi?id=191761
1996
1997         Reviewed by Ryosuke Niwa.
1998
1999         m_isAutomaticProcessWarmingEnabledByClient is a std::optional and should not be initialized to
2000         true / false until the client calls API to toggle the feature. When m_isAutomaticProcessWarmingEnabledByClient
2001         is std::nullopt then m_processSwapsOnNavigationFromExperimentalFeatures controls automatic
2002         process prewarming.
2003
2004         * UIProcess/API/APIProcessPoolConfiguration.h:
2005
2006 2018-11-16  Alex Christensen  <achristensen@webkit.org>
2007
2008         Add API to disable safe browsing checks
2009         https://bugs.webkit.org/show_bug.cgi?id=191610
2010
2011         Reviewed by Dean Jackson.
2012
2013         * UIProcess/API/Cocoa/WKPreferences.h:
2014         * UIProcess/API/Cocoa/WKPreferences.mm:
2015         (-[WKPreferences setSafeBrowsingEnabled:]):
2016         (-[WKPreferences isSafeBrowsingEnabled]):
2017         (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
2018         (-[WKPreferences _safeBrowsingEnabled]): Deleted.
2019         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2020
2021 2018-11-16  Chris Dumez  <cdumez@apple.com>
2022
2023         WebKit.UnavailablePlugIn API test is crashing in debug
2024         https://bugs.webkit.org/show_bug.cgi?id=191753
2025
2026         Reviewed by Alex Christensen.
2027
2028         Add missing early returns. Those were mistakenly dropped in r235200.
2029
2030         * UIProcess/Cocoa/NavigationState.mm:
2031         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
2032
2033 2018-11-16  Chris Dumez  <cdumez@apple.com>
2034
2035         [Mac] Regression: WebContent process's display name is no longer set
2036         https://bugs.webkit.org/show_bug.cgi?id=191722
2037         <rdar://problem/45960550>
2038
2039         Reviewed by Per Arne Vollan.
2040
2041         Make sure The WebContent process calls _RegisterApplication() during initialization and
2042         *before* trying to set its display name. Setting the display name fails otherwise.
2043
2044         * WebProcess/cocoa/WebProcessCocoa.mm:
2045         (WebKit::WebProcess::initializeProcessName):
2046         (WebKit::WebProcess::platformInitializeProcess):
2047
2048 2018-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2049
2050         Enable process swap on cross-site navigation by default on iOS
2051         https://bugs.webkit.org/show_bug.cgi?id=191735
2052
2053         Reviewed by Chris Dumez.
2054
2055         Enabled the feature.
2056
2057         * Shared/WebPreferencesDefaultValues.h:
2058
2059 2018-11-16  Antti Koivisto  <antti@apple.com>
2060
2061         REGRESSION(r237467) [PSON] iOS: Going back to a page sometimes doesn't restore the full page
2062         https://bugs.webkit.org/show_bug.cgi?id=191737
2063
2064         Reviewed by Simon Fraser.
2065
2066         * WebProcess/WebPage/WebPage.cpp:
2067         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2068
2069         Layer tree should stay frozen in m_shouldResetDrawingArea state. Otherwise spurious commit transactions may
2070         mess up state on UI process side.
2071
2072         Specifically WKWebView._needsResetViewStateAfterCommitLoadForMainFrame would get stuck to TRUE and prevent
2073         all viewport updates because WKWebView._firstPaintAfterCommitLoadTransactionID has value greater
2074         than any current transaction IDs.
2075
2076 2018-11-16  Chris Dumez  <cdumez@apple.com>
2077
2078         Unreviewed typo fix in comment added in r238250.
2079
2080         * UIProcess/WebProcessPool.cpp:
2081         (WebKit::WebProcessPool::ensureNetworkProcess):
2082
2083 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
2084
2085         Storing blobs in IDB on iOS: "Error preparing blob/file"
2086         https://bugs.webkit.org/show_bug.cgi?id=188438
2087         <rdar://problem/43097279>
2088
2089         Reviewed by Alex Christensen.
2090
2091         Grant sandbox extension of temp folder to network process, and clean up some code that managed sandbox extension
2092         of IDB temporary blob files in network process.
2093
2094         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2095         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
2096         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2097         (WebKit::WebIDBConnectionToClient::handleGetResult):
2098         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2099         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2100         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Deleted.
2101         (WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath): Deleted.
2102         * NetworkProcess/NetworkConnectionToWebProcess.h:
2103         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2104         * NetworkProcess/NetworkProcess.cpp:
2105         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
2106         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
2107         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): Deleted.
2108         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): Deleted.
2109         * NetworkProcess/NetworkProcess.h:
2110         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2111         (WebKit::NetworkProcessCreationParameters::encode const):
2112         (WebKit::NetworkProcessCreationParameters::decode):
2113         * NetworkProcess/NetworkProcessCreationParameters.h:
2114         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2115         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2116         * UIProcess/WebProcessPool.cpp:
2117         (WebKit::WebProcessPool::ensureNetworkProcess):
2118         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2119         (WebKit::WebIDBConnectionToServer::didGetRecord):
2120         (WebKit::WebIDBConnectionToServer::didGetAllRecords):
2121         (WebKit::WebIDBConnectionToServer::didOpenCursor):
2122         (WebKit::WebIDBConnectionToServer::didIterateCursor):
2123         (WebKit::preregisterSandboxExtensionsIfNecessary): Deleted.
2124
2125 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
2126
2127         Add USE(LIBWPE) to WebCore
2128         https://bugs.webkit.org/show_bug.cgi?id=191401
2129
2130         Reviewed by Michael Catanzaro.
2131
2132         Rename PlatformDisplayWPE to PlatformDisplayLibWPE.
2133
2134         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2135         (WebKit::AcceleratedSurfaceWPE::initialize):
2136         * WebProcess/wpe/WebProcessMainWPE.cpp:
2137
2138 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2139
2140         [GStreamer][WebRTC] Add API to enable/disable device mocks
2141         https://bugs.webkit.org/show_bug.cgi?id=191699
2142
2143         This basically us to test MediaStream/WebRTC support without
2144         requiring cameras or microphones and is quite useful.
2145
2146         Also fix the GStreamerAudioMock by:
2147           - Stop setting `leaky-upstream` on the GStreamerCapturer queue,
2148             this was usefull when we were trying to bring the MediaStream
2149             sources inside the main pipeline, it is not the case anymore
2150             (and not doable with latest version of LibWebRTC).
2151           - Use a 'ticks' wave on the gstreamer audiotestsrc so the test
2152             stream is similar to what Apple port does.
2153
2154         Reviewed by Xabier Rodriguez-Calvar.
2155
2156         The mocks are already tested and the API is really simple.
2157
2158         * UIProcess/API/glib/WebKitSettings.cpp:
2159         (webKitSettingsSetProperty):
2160         (webKitSettingsGetProperty):
2161         (webkit_settings_class_init):
2162         (webkit_settings_get_enable_mock_capture_devices):
2163         (webkit_settings_set_enable_mock_capture_devices):
2164         * UIProcess/API/gtk/WebKitSettings.h:
2165         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2166
2167 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2168
2169         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
2170         https://bugs.webkit.org/show_bug.cgi?id=191744
2171
2172         It should always have been there.
2173
2174         Reviewed by Carlos Garcia Campos.
2175
2176         * UIProcess/API/gtk/webkit2.h:
2177
2178 2018-11-16  Antoine Quint  <graouts@apple.com>
2179
2180         PointerEvents should not require touch event listeners to be registered
2181         https://bugs.webkit.org/show_bug.cgi?id=191333
2182         <rdar://problem/45857523>
2183
2184         Reviewed by Dean Jackson.
2185
2186         * UIProcess/WebPageProxy.cpp:
2187         (WebKit::WebPageProxy::updateTouchEventTracking):
2188         (WebKit::WebPageProxy::touchEventTrackingType const):
2189         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2190         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
2191         (WebKit::WebPageProxy::handleTouchEvent):
2192         (WebKit::WebPageProxy::resetState):
2193         * UIProcess/WebPageProxy.h:
2194
2195 2018-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
2196
2197         WKPreferencesSetFontSmoothingLevel doesn't actually do anything
2198         https://bugs.webkit.org/show_bug.cgi?id=191708
2199
2200         Reviewed by Simon Fraser.
2201
2202         Delete the symbol because no one calls it and it doesn't do anything
2203
2204         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
2205         * Shared/FontSmoothingLevel.h: Removed.
2206         * Shared/WebPreferences.yaml:
2207         * UIProcess/API/C/WKAPICast.h:
2208         (WebKit::toFontSmoothingLevel): Deleted.
2209         * UIProcess/API/C/WKPreferences.cpp:
2210         (WKPreferencesSetFontSmoothingLevel): Deleted.
2211         (WKPreferencesGetFontSmoothingLevel): Deleted.
2212         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2213         * UIProcess/WebPreferences.h:
2214         * WebKit.xcodeproj/project.pbxproj:
2215         * mac/WebKit2.order:
2216
2217 2018-11-15  Truitt Savell  <tsavell@apple.com>
2218
2219         Unreviewed, rolling out r238244.
2220
2221         Caused High Sierra test runs to fail early with 50 crashes and
2222         casued 25 API failures.
2223
2224         Reverted changeset:
2225
2226         "[css-logical] Implement flow-relative margin, padding and
2227         border shorthands"
2228         https://bugs.webkit.org/show_bug.cgi?id=188697
2229         https://trac.webkit.org/changeset/238244
2230
2231 2018-11-15  Joseph Pecoraro  <pecoraro@apple.com>
2232
2233         Web Inspector: Remove unused WebInspectorProxy code
2234         https://bugs.webkit.org/show_bug.cgi?id=191674
2235
2236         Reviewed by Dean Jackson.
2237
2238         * UIProcess/WebInspectorProxy.cpp:
2239         (WebKit::WebInspectorProxy::createInspectorPage):
2240         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2241         * UIProcess/WebInspectorProxy.h:
2242         * UIProcess/mac/WebInspectorProxyMac.mm:
2243         (WebKit::WebInspectorProxy::setInspectorWindowFrame): Deleted.
2244         (WebKit::WebInspectorProxy::inspectorWindowFrame): Deleted.
2245         * WebProcess/WebPage/WebInspector.h:
2246
2247 2018-11-15  Ryosuke Niwa  <rniwa@webkit.org>
2248
2249         Enable process swap on cross-site navigation by default on macOS
2250         https://bugs.webkit.org/show_bug.cgi?id=191572
2251
2252         Reviewed by Chris Dumez.
2253
2254         Enabled the feature by default on macOS.
2255
2256         * Shared/WebPreferences.yaml:
2257         * Shared/WebPreferencesDefaultValues.h:
2258
2259 2018-11-15  Chris Dumez  <cdumez@apple.com>
2260
2261         IndexedDB.IndexedDBTempFileSize API test times out with process prewarming enabled
2262         https://bugs.webkit.org/show_bug.cgi?id=191671
2263         <rdar://problem/46086062>
2264
2265         Reviewed by Alex Christensen.
2266
2267         Enabling process prewarming caused IndexedDB.IndexedDBTempFileSize API to time out and print
2268         the following line:
2269         "Attempted to create a NetworkLoad with a session (id=2) that does not exist."
2270
2271         This actually identified a pre-existing bug with our handling of non-default data store.
2272         Whenever a page starts using a data store, we call WebProcessPool::pageBeginUsingWebsiteDataStore()
2273         which will call NetworkProcessProxy::addSession() if the network process was already started
2274         to let the network process know about this non-default session. There are several issues with the
2275         current model:
2276         1. If the network process was not created yet when pageBeginUsingWebsiteDataStore() is called,
2277            then the network process will not know about the non-default session when it actually gets
2278            started later on. This is unlikely to happen in practice, except in case of network process
2279            crash because we create the network process as soon as we initialize the first WebProcessProxy.
2280         2. Even if we successfuly managed to register the session with the network process proxy, we get
2281            in trouble if the network process crashes or is terminated later on as we do not re-register
2282            those sessions with the new network process.
2283
2284         To address these 2 issues, WebProcessPool::ensureNetworkProcess() now takes care of registering
2285         all the non-default sessions (that are associated with this process pool) with the new network
2286         process. The WebProcessPool knows about these sessions because it adds them to m_sessionToPagesMap
2287         whenever WebProcessPool::pageBeginUsingWebsiteDataStore() is called, even if the network process
2288         proxy was not created yet.
2289
2290         The reason the IndexedDB.IndexedDBTempFileSize API test was failing was because it did:
2291         1. A load in a WebView V1 with a non-default session
2292         2. Process prewarming kicked in after this load and would create a new WebProcessProxy.
2293         3. Terminate the network process
2294         4. Another load in a WebView V2 with the same non-defaut session, which would reuse the
2295           prewarmed process. Because the network process was terminated, constructing the new
2296           page would not register the session ID with the new network process when
2297           pageBeginUsingWebsiteDataStore() is called.
2298         -> The load would hang because the new network process would not know about the
2299            non-default session when started later on.
2300
2301         The bug was previously hidden without process prewarming because step 4 would create a *new*
2302         WebProcessProxy and WebProcessPool::initializeNewWebProcess() would call ensureNetworkProcess()
2303         so that pageBeginUsingWebsiteDataStore() would successfuly register the session with the
2304         network process later on.
2305
2306         I wrote a second API test (WebKit.DoLoadWithNonDefaultDataStoreAfterTerminatingNetworkProcess)
2307         to demonstrate the pre-existing bug without process prewarming enabled.
2308
2309         * UIProcess/WebProcessPool.cpp:
2310         (WebKit::WebProcessPool::ensureNetworkProcess):
2311
2312 2018-11-15  Vivek Seth  <v_seth@apple.com>
2313
2314         Create feature flag (HTTPS_UPGRADE)
2315         https://bugs.webkit.org/show_bug.cgi?id=191613
2316         <rdar://problem/45851068>
2317
2318         Reviewed by Dean Jackson.
2319
2320         * config.h:
2321
2322 2018-11-15  Chris Dumez  <cdumez@apple.com>
2323
2324         Regression(r238215) WKProcessPool.WarmInitialProcess API test is failing
2325         https://bugs.webkit.org/show_bug.cgi?id=191693
2326
2327         Reviewed by Alex Christensen.
2328
2329         Allow *explicit* process prewarming to construct the default data store if necessary or we would
2330         not be obeying the client's request. Only automatic process prewarming should avoid constructing
2331         the default data store unnecessarily to avoid causing memory regressions.
2332
2333         * UIProcess/API/C/WKContext.cpp:
2334         (WKContextWarmInitialProcess):
2335         * UIProcess/API/Cocoa/WKProcessPool.mm:
2336         (-[WKProcessPool _warmInitialProcess]):
2337         * UIProcess/WebProcessPool.cpp:
2338         (WebKit::WebProcessPool::prewarmProcess):
2339         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2340         * UIProcess/WebProcessPool.h:
2341         (WebKit::WebProcessPool::sendToOneProcess):
2342
2343 2018-11-14  Jiewen Tan  <jiewen_tan@apple.com>
2344
2345         Unreviewed, comment improvement over r238166.
2346
2347         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2348         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2349         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
2350
2351 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2352
2353         [WebAuthN] Use a real nonce for CTAPHID_INIT
2354         https://bugs.webkit.org/show_bug.cgi?id=191533
2355         <rdar://problem/46103502>
2356
2357         Reviewed by Brent Fulgham.
2358
2359         Use a real nonce for CTAPHID_INIT request according to:
2360         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid_init-0x06.
2361         The challenge here is the new transaction needs to start in the next runloop otherwise a dead lock will form:
2362         wrong nonce -> new transaction -> new nonce -> write init request -> read init response from last run as it
2363         piped in the run loop -> wrong nonce of course -> ...
2364         To break the above dead lock, we have to start the new transaction in the next run. However, that isn't
2365         sufficient as the arrived init response will be piped in HidConnection::m_inputReports, which is designed
2366         on purpose to store any data packets within (initialized, terminated) time interval to prevent data loss in
2367         the case when HidConnection::registerDataReceivedCallback is called after the first data packet's arrival.
2368         In order to break the dead lock completely, HidConnection::invalidateCache will bnnne called prior to every
2369         send to delete any potential init response from last run. HidConnection::invalidateCache is not necessary
2370         for other protocols though. The above scenario is more or less a design flaw in CTAP HID.
2371
2372         Of course, all above scenarios are covered in our mock tests.
2373
2374         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2375         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2376         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
2377         (WebKit::HidConnection::invalidateCache):
2378         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
2379         (WebKit::MockHidConnection::send):
2380         (WebKit::MockHidConnection::parseRequest):
2381         (WebKit::MockHidConnection::feedReports):
2382         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
2383         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2384         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2385         (WebKit::CtapHidDriver::Worker::transact):
2386         (WebKit::CtapHidDriver::CtapHidDriver):
2387         (WebKit::CtapHidDriver::transact):
2388         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2389         (WebKit::CtapHidDriver::returnResponse):
2390         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
2391
2392 2018-11-15  Oriol Brufau  <obrufau@igalia.com>
2393
2394         [css-logical] Implement flow-relative margin, padding and border shorthands
2395         https://bugs.webkit.org/show_bug.cgi?id=188697
2396
2397         Reviewed by Simon Fraser and Antti Koivisto.
2398
2399         Add a CSSLogicalEnabled runtime flag.
2400
2401         * Shared/WebPreferences.yaml:
2402
2403 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2404
2405         [WebAuthN] PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::AuthenticatorAttachment should be optional
2406         https://bugs.webkit.org/show_bug.cgi?id=191522
2407
2408         Reviewed by Brent Fulgham.
2409
2410         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2411         (WebKit::AuthenticatorManagerInternal::collectTransports):
2412
2413 2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2414
2415         [SOUP] Make Accept-Languages header look more like other browsers
2416         https://bugs.webkit.org/show_bug.cgi?id=191614
2417
2418         Reviewed by Carlos Garcia Campos.
2419
2420         This changes our Accept-Language header to better match other browsers, from something
2421         like this:
2422
2423         Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
2424
2425         to something like this:
2426
2427         Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
2428
2429         There's no particular motivation for this change. I just noticed we were different for no
2430         clear reason.
2431
2432         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2433         (WebKit::buildAcceptLanguages):
2434         * UIProcess/API/glib/WebKitWebContext.cpp:
2435         (webkit_web_context_set_preferred_languages):
2436
2437 2018-11-15  Daniel Bates  <dabates@apple.com>
2438
2439         [iOS] Shift + Tab does not focus previous field
2440         https://bugs.webkit.org/show_bug.cgi?id=191596
2441         <rdar://problem/45892053>
2442
2443         Reviewed by Wenson Hsieh.
2444
2445         Wire up the the tab and shift + tab key commands to the WKWebView/WKContentView's
2446         action forwarding mechanism. Also rename -_prevAccessoryTab to -_previousAccessoryTab.
2447
2448         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
2449         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2450         * UIProcess/ios/WKContentViewInteraction.h:
2451         * UIProcess/ios/WKContentViewInteraction.mm:
2452         (-[WKContentView canPerformActionForWebView:withSender:]):
2453         (-[WKContentView keyCommands]):
2454         (-[WKContentView _nextAccessoryTabForWebView:]): Added.
2455         (-[WKContentView _previousAccessoryTabForWebView:]): Added.
2456         (-[WKContentView _nextAccessoryTab:]): Deleted.
2457         (-[WKContentView _prevAccessoryTab:]): Deleted.
2458
2459 2018-11-15  Keith Rollin  <krollin@apple.com>
2460
2461         Delete old .xcfilelist files
2462         https://bugs.webkit.org/show_bug.cgi?id=191669
2463         <rdar://problem/46081994>
2464
2465         Reviewed by Chris Dumez.
2466
2467         .xcfilelist files were created and added to the Xcode project files in
2468         https://trac.webkit.org/changeset/238008/webkit. However, they caused
2469         build issues and they were removed from the Xcode projects in
2470         https://trac.webkit.org/changeset/238055/webkit. This check-in removes
2471         the files from the repository altogether. They'll ultimately be
2472         replaced with new files with names that indicate whether the
2473         associated files are inputs to the Run Script phase or are files
2474         created by the Run Script phase.
2475
2476         * DerivedSources.xcfilelist: Removed.
2477         * UnifiedSources.xcfilelist: Removed.
2478
2479 2018-11-15  Frederic Wang  <fwang@igalia.com>
2480
2481         [WebAuthN] Make AuthenticatorManager
2482         https://bugs.webkit.org/show_bug.cgi?id=189279
2483
2484         Unreviewed build fix.
2485
2486         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Add missing header.
2487         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Ditto.
2488         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Ditto.
2489
2490 2018-11-14  Keith Rollin  <krollin@apple.com>
2491
2492         Move scripts for Derived and Unified Sources to external files
2493         https://bugs.webkit.org/show_bug.cgi?id=191670
2494         <rdar://problem/46082278>
2495
2496         Reviewed by Keith Miller.
2497
2498         Move the scripts in the Generate Derived Sources and Generate Unified
2499         Sources Run Script phases from the Xcode projects to external shell
2500         script files. Then invoke those scripts from the Run Script phases.
2501         This refactoring is being performed to support later work that will
2502         invoke these scripts in other contexts.
2503
2504         The scripts were maintained as-is when making the move. I did a little
2505         reformatting and added 'set -e' to the top of each file, but that's
2506         it.
2507
2508         * Scripts/generate-derived-sources.sh: Added.
2509         * Scripts/generate-unified-sources.sh: Added.
2510         * WebKit.xcodeproj/project.pbxproj:
2511
2512 2018-11-14  Chris Dumez  <cdumez@apple.com>
2513
2514         WebKit.DecidePolicyForNavigationActionForHyperlinkThatRedirects API fails when PSON is enabled
2515         https://bugs.webkit.org/show_bug.cgi?id=191640
2516
2517         Reviewed by Alex Christensen.
2518
2519         The issue was that when process-swapping on a redirect, the parameters provided by the new
2520         WebContent process for navigationActionData / originatingFrameInfoData / frameSecurityOrigin
2521         are not correct because it does not have sufficient information (it does not know a swap
2522         happened).
2523
2524         To address the issue, we now store the navigationActionData / originatingFrameInfoData /
2525         frameSecurityOrigin on the Navigation object whenever decidePolicyForNavigationAction is
2526         called. If the decidePolicyForNavigationAction is for a redirect, use the ones we stored
2527         on the Navigation object instead of the ones provided by the WebContent process. In case
2528         of redirect, those do not change anyway.
2529
2530         This fixes all WebKit.DecidePolicyForNavigationAction* tests with PSON enabled.
2531
2532         * UIProcess/API/APINavigation.h:
2533         (API::Navigation::currentRequestIsRedirect const):
2534         (API::Navigation::wasUserInitiated const):
2535         (API::Navigation::shouldForceDownload const):
2536         (API::Navigation::treatAsSameOriginNavigation const):
2537         (API::Navigation::hasOpenedFrames const):
2538         (API::Navigation::openedViaWindowOpenWithOpener const):
2539         (API::Navigation::opener const):
2540         (API::Navigation::requesterOrigin const):
2541         (API::Navigation::lockHistory const):
2542         (API::Navigation::lockBackForwardList const):
2543         (API::Navigation::clientRedirectSourceForHistory const):
2544         (API::Navigation::setLastNavigationAction):
2545         (API::Navigation::lastNavigationAction const):
2546         (API::Navigation::setOriginatingFrameInfo):
2547         (API::Navigation::originatingFrameInfo const):
2548         (API::Navigation::setDestinationFrameSecurityOrigin):
2549         (API::Navigation::destinationFrameSecurityOrigin const):
2550         * UIProcess/WebPageProxy.cpp:
2551         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2552         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2553         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2554         * UIProcess/WebPageProxy.h:
2555
2556 2018-11-14  Chris Dumez  <cdumez@apple.com>
2557
2558         WebKit.WebsiteDataStoreCustomPaths API test is failing when enabling process prewarming
2559         https://bugs.webkit.org/show_bug.cgi?id=191638
2560
2561         Reviewed by Alex Christensen.
2562
2563         WebProcessPool::prewarmProcess() should not create the default WebSite Data Store if it
2564         does not exist yet. This is bad for memory consumption and it is what was causing this
2565         API test to fail.
2566
2567         WebProcessPool::prewarmProcess() now tries to use the following data stores in this
2568         order of preference:
2569         1. WebProcessPool::m_websiteDataStore (aka this process pool's primary data store)
2570         2. The data store of the last WebProcessProxy that was created
2571         3. The default data store if it exists
2572
2573         If no suitable data store is found, we cancel the process prewarming and log a console
2574         message instead.
2575
2576         * UIProcess/WebProcessPool.cpp:
2577         (WebKit::WebProcessPool::prewarmProcess):
2578
2579 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2580
2581         Enabled dark mode CSS support by default.
2582         https://bugs.webkit.org/show_bug.cgi?id=191609
2583         rdar://problem/46046861
2584
2585         Reviewed by Megan Gardner.
2586
2587         * Shared/WebPreferences.yaml: Set DarkModeCSSEnabled's defaultValue to true.
2588
2589 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2590
2591         Default the view background color and text color to different values when in dark mode.
2592         https://bugs.webkit.org/show_bug.cgi?id=191607
2593         rdar://problem/46045854
2594
2595         Reviewed by Dean Jackson.
2596
2597         * UIProcess/Cocoa/WebViewImpl.mm:
2598         (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
2599         (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
2600         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2601         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
2602         * WebProcess/WebPage/WebPage.cpp:
2603         (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
2604
2605 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2606
2607         Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
2608         https://bugs.webkit.org/show_bug.cgi?id=191612
2609
2610         Reviewed by Matt Baker.
2611
2612         * UIProcess/Automation/WebAutomationSession.cpp:
2613         (WebKit::WebAutomationSession::connect):
2614         (WebKit::WebAutomationSession::disconnect):
2615         (WebKit::WebAutomationSession::terminate):
2616         * UIProcess/Automation/WebAutomationSession.h:
2617         * UIProcess/WebPageDebuggable.cpp:
2618         (WebKit::WebPageDebuggable::connect):
2619         (WebKit::WebPageDebuggable::disconnect):
2620         * UIProcess/WebPageDebuggable.h:
2621         * UIProcess/WebPageInspectorController.cpp:
2622         (WebKit::WebPageInspectorController::connectFrontend):
2623         (WebKit::WebPageInspectorController::disconnectFrontend):
2624         * UIProcess/WebPageInspectorController.h:
2625         * WebProcess/WebPage/WebInspector.cpp:
2626         (WebKit::WebInspector::close):
2627         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2628         (WebKit::WebPageInspectorTarget::connect):
2629         (WebKit::WebPageInspectorTarget::disconnect):
2630
2631 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2632
2633         Unreviewed attempted wincairo build fix after 238192.
2634
2635         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2636         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2637
2638 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2639
2640         Web Inspector: Follow-up: Keep Disabling Process Swap for Local Web Inspector
2641         https://bugs.webkit.org/show_bug.cgi?id=191494
2642         <rdar://problem/45469854>
2643
2644         Reviewed by Devin Rousso.
2645
2646         Continue to have the Local Inspector disable PSON while open
2647         until support is added.
2648
2649         * UIProcess/WebPageProxy.cpp:
2650         (WebKit::WebPageProxy::resetState):
2651         * UIProcess/WebPageProxy.h:
2652         (WebKit::WebPageProxy::hasLocalInspectorFrontend const):
2653         (WebKit::WebPageProxy::setHasLocalInspectorFrontend):
2654         * UIProcess/WebPageProxy.messages.in:
2655         * UIProcess/WebProcessPool.cpp:
2656         (WebKit::WebProcessPool::processForNavigationInternal):
2657         * WebProcess/WebPage/WebInspector.cpp:
2658         (WebKit::WebInspector::openFrontendConnection):
2659         (WebKit::WebInspector::closeFrontendConnection):
2660         * WebProcess/WebPage/WebPage.cpp:
2661         (WebKit::WebPage::setHasLocalInspectorFrontend):
2662         * WebProcess/WebPage/WebPage.h:
2663
2664 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2665
2666         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
2667         https://bugs.webkit.org/show_bug.cgi?id=191494
2668         <rdar://problem/45469854>
2669
2670         Reviewed by Devin Rousso.
2671
2672         To support process swapping a slim Web Inspector backend lives in the UIProcess.
2673         The Web Inspector frontend connects to it and is told about sub-targets, namely
2674         pages, that it can further connect to. When performing a process swap the backend
2675         tells the frontend to destroy existing targets and create new targets.
2676
2677         In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single
2678         TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector
2679         protocol messages go through this inspector controller and are routed to the
2680         WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides
2681         when to close and expose new page targets during process swap, or basically
2682         any time it reconnects to a WebProcess. So this patch also makes Web Inspector
2683         stay alive and reconnect to a page when the inspected page crashes!
2684
2685         In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also
2686         has a WebPageInspectorTargetController in anticipation of further sub-targets
2687         within the page (workers, frames) but none exist at the moment. The WebPage
2688         relies on the WebPageProxy to know when to expose this target as a debuggable.
2689
2690         * Sources.txt:
2691         * WebKit.xcodeproj/project.pbxproj:
2692         New files.
2693
2694         * Shared/WebPageCreationParameters.cpp:
2695         (WebKit::WebPageCreationParameters::encode const):
2696         (WebKit::WebPageCreationParameters::decode):
2697         * Shared/WebPageCreationParameters.h:
2698         Remote inspector state can now stay in the UIProcess and does not need to
2699         be passed down to the WebContentProcess.
2700
2701         * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp.
2702         (WebKit::WebPageDebuggable::WebPageDebuggable):
2703         (WebKit::WebPageDebuggable::name const):
2704         (WebKit::WebPageDebuggable::url const):
2705         (WebKit::WebPageDebuggable::hasLocalDebugger const):
2706         (WebKit::WebPageDebuggable::connect):
2707         (WebKit::WebPageDebuggable::disconnect):
2708         (WebKit::WebPageDebuggable::dispatchMessageFromRemote):
2709         (WebKit::WebPageDebuggable::setIndicating):
2710         (WebKit::WebPageDebuggable::setNameOverride):
2711         * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h.
2712         Remote debuggable entry point into the UIProcess for a page.
2713         This is pretty much identical to the PageDebuggable in WebCore.
2714
2715         * Scripts/webkit/messages.py:
2716         * UIProcess/WebPageProxy.messages.in:
2717         * UIProcess/WebPageProxy.cpp:
2718         (WebKit::m_resetRecentCrashCountTimer):
2719         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2720         (WebKit::WebPageProxy::close):
2721         (WebKit::WebPageProxy::createInspectorTarget):
2722         (WebKit::WebPageProxy::destroyInspectorTarget):
2723         (WebKit::WebPageProxy::sendMessageToInspectorFrontend):
2724         (WebKit::WebPageProxy::setIndicating):
2725         (WebKit::WebPageProxy::allowsRemoteInspection const):
2726         (WebKit::WebPageProxy::setAllowsRemoteInspection):
2727         (WebKit::WebPageProxy::remoteInspectionNameOverride const):
2728         (WebKit::WebPageProxy::setRemoteInspectionNameOverride):
2729         (WebKit::WebPageProxy::remoteInspectorInformationDidChange):
2730         (WebKit::WebPageProxy::clearInspectorTargets):
2731         (WebKit::WebPageProxy::createInspectorTargets):
2732         (WebKit::WebPageProxy::didCommitLoadForFrame):
2733         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2734         (WebKit::WebPageProxy::creationParameters):
2735         * UIProcess/WebPageProxy.h:
2736         (WebKit::WebPageProxy::inspectorController):
2737         (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted.
2738         (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted.
2739         Own more inspector state in the UIProcess including a debuggable and inspector controller.
2740
2741         * UIProcess/WebPageInspectorController.h: Added.
2742         * UIProcess/WebPageInspectorController.cpp: Added.
2743         (WebKit::WebPageInspectorController::WebPageInspectorController):
2744         (WebKit::WebPageInspectorController::pageClosed):
2745         (WebKit::WebPageInspectorController::hasLocalFrontend const):
2746         (WebKit::WebPageInspectorController::hasRemoteFrontend const):
2747         (WebKit::WebPageInspectorController::connectFrontend):
2748         (WebKit::WebPageInspectorController::disconnectFrontend):
2749         (WebKit::WebPageInspectorController::disconnectAllFrontends):
2750         (WebKit::WebPageInspectorController::dispatchMessageFromFrontend):
2751         (WebKit::WebPageInspectorController::setIndicating):
2752         (WebKit::WebPageInspectorController::clearTargets):
2753         (WebKit::WebPageInspectorController::createInspectorTarget):
2754         (WebKit::WebPageInspectorController::destroyInspectorTarget):
2755         (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend):
2756         InspectorController with a single TargetAgent in the UIProcess.
2757
2758         * UIProcess/WebPageInspectorTargetAgent.h:
2759         * UIProcess/WebPageInspectorTargetAgent.cpp:
2760         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
2761         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
2762         Target agent implementation.
2763
2764         * UIProcess/InspectorTargetProxy.cpp:
2765         (WebKit::InspectorTargetProxy::create):
2766         (WebKit::InspectorTargetProxy::InspectorTargetProxy):
2767         (WebKit::InspectorTargetProxy::connect):
2768         (WebKit::InspectorTargetProxy::disconnect):
2769         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
2770         * UIProcess/InspectorTargetProxy.h:
2771         UIProcess proxy for an InspectorTarget in the WebContentProcess.
2772
2773         * UIProcess/WebProcessPool.cpp:
2774         (WebKit::WebProcessPool::processForNavigationInternal):
2775
2776         * WebProcess/WebPage/WebPage.cpp:
2777         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2778         (WebKit::WebPage::connectInspector):
2779         (WebKit::WebPage::disconnectInspector):
2780         (WebKit::WebPage::sendMessageToTargetBackend):
2781         (WebKit::WebPage::setIndicating):
2782         (WebKit::WebPage::setAllowsRemoteInspection): Deleted.
2783         (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted.
2784         * WebProcess/WebPage/WebPage.h:
2785         * WebProcess/WebPage/WebPage.messages.in:
2786
2787         * WebProcess/WebPage/WebPageInspectorTarget.h:
2788         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
2789         (WebKit::WebPageInspectorTarget::WebPageInspectorTarget):
2790         (WebKit::WebPageInspectorTarget::identifier const):
2791         (WebKit::WebPageInspectorTarget::connect):
2792         (WebKit::WebPageInspectorTarget::disconnect):
2793         (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend):
2794         InspectorTarget for this WebPage.
2795
2796         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added.
2797         (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController):
2798         (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController):
2799         (WebKit::WebPageInspectorTargetController::addTarget):
2800         (WebKit::WebPageInspectorTargetController::removeTarget):
2801         (WebKit::WebPageInspectorTargetController::connectInspector):
2802         (WebKit::WebPageInspectorTargetController::disconnectInspector):
2803         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend):
2804         (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend):
2805         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2806         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
2807         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2808         (WebKit::WebPageInspectorTargetFrontendChannel::create):
2809         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
2810         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
2811         Preparation for more target managment in the WebContentProcess.
2812
2813 2018-11-14  Alex Christensen  <achristensen@webkit.org>
2814
2815         Add SPI to show a safe browsing warning
2816         https://bugs.webkit.org/show_bug.cgi?id=191604
2817
2818         Reviewed by Andy Estes.
2819
2820         Safari has a case where it shows safe browsing warnings for a reason other than being told to by the SafeBrowsing framework.
2821         Because safe browsing is moving to WebKit, we will have Safari call this WebKit SPI in that case.
2822         The warning looks a little different, so I had to change the structure of a SafeBrowsingResult and the location of the string processing,
2823         but the existing behavior is the same as verified by existing unit tests.  I added a unit test to verify behavior of the new SPI.
2824
2825         * SourcesCocoa.txt:
2826         * UIProcess/API/Cocoa/WKWebView.mm:
2827         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
2828         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2829         (+[WKWebView _confirmMalwareSentinel]):
2830         (+[WKWebView _visitUnsafeWebsiteSentinel]):
2831         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2832         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2833         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Removed.
2834         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm.
2835         (WebKit::malwareDetailsBase):
2836         (WebKit::learnMoreURL):
2837         (WebKit::reportAnErrorBase):
2838         (WebKit::localizedProvider):
2839         (WebKit::SafeBrowsingWarning::visitUnsafeWebsiteSentinel):
2840         (WebKit::SafeBrowsingWarning::confirmMalwareSentinel):
2841         (WebKit::replace):
2842         (WebKit::addLinkAndReplace):
2843         (WebKit::reportAnErrorURL):
2844         (WebKit::malwareDetailsURL):
2845         (WebKit::safeBrowsingTitleText):
2846         (WebKit::safeBrowsingWarningText):
2847         (WebKit::safeBrowsingDetailsText):
2848         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
2849         (WebKit::learnMore): Deleted.
2850         (WebKit::SafeBrowsingResult::SafeBrowsingResult): Deleted.
2851         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2852         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2853         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
2854         (-[WKSafeBrowsingWarning addContent]):
2855         (-[WKSafeBrowsingWarning showDetailsClicked]):
2856         (-[WKSafeBrowsingWarning clickedOnLink:]):
2857         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
2858         (confirmMalwareSentinel): Deleted.
2859         (visitUnsafeWebsiteSentinel): Deleted.
2860         (replace): Deleted.
2861         (addLinkAndReplace): Deleted.
2862         (reportAnErrorURL): Deleted.
2863         (malwareDetailsURL): Deleted.
2864         (titleText): Deleted.
2865         (warningText): Deleted.
2866         (detailsText): Deleted.
2867         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]): Deleted.
2868         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2869         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2870         * UIProcess/Cocoa/WebViewImpl.h:
2871         * UIProcess/Cocoa/WebViewImpl.mm:
2872         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2873         * UIProcess/PageClient.h:
2874         (WebKit::PageClient::showSafeBrowsingWarning):
2875         * UIProcess/SafeBrowsingResult.h: Removed.
2876         * UIProcess/SafeBrowsingWarning.h: Copied from Source/WebKit/UIProcess/SafeBrowsingResult.h.
2877         (WebKit::SafeBrowsingWarning::create):
2878         (WebKit::SafeBrowsingWarning::title const):
2879         (WebKit::SafeBrowsingWarning::warning const):
2880         (WebKit::SafeBrowsingWarning::details const):
2881         (WebKit::SafeBrowsingResult::create): Deleted.
2882         (WebKit::SafeBrowsingResult::isPhishing const): Deleted.
2883         (WebKit::SafeBrowsingResult::isMalware const): Deleted.
2884         (WebKit::SafeBrowsingResult::isUnwantedSoftware const): Deleted.
2885         (WebKit::SafeBrowsingResult::url const): Deleted.
2886         (WebKit::SafeBrowsingResult::provider const): Deleted.
2887         (WebKit::SafeBrowsingResult::localizedProviderName const): Deleted.
2888         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const): Deleted.
2889         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const): Deleted.
2890         (WebKit::SafeBrowsingResult::learnMoreURL const): Deleted.
2891         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const): Deleted.
2892         (): Deleted.
2893         * UIProcess/WebFramePolicyListenerProxy.cpp:
2894         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
2895         (WebKit::WebFramePolicyListenerProxy::use):
2896         * UIProcess/WebFramePolicyListenerProxy.h:
2897         * UIProcess/WebFrameProxy.cpp:
2898         (WebKit::WebFrameProxy::WebFrameProxy):
2899         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2900         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
2901         * UIProcess/WebFrameProxy.h:
2902         (WebKit::WebFrameProxy::create):
2903         (WebKit::WebFrameProxy::page const):
2904         * UIProcess/WebPageProxy.cpp:
2905         (WebKit::WebPageProxy::swapToWebProcess):
2906         (WebKit::WebPageProxy::didCreateMainFrame):
2907         (WebKit::WebPageProxy::didCreateSubframe):
2908         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2909         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2910         (WebKit::WebPageProxy::decidePolicyForResponse):
2911         * UIProcess/ios/PageClientImplIOS.h:
2912         * UIProcess/ios/PageClientImplIOS.mm:
2913         (WebKit::PageClientImpl::showSafeBrowsingWarning):
2914         * UIProcess/mac/PageClientImplMac.h:
2915         * UIProcess/mac/PageClientImplMac.mm:
2916         (WebKit::PageClientImpl::showSafeBrowsingWarning):
2917         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2918         * WebKit.xcodeproj/project.pbxproj:
2919
2920 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2921
2922         [iOS] A few drag and drop tests are crashing after r238146
2923         https://bugs.webkit.org/show_bug.cgi?id=191617
2924
2925         Reviewed by Dean Jackson.
2926
2927         The notion of temporarily suppressing the selection assistant was introduced during iOS drag and drop
2928         development as a way of allowing both the selection view and dropped content snapshot to fade in simultaneously
2929         during a drop in an editable element. r238146 piggy-backs on this mechanism by changing selection suppression
2930         state when an element is focused, when the selection changes, and when an element is blurred, depending on
2931         whether the currently focused element is transparent.
2932
2933         However, in the case where the selection assistant is suppressed due to a running drop animation, if focus moves
2934         to an element that is not fully transparent, we end up prematurely unsuppressing the text selection assistant.
2935         This subsequently causes selection UI to immediately show up after a drop instead of animating in alongside a
2936         snapshot of the inserted document fragment, if the drop moved focus to an editable element.
2937
2938         A number of drag and drop tests on iOS exercised this codepath by dragging content into editable fields and/or
2939         moving content between editable elements in a web view. These tests began to crash due to selection views and
2940         the accompanying callout bar appearing earlier than usual, which triggers an unrelated UIKit assertion in
2941         <https://webkit.org/b/190401>.
2942
2943         This patch fixes the failing tests by refactoring our selection assistant suppression code. Instead of
2944         maintaining a single `BOOL` flag indicating whether the selection is suppressed, we use an `OptionSet` of
2945         `SuppressSelectionAssistantReason`s, which (at the moment) only include (1) a running drop animation, and (2)
2946         focusing a transparent element. The text selection assistant is considered suppressed when either of the reasons
2947         apply. This allows us to correctly handle a drop animation that occurs simultaneously as an element is focused
2948         without unsuppressing the selection assistant early, and also allows us to handle selection assistant
2949         suppression in more nuanced ways, depending on the suppression reason.
2950
2951         * UIProcess/ios/WKContentViewInteraction.h:
2952         * UIProcess/ios/WKContentViewInteraction.mm:
2953         (-[WKContentView cleanupInteraction]):
2954         (-[WKContentView _displayFormNodeInputView]):
2955
2956         Only prevent zooming to the focused element during drop if we're suppressing the selection assistant due to
2957         focusing a transparent element. In the case of a drop, we still want to allow scrolling and zooming.
2958
2959         (-[WKContentView canShowNonEmptySelectionView]):
2960         (-[WKContentView hasSelectablePositionAtPoint:]):
2961         (-[WKContentView pointIsNearMarkedText:]):
2962         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2963         (-[WKContentView _startAssistingKeyboard]):
2964         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2965         (-[WKContentView _stopAssistingNode]):
2966         (-[WKContentView _updateChangedSelection:]):
2967         (-[WKContentView _shouldSuppressSelectionCommands]):
2968         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
2969         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
2970
2971         Add helper methods for adding or removing selection assistant suppression reasons. When the last selection
2972         assistant suppression reason is removed, we activate the selection assistant, and conversely, when the first
2973         suppression reason is added, we deactivate the selection assistant.
2974
2975         (-[WKContentView _didConcludeEditDataInteraction:]):
2976         (-[WKContentView _didPerformDragOperation:]):
2977         (-[WKContentView dropInteraction:performDrop:]):
2978         (-[WKContentView suppressAssistantSelectionView]): Deleted.
2979         (-[WKContentView setSuppressAssistantSelectionView:]): Deleted.
2980
2981 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2982
2983         [Cocoa] [WebKit2] Hook up some more editing actions (-_pasteAndMatchStyle:, -makeTextWritingDirectionNatural:)
2984         https://bugs.webkit.org/show_bug.cgi?id=191605
2985         <rdar://problem/45813991>
2986
2987         Reviewed by Dean Jackson.
2988
2989         Hook up a couple of editing actions on iOS and macOS. The `-pasteAndMatchStyle:` selector is privately declared
2990         in UIKit, but does not exist on macOS; as such, add `-_pasteAndMatchStyle:` as SPI on WKWebView, and
2991         additionally implement the unprefixed version, `-pasteAndMatchStyle:`, on iOS.
2992
2993         Since `-makeTextWritingDirectionNatural:` is already declared on both iOS and macOS (SPI on UIResponder and API
2994         on macOS, respectively) we simply implement the unprefixed variant on both platforms.
2995
2996         * Platform/spi/ios/UIKitSPI.h:
2997         * UIProcess/API/Cocoa/WKWebView.mm:
2998         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2999         * UIProcess/ios/WKContentViewInteraction.h:
3000         * UIProcess/ios/WKContentViewInteraction.mm:
3001         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
3002         (-[WKContentView canPerformActionForWebView:withSender:]):
3003
3004 2018-11-14  Per Arne Vollan  <pvollan@apple.com>
3005
3006         REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
3007         https://bugs.webkit.org/show_bug.cgi?id=190884
3008
3009         Reviewed by Dean Jackson.
3010
3011         Since the Web page currently owns the display link on the UI process side, the display link will be
3012         deleted in the UI process when a Web page is closed. This is incorrect, since a display link can be
3013         reused between Web pages in the WebContent process. This patch moves the ownership of the UI process
3014         display links to the Web process object to address this issue. Also, the display ID of the display
3015         being updated is included in the message to the WebContent process.
3016
3017         * UIProcess/WebPageProxy.cpp:
3018         (WebKit::WebPageProxy::close):
3019         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3020         * UIProcess/WebPageProxy.h:
3021         * UIProcess/WebPageProxy.messages.in:
3022         * UIProcess/WebProcessProxy.h:
3023         * UIProcess/WebProcessProxy.messages.in:
3024         * UIProcess/mac/DisplayLink.cpp:
3025         (WebKit::DisplayLink::DisplayLink):
3026         (WebKit::DisplayLink::displayLinkCallback):
3027         * UIProcess/mac/DisplayLink.h:
3028         (WebKit::DisplayLink::displayID const):
3029         * UIProcess/mac/WebPageProxyMac.mm:
3030         (WebKit::WebPageProxy::startDisplayLink): Deleted.
3031         (WebKit::WebPageProxy::stopDisplayLink): Deleted.
3032         * UIProcess/mac/WebProcessProxyMac.mm:
3033         (WebKit::WebProcessProxy::startDisplayLink):
3034         (WebKit::WebProcessProxy::stopDisplayLink):
3035         * WebProcess/WebPage/DrawingArea.h:
3036         * WebProcess/WebPage/DrawingArea.messages.in:
3037         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
3038         (WebKit::DisplayRefreshMonitorMac::create):
3039         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
3040         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
3041         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
3042         (WebKit::DrawingArea::createDisplayRefreshMonitor):
3043         (WebKit::DrawingArea::displayWasRefreshed): Deleted.
3044         * WebProcess/WebProcess.h:
3045         * WebProcess/WebProcess.messages.in:
3046         * WebProcess/cocoa/WebProcessCocoa.mm:
3047         (WebKit::WebProcess::displayWasRefreshed):
3048
3049 2018-11-14  Chris Dumez  <cdumez@apple.com>
3050
3051         Client should be able to disable PSON even if the experimental feature is on by default
3052         https://bugs.webkit.org/show_bug.cgi?id=191634
3053
3054         Reviewed by Dean Jackson.
3055
3056         Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
3057         when the experimental is enabled, use a separate flag to store this information. If the client
3058         explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
3059         the client's request, otherwise, we fall back to using the state from experimental features.
3060
3061         This allows:
3062         - API tests to explicitely disable PSON / Process prewarming even if those are on by default
3063           in experimental features.
3064         - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
3065           then the experimental feature flag still fully controls the feature.
3066
3067         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3068         (API::ProcessPoolConfiguration::copy):
3069         * UIProcess/API/APIProcessPoolConfiguration.h:
3070         * UIProcess/WebProcessPool.cpp:
3071         (WebKit::WebProcessPool::createWebPage):
3072
3073 2018-11-14  Chris Dumez  <cdumez@apple.com>
3074
3075         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
3076         https://bugs.webkit.org/show_bug.cgi?id=191602
3077
3078         Reviewed by Alex Christensen.
3079
3080         Add support for process swapping for a [WKWebView loadHTML:] load by storing
3081         the necessary data on the API::Navigation and doing a loadData() instead of
3082         a loadRequest() after process swapping when this data is present on the
3083         navigation.
3084
3085         * UIProcess/API/APINavigation.cpp:
3086         (API::Navigation::Navigation):
3087         * UIProcess/API/APINavigation.h:
3088         (API::Navigation::create):
3089         (API::Navigation::substituteData const):
3090         * UIProcess/WebNavigationState.cpp:
3091         (WebKit::WebNavigationState::createLoadDataNavigation):
3092         * UIProcess/WebNavigationState.h:
3093         * UIProcess/WebPageProxy.cpp:
3094         (WebKit::WebPageProxy::loadData):
3095         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3096
3097 2018-11-14  Antti Koivisto  <antti@apple.com>
3098
3099         Align Mac WK2 layer flush throttling with iOS
3100         https://bugs.webkit.org/show_bug.cgi?id=191632
3101
3102         Reviewed by Zalan Bujtas.
3103
3104         Currently Mac WK2 uses WebCore side throttling implementation in RenderLayerCompositor. This code has
3105         throttling timer per-frame while the actual decision making and layer flushes itself are per page. These
3106         timers generate way more flushes than expected in presence of multiple frames. There are also bugs in how
3107         flushing state is updated when frames are created dynamically.
3108
3109         On iOS WK2 throttling is implemented on WebKit side and controlled by a per-page timer. Recent fixes also
3110         make this implementation visually fast. We should align the Mac implementation and eventually unify them.
3111
3112         This patch implements throttling in TiledCoreAnimationDrawingArea mirroring the iOS RemoteLayerTreeDrawingArea
3113         implementation. There are some adjustments for platform differences (local vs remote layers) and we continue
3114         using runloop observer for the actual flushes. Timings are as in the existing Mac code.
3115
3116         The patch appears to be a significant performance progression.
3117
3118         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3119         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3120         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3121         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
3122
3123         Schedule an immediate flush when layers are unfrozen.
3124
3125         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
3126         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
3127
3128         Track pending flushes with m_hasPendingFlush bit.
3129         Delay flush if the flush throttling timer is active. Start it if we throttling but it is not active yet.
3130
3131         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3132
3133         Clear m_hasPendingFlush if the flush succeeded.
3134         Restart the throttling timer if we are still throttling.
3135         Manage runloop observer invalidation here instead of the caller (and stop returning value).
3136
3137         (WebKit::TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback):
3138         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
3139
3140         Returning 'true' here disables WebCore side throttling code.
3141
3142         Start or stop the throttling timer on state changes.
3143
3144         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingIsActive const):
3145
3146         This is used to control style and layout timers on WebCore side. Return false on frozen
3147         state since unfreezing depends on style and layout.
3148
3149         (WebKit::TiledCoreAnimationDrawingArea::startLayerFlushThrottlingTimer):
3150         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
3151
3152 2018-11-14  Chris Dumez  <cdumez@apple.com>
3153
3154         WebKit.WKHTTPCookieStoreWithoutProcessPool API test is failing with process prewarming is enabled
3155         https://bugs.webkit.org/show_bug.cgi?id=191624
3156
3157         Reviewed by Alex Christensen.
3158
3159         Stop setting the WebProcessPool's primary data store (m_websiteDataStore) to the default one in
3160         WebProcessPool::prewarmProcess(). We did not really need to, we can pass the default data store
3161         to the new WebPageProxy without having to set m_websiteDataStore. m_websiteDataStore only gets
3162         set upon constructor if thr default data store already exists or later on when creating a WebPage
3163         that uses the default data store.
3164
3165         In the case of the API test, the following was happening:
3166         1. Create an ephemeral data store EDS
3167         2. Create a WebView V1 using datastore EDS
3168         3. Do a load in V1
3169         4. Process prewarming would kick in and wrongly associated V1's process pool PP1 with the default data store
3170         5. Create/Get the default datastore and set a few cookies on it
3171         6. Create a WebView V2 using default datastore and a fresh new process pool PP2
3172         7. Do a load in V2 and expect the cookies to be there
3173
3174         In HTTPCookieStore::setCookie() that is called at step 5, we call:
3175         m_owningDataStore->processPoolForCookieStorageOperations()
3176
3177         In this case, m_owningDataStore is the default datastore and this call would previously return null because
3178         there is no WebProcessPool yet associated with the default datastore. However, with the process prewarming
3179         bug at step 4, the process pool PP1 would be returned since it was wrongly associated with the default
3180         data store. As a result, we would call setCookie() on PP1's WebCookieManagerProxy and this would fail
3181         because PP1's network process knows nothing about this session ID (it was only ever used with an ephemeral
3182         session).
3183
3184         * UIProcess/WebProcessPool.cpp:
3185         (WebKit::WebProcessPool::prewarmProcess):
3186
3187 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
3188
3189         [WebAuthN] Support CTAP HID authenticators on macOS
3190         https://bugs.webkit.org/show_bug.cgi?id=188623
3191         <rdar://problem/43353777>
3192
3193         Reviewed by Brent Fulgham and Chris Dumez.
3194
3195         This patch introduces a primitive support of CTAP HID authenticators for WebAuthN in macOS.
3196         It involves low level HID device management&communication, high level CTAP HID authenticator
3197         management&communication, and mock testing. The above three aspects will be covered in details:
3198         1) Low level HID device management&communication: HidService&HidConnection
3199         It relies on IOHIDManager to discover appropriate hid devices by passing a matching dictionary:
3200         { PrimaryUsagePage: 0xf1d0, PrimaryUsage: 0x01}. For communication, it utilizes HID reports.
3201         To send a report, it calls IOHIDDeviceSetReport since the async version is not implemented.
3202         To recieve a report, it calls IOHIDDeviceRegisterInputReportCallback to asynchronously wait
3203         for incoming reports.
3204         Here is the corresponding reference:
3205         https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW2
3206         2) High level CTAP HID authenticator management&communication: HidService&CtapHidDriver
3207         Whenever an appropriate hid device is discovered by IOHIDManager, an AuthenticatorGetInfo command
3208         is sent to the device to determine properties of the authenticator, says, which version of protocol
3209         it supports, i.e. CTAP or U2F. So far, we only support CTAP authenticators. Once the authenticator
3210         is determined to support CTAP, we then instantiate CtapHidAuthenticator which will then take care
3211         of even higher level WebAuthN requests&responses.
3212         Binaries are constructed and packaged according to the CTAP HID porotocol. CtapHidDriver takes care
3213         of concurrency and channels, i.e. allocating channel and establishing the actual request/response
3214         transaction. At the meantime, CtapHidDriver::Worker is then responsible for each single transaction.
3215         Here is the corresponding reference:
3216         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb.
3217         3) Mock Testing: MockHidService & MockHidConnection
3218         A CTAP hid authenticator is simulated within MockHidConnection with options of specifying specific
3219         error scenarios and of course could take care of successful cases. Four stages are presented in the
3220         simulated authenticator to reflect: a) allocating channel for AuthenticatorGetInfo, b) sending
3221         AuthenticatorGetInfo, c) allocating channel for actual request, and d) sending the actual request.
3222
3223         Besides implementing the above, it also does a few other things:
3224         1) Make AuthenticatorManager::clearState asynchronous to avoid cyclic dependency:
3225         Authenticator::returnResponse => AuthenticatorManager::respondReceived => AuthenticatorManager::clearState
3226         => Authenticator::~Authenticator.
3227         2) Reorganize unified build sources to make it clear that which files are .mm and which are .cpp.
3228         3) Import LocalAuthentication.framework in LocalAuthenticationSoftLink instead of being scattered.
3229
3230         * Sources.txt:
3231         * SourcesCocoa.txt:
3232         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3233         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3234         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3235         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3236         (WebKit::AuthenticatorManagerInternal::collectTransports):
3237         (WebKit::AuthenticatorManager::clearStateAsync):
3238         (WebKit::AuthenticatorManager::respondReceived):
3239         (WebKit::AuthenticatorManager::initTimeOutTimer):
3240         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3241         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
3242         (WebKit::AuthenticatorTransportService::create):
3243         (WebKit::AuthenticatorTransportService::createMock):
3244         (WebKit::AuthenticatorTransportService::startDiscovery):
3245         (WebKit::AuthenticatorTransportService::startDiscovery const): Deleted.
3246         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
3247         * UIProcess/WebAuthentication/Cocoa/HidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h.
3248         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: Added.
3249         (WebKit::reportReceived):
3250         (WebKit::HidConnection::HidConnection):
3251         (WebKit::HidConnection::~HidConnection):
3252         (WebKit::HidConnection::initialize):
3253         (WebKit::HidConnection::terminate):
3254         (WebKit::HidConnection::send):
3255         (WebKit::HidConnection::registerDataReceivedCallback):
3256         (WebKit::HidConnection::unregisterDataReceivedCallback):
3257         (WebKit::HidConnection::receiveReport):
3258         (WebKit::HidConnection::consumeReports):
3259         (WebKit::HidConnection::registerDataReceivedCallbackInternal):
3260         * UIProcess/WebAuthentication/Cocoa/HidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3261         * UIProcess/WebAuthentication/Cocoa/HidService.mm: Added.
3262         (WebKit::deviceAddedCallback):
3263         (WebKit::deviceRemovedCallback):
3264         (WebKit::HidService::HidService):
3265         (WebKit::HidService::~HidService):
3266         (WebKit::HidService::startDiscoveryInternal):
3267         (WebKit::HidService::platformStartDiscovery):
3268         (WebKit::HidService::createHidConnection const):
3269         (WebKit::HidService::deviceAdded):
3270         (WebKit::HidService::continueAddDeviceAfterGetInfo):
3271         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
3272         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3273         * UIProcess/WebAuthentication/Cocoa/LocalService.h:
3274         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
3275         (WebKit::LocalService::startDiscoveryInternal):
3276         (WebKit::LocalService::startDiscoveryInternal const): Deleted.
3277         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
3278         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3279         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: Added.
3280         (WebKit::MockHidConnection::MockHidConnection):
3281         (WebKit::MockHidConnection::initialize):
3282         (WebKit::MockHidConnection::terminate):
3283         (WebKit::MockHidConnection::send):
3284         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
3285         (WebKit::MockHidConnection::assembleRequest):
3286         (WebKit::MockHidConnection::parseRequest):
3287         (WebKit::MockHidConnection::feedReports):
3288         (WebKit::MockHidConnection::stagesMatch const):
3289         (WebKit::MockHidConnection::shouldContinueFeedReports):
3290         (WebKit::MockHidConnection::continueFeedReports):
3291         * UIProcess/WebAuthentication/Mock/MockHidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3292         * UIProcess/WebAuthentication/Mock/MockHidService.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3293         (WebKit::MockHidService::MockHidService):
3294         (WebKit::MockHidService::platformStartDiscovery):
3295         (WebKit::MockHidService::createHidConnection const):
3296         * UIProcess/WebAuthentication/Mock/MockHidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3297         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
3298         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3299         * UIProcess/WebAuthentication/Mock/MockLocalService.mm: Renamed from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3300         (WebKit::MockLocalService::MockLocalService):
3301         (WebKit::MockLocalService::platformStartDiscovery const):
3302         (WebKit::MockLocalService::createLocalConnection const):
3303         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3304         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: Added.
3305         (WebKit::CtapHidAuthenticator::CtapHidAuthenticator):
3306         (WebKit::CtapHidAuthenticator::makeCredential):
3307         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
3308         (WebKit::CtapHidAuthenticator::getAssertion):
3309         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const):
3310         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3311         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: Added.
3312         (WebKit::CtapHidDriver::Worker::Worker):
3313         (WebKit::CtapHidDriver::Worker::~Worker):
3314         (WebKit::CtapHidDriver::Worker::transact):
3315         (WebKit::CtapHidDriver::Worker::write):
3316         (WebKit::CtapHidDriver::Worker::read):
3317         (WebKit::CtapHidDriver::Worker::returnMessage):
3318         (WebKit::CtapHidDriver::CtapHidDriver):
3319         (WebKit::CtapHidDriver::transact):
3320         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3321         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3322         (WebKit::CtapHidDriver::returnResponse):
3323         * UIProcess/WebAuthentication/fido/CtapHidDriver.h: Added.
3324         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3325         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3326         * WebKit.xcodeproj/project.pbxproj:
3327
3328 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3329
3330         Unreviewed correction to previous build fix to avoid any internal/downstream repercussions.
3331
3332         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3333
3334 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3335
3336         Unreviewed GTK/WPE build fix for r238159. 
3337
3338         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3339
3340 2018-11-13  Timothy Hatcher  <timothy@apple.com>
3341
3342         Use a light scrollbar for transparent web views in dark mode.
3343         https://bugs.webkit.org/show_bug.cgi?id=191559
3344         rdar://problem/46000489
3345
3346         Reviewed by Dean Jackson.
3347
3348         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3349         (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance().
3350         * WebProcess/WebPage/WebPage.cpp:
3351         (WebKit::WebPage::drawRect): Ditto.
3352
3353 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3354
3355         [iOS] Do not show selection UI for editable elements with opacity near zero
3356         https://bugs.webkit.org/show_bug.cgi?id=191442
3357         <rdar://problem/45958625>
3358
3359         Reviewed by Simon Fraser.
3360
3361         Add support for suppressing native selection UI (for instance, selection highlight views, selection handles, and
3362         selection-related gestures) when the selection is inside a transparent editable element. This helps maintain
3363         compatibility with text editors that work by capturing key events and input events hidden contenteditable
3364         elements, and reflect these changes in different document or different part of the document.
3365
3366         Since selection UI is rendered in the UI process on iOS using element geometry propagated from the web process,
3367         selection rendering is entirely decoupled from the process of painting in the web process. This means that if
3368         the editable root has an opacity of 0, we would correctly hide the caret and selection on macOS, but draw over
3369         the transparent element on iOS. When these hidden editable elements are focused, this often results in unwanted
3370         behaviors, such as double caret painting, native and custom selection UI from the page being drawn on top of one
3371         another, and the ability to change selection via tap and loupe gestures within hidden text.
3372
3373         To fix this, we compute whether the focused element is transparent when an element is focused, or when the
3374         selection changes, and send this information over to the UI process via `AssistedNodeInformation` and
3375         `EditorState`. In the UI process, we then respect this information by suppressing the selection assistant if the
3376         focused element is transparent; this disables showing and laying out selection views, as well as gestures
3377         associated with selection overlays. However, this still allows for contextual autocorrection and spell checking.
3378
3379         * Shared/AssistedNodeInformation.cpp:
3380         (WebKit::AssistedNodeInformation::encode const):
3381         (WebKit::AssistedNodeInformation::decode):
3382         * Shared/AssistedNodeInformation.h:
3383         * Shared/EditorState.cpp:
3384         (WebKit::EditorState::PostLayoutData::encode const):
3385         (WebKit::EditorState::PostLayoutData::decode):
3386         * Shared/EditorState.h:
3387
3388         Add `elementIsTransparent` flags, and also add boilerplate IPC code.
3389
3390         * UIProcess/ios/WKContentViewInteraction.mm:
3391         (-[WKContentView _displayFormNodeInputView]):
3392
3393         Prevent zooming to the focused element if the focused element is hidden.
3394
3395         (-[WKContentView hasSelectablePositionAtPoint:]):
3396         (-[WKContentView pointIsNearMarkedText:]):
3397         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3398
3399         Don't allow these text interaction gestures to begin while suppressing the selection&n