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