Web Inspector: Network: add button to show system certificate dialog
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-11-17  Devin Rousso  <drousso@apple.com>
2
3         Web Inspector: Network: add button to show system certificate dialog
4         https://bugs.webkit.org/show_bug.cgi?id=191458
5         <rdar://problem/45977019>
6
7         Reviewed by Joseph Pecoraro.
8
9         * UIProcess/WebInspectorProxy.messages.in:
10         * UIProcess/WebInspectorProxy.h:
11         * UIProcess/WebInspectorProxy.cpp:
12         (WebKit::WebInspectorProxy::showCertificate): Added.
13         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
14         * UIProcess/mac/WebInspectorProxyGtk.cpp:
15         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
16         * UIProcess/mac/WebInspectorProxyMac.mm:
17         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
18         * UIProcess/mac/WebInspectorProxyWPE.cpp:
19         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
20         * UIProcess/mac/WebInspectorProxyWin.cpp:
21         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
22         * WebProcess/WebPage/WebInspectorUI.h:
23         * WebProcess/WebPage/WebInspectorUI.cpp:
24         (WebKit::WebInspectorUI::showCertificate): Added.
25
26         * UIProcess/RemoteWebInspectorProxy.messages.in:
27         * UIProcess/RemoteWebInspectorProxy.h:
28         * UIProcess/RemoteWebInspectorProxy.cpp:
29         (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
30         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
31         * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
32         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
33         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
34         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
35         * WebProcess/WebPage/RemoteWebInspectorUI.h:
36         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
37         (WebKit::RemoteWebInspectorUI::showCertificate): Added.
38
39         * NetworkProcess/cache/NetworkCacheCoders.h:
40         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
41         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
42         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
43         Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
44         respective platform's CertificateInfo.h file.
45
46         * UIProcess/Authentication/mac/WebCredentialMac.mm:
47
48         * Configurations/WebKit.xcconfig:
49         * PlatformMac.cmake:
50         * PlatformWin.cmake:
51         * SourcesCocoa.txt:
52         * SourcesGTK.txt:
53         * SourcesWPE.txt:
54         * WebKit.xcodeproj/project.pbxproj:
55
56 2018-11-16  Chris Dumez  <cdumez@apple.com>
57
58         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
59         https://bugs.webkit.org/show_bug.cgi?id=191800
60
61         Reviewed by Ryosuke Niwa.
62
63         Make sure the NetworkProcessProxy destructor calls its remaining m_pendingConnectionReplies
64         completion handlers to avoid hitting an assertion in the CompletionHandler destructor.
65
66         Prewarmed WebProcess do not keep the ProcessPool alive and thus not the NetworkProcessProxy
67         either. As a result, it is possible for NetworkProcessProxy to have pending connection
68         requests from those prewarmed processes when it is destroyed. Similar story for the
69         suspended page processes when they are destroyed.
70
71         * UIProcess/Network/NetworkProcessProxy.cpp:
72         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
73
74 2018-11-16  Alex Christensen  <achristensen@webkit.org>
75
76         Tweak _showSafeBrowsingWarningWithTitle SPI
77         https://bugs.webkit.org/show_bug.cgi?id=191799
78
79         Reviewed by Wenson Hsieh.
80
81         * UIProcess/API/Cocoa/WKWebView.mm:
82         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
83         (+[WKWebView _visitUnsafeWebsiteSentinel]):
84         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
85         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
86         (-[WKSafeBrowsingWarning clickedOnLink:]):
87         I need to localize "Continue" and "Cancel" so they aren't always in English.
88
89 2018-11-16  Chris Dumez  <cdumez@apple.com>
90
91         WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView API test is crashing in debug
92         https://bugs.webkit.org/show_bug.cgi?id=191797
93
94         Reviewed by Ryosuke Niwa.
95
96         We were hitting the assertion because the error handler was first getting called. It would
97         deallocate the send right, cancel/null out the XPC connection and call
98         didFinishLaunchingProcess(0, IPC::Connection::Identifier()).
99
100         Then the xpc_connection_send_message_with_reply() block would get called later and
101         would try to deallocate the send right again, and call
102         didFinishLaunchingProcess(0, IPC::Connection::Identifier()) again because the xpc
103         connection is null.
104
105         Handle this case by having the xpc_connection_send_message_with_reply() block check
106         that we're still launching (i.e. didFinishLaunchingProcess() has not been called
107         yet).
108
109         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
110         (WebKit::ProcessLauncher::launchProcess):
111
112 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
113
114         Unreviewed follow-up to r238330.
115
116         * UIProcess/WebPageProxy.cpp:
117         (WebKit::WebPageProxy::close):
118         Don't clear the pointer after invalidating since the pointer is
119         used later one. We don't mind it being used after invalidation
120         it will do the right thing, we'd rather have the WebInspectorProxy
121         lifetime match the WebPageProxy.
122
123 2018-11-16  Chris Dumez  <cdumez@apple.com>
124
125         ProcessSwap.NavigationWithLockedHistoryWithoutPSON API test is a flaky crash in debug
126         https://bugs.webkit.org/show_bug.cgi?id=191795
127
128         Reviewed by Alex Christensen.
129
130         If the WebProcessPool is getting destroyed while there is a prewarmed WebContent process
131         that is awaiting its connnection to the network process, then we'll hit the
132         process->hasOneRef() assertion in the WebProcessPool destructor. This is because
133         NetworkProcessProxy::m_pendingConnectionReplies keeps a RefPtr to the WebProcessProxy
134         that is awaiting the connection. The NetworkProcessProxy does not really need to keep
135         the WebProcessProxy alive in this case so this patch switches to using a WeakPtr instead.
136
137         * UIProcess/Network/NetworkProcessProxy.cpp:
138         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
139         (WebKit::NetworkProcessProxy::networkProcessCrashed):
140         * UIProcess/Network/NetworkProcessProxy.h:
141         * UIProcess/WebProcessProxy.h:
142
143 2018-11-16  Chris Dumez  <cdumez@apple.com>
144
145         [macOS] Label "prewarmed" WebContent processes in Activity Monitor
146         https://bugs.webkit.org/show_bug.cgi?id=191765
147         <rdar://problem/45953463>
148
149         Reviewed by Geoffrey Garen.
150
151         Label "prewarmed" WebContent processes in Activity Monitor to facilitate debugging.
152
153         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
154         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
155         * UIProcess/WebProcessProxy.cpp:
156         (WebKit::WebProcessProxy::getLaunchOptions):
157         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
158         * WebProcess/WebProcess.cpp:
159         (WebKit::WebProcess::markIsNoLongerPrewarmed):
160         * WebProcess/WebProcess.h:
161         * WebProcess/WebProcess.messages.in:
162         * WebProcess/cocoa/WebProcessCocoa.mm:
163         (WebKit::WebProcess::initializeProcessName):
164         (WebKit::WebProcess::updateProcessName):
165         (WebKit::WebProcess::platformInitializeProcess):
166
167 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
168
169         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
170         https://bugs.webkit.org/show_bug.cgi?id=191740
171         <rdar://problem/45470897>
172
173         Reviewed by Timothy Hatcher.
174
175         When a web page asks to open a local Web Inspector, that inspector
176         will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
177         instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
178
179         Previously a WebInspectorProxy was re-created every time the WebPageProxy's
180         WebPage / WebProcess was changed, effectively closing the Web Inspector
181         frontend when the WebPage was swapped or crashed.
182
183         This change keeps the WebInspectorProxy alive as long as the WebPageProxy
184         is alive. During process swaps, or process crashes, the WebInspectorProxy
185         is reset when the page is reset and updated when the page's WebProcess
186         changes. Since WebInspectorProxy owns the Web Inspector view / window
187         the Web Inspector window can be kept alive across (and attached state)
188         across WebPage / WebProcess changes.
189
190         Previously the WebContentProcess's WebKit::WebInspector was the Local
191         FrontendChannel for the WebCore::InspectorController. This can't
192         outlive the single WebContentProcess.
193
194         This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
195         for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
196         now stays alive alongside the WebPageProxy this will live across process changes.
197         This means that the WebInspectorUI process must send its backend messages to
198         the WebInspectorProxy -> WebPageInspectorController now instead of the
199         old path WebInspector -> WebCore::InspectorController.
200
201         A direct IPC connection is still maintained between the WebContentProcess's
202         WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
203         this connection was established by WebKit::WebInspector vending an
204         IPC::Attachment to the WebInspectorUI process. This patch inverts that
205         relationship, because the WebInspectorUI process now lives across multiple
206         WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
207         to the WebContentProcess each time the process changes. This way they can both
208         still communicate through normal Messages::WebInspector/WebInspectorUI
209         messages and everything behaves as previously expected.
210
211         * Scripts/webkit/messages.py:
212         Header for Inspector::FrontendChannel::ConnectionType.
213
214         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
215         (WebKit::WebInspectorClient::openLocalFrontend):
216         * WebProcess/WebPage/WebInspector.cpp:
217         (WebKit::WebInspector::openLocalInspectorFrontend):
218         (WebKit::WebInspector::setFrontendConnection):
219         (WebKit::WebInspector::closeFrontendConnection):
220         (WebKit::WebInspector::close):
221         (WebKit::WebInspector::openFrontendConnection): Deleted.
222         (WebKit::WebInspector::sendMessageToBackend): Deleted.
223         (WebKit::WebInspector::sendMessageToFrontend): Deleted.
224         On the WebProcess side we ask the UIProcess to open a local frontend and now
225         receive instead of vend an IPC connection to the WebInspectorUI process.
226
227         * UIProcess/WebPageProxy.cpp:
228         (WebKit::WebPageProxy::finishAttachingToWebProcess):
229         (WebKit::WebPageProxy::close):
230         (WebKit::WebPageProxy::resetState):
231         Keep the WebInspectorProxy alive alongside the WebPageProxy.
232         Update it as processes / states change.
233
234         * UIProcess/WebInspectorProxy.h:
235         * UIProcess/WebInspectorProxy.messages.in:
236         * UIProcess/WebInspectorProxy.cpp:
237         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
238         (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
239         (WebKit::WebInspectorProxy::sendMessageToFrontend):
240         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
241         Open and close a local frontend by being the FrontendChannel on the UIProcess side.
242
243         (WebKit::WebInspectorProxy::sendMessageToBackend):
244         Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
245         now that the InspectorController is here instead of in the WebProcess.
246
247         (WebKit::WebInspectorProxy::setFrontendConnection):
248         Transfer the WebProcess <-> InspectorProcess IPC connection through us
249         because we are the one link between them when processes change.
250
251         (WebKit::WebInspectorProxy::invalidate):
252         (WebKit::WebInspectorProxy::frontendLoaded):
253         Be safer and handle inspectedPage being potentially null.
254
255         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
256         (WebKit::WebPageInspectorTargetController::connectInspector):
257         * WebProcess/WebPage/WebPageInspectorTargetController.h:
258         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
259         (WebKit::WebPageInspectorTargetFrontendChannel::create):
260         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
261         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
262         * UIProcess/InspectorTargetProxy.cpp:
263         (WebKit::InspectorTargetProxy::connect):
264         Proxy the ConnectionType received on the UIProcess side to the WebProcess side
265         when connecting to sub-targets.
266
267         * WebProcess/WebPage/WebPage.cpp:
268         (WebKit::WebPage::connectInspector):
269         (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
270         * WebProcess/WebPage/WebPage.h:
271         * WebProcess/WebPage/WebPage.messages.in:
272         * UIProcess/WebPageProxy.h:
273         (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
274         (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
275         * UIProcess/WebPageProxy.messages.in:
276         * UIProcess/WebProcessPool.cpp:
277         (WebKit::WebProcessPool::processForNavigationInternal):
278         Eliminate the hasLocalInspectorFrontend state that was only used
279         to disable PSON. PSON no longer needs to be disabled for this reason.
280
281         * WebProcess/WebPage/WebInspector.h:
282         * WebProcess/WebPage/WebInspector.messages.in:
283         * WebProcess/WebPage/WebInspectorUI.cpp:
284         (WebKit::WebInspectorUI::establishConnection):
285         (WebKit::WebInspectorUI::updateConnection):
286         (WebKit::WebInspectorUI::closeWindow):
287         (WebKit::WebInspectorUI::sendMessageToBackend):
288         * WebProcess/WebPage/WebInspectorUI.h:
289         * WebProcess/WebPage/WebInspectorUI.messages.in:
290         Vend an IPC connection on demand to the WebProcess side.
291
292 2018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
293
294         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
295         https://bugs.webkit.org/show_bug.cgi?id=191744
296         <rdar://problem/46125461>
297
298         Unreviewed, install the file.
299
300         * PlatformGTK.cmake:
301         * PlatformWPE.cmake:
302
303 2018-11-16  Zalan Bujtas  <zalan@apple.com>
304
305         Add DidFirstMeaningfulPaint milestone.
306         https://bugs.webkit.org/show_bug.cgi?id=191754
307
308         Reviewed by Simon Fraser.
309
310         * Shared/API/c/WKPageLoadTypes.h:
311         * Shared/API/c/WKSharedAPICast.h:
312         (WebKit::toWKLayoutMilestones):
313         (WebKit::toLayoutMilestones):
314         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
315         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
316         (pageRenderingProgressEvents):
317
318 2018-11-16  Chris Dumez  <cdumez@apple.com>
319
320         Automatic process prewarming should be turned on if PSON is enabled via experimental features
321         https://bugs.webkit.org/show_bug.cgi?id=191761
322
323         Reviewed by Ryosuke Niwa.
324
325         m_isAutomaticProcessWarmingEnabledByClient is a std::optional and should not be initialized to
326         true / false until the client calls API to toggle the feature. When m_isAutomaticProcessWarmingEnabledByClient
327         is std::nullopt then m_processSwapsOnNavigationFromExperimentalFeatures controls automatic
328         process prewarming.
329
330         * UIProcess/API/APIProcessPoolConfiguration.h:
331
332 2018-11-16  Alex Christensen  <achristensen@webkit.org>
333
334         Add API to disable safe browsing checks
335         https://bugs.webkit.org/show_bug.cgi?id=191610
336
337         Reviewed by Dean Jackson.
338
339         * UIProcess/API/Cocoa/WKPreferences.h:
340         * UIProcess/API/Cocoa/WKPreferences.mm:
341         (-[WKPreferences setSafeBrowsingEnabled:]):
342         (-[WKPreferences isSafeBrowsingEnabled]):
343         (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
344         (-[WKPreferences _safeBrowsingEnabled]): Deleted.
345         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
346
347 2018-11-16  Chris Dumez  <cdumez@apple.com>
348
349         WebKit.UnavailablePlugIn API test is crashing in debug
350         https://bugs.webkit.org/show_bug.cgi?id=191753
351
352         Reviewed by Alex Christensen.
353
354         Add missing early returns. Those were mistakenly dropped in r235200.
355
356         * UIProcess/Cocoa/NavigationState.mm:
357         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
358
359 2018-11-16  Chris Dumez  <cdumez@apple.com>
360
361         [Mac] Regression: WebContent process's display name is no longer set
362         https://bugs.webkit.org/show_bug.cgi?id=191722
363         <rdar://problem/45960550>
364
365         Reviewed by Per Arne Vollan.
366
367         Make sure The WebContent process calls _RegisterApplication() during initialization and
368         *before* trying to set its display name. Setting the display name fails otherwise.
369
370         * WebProcess/cocoa/WebProcessCocoa.mm:
371         (WebKit::WebProcess::initializeProcessName):
372         (WebKit::WebProcess::platformInitializeProcess):
373
374 2018-11-16  Ryosuke Niwa  <rniwa@webkit.org>
375
376         Enable process swap on cross-site navigation by default on iOS
377         https://bugs.webkit.org/show_bug.cgi?id=191735
378
379         Reviewed by Chris Dumez.
380
381         Enabled the feature.
382
383         * Shared/WebPreferencesDefaultValues.h:
384
385 2018-11-16  Antti Koivisto  <antti@apple.com>
386
387         REGRESSION(r237467) [PSON] iOS: Going back to a page sometimes doesn't restore the full page
388         https://bugs.webkit.org/show_bug.cgi?id=191737
389
390         Reviewed by Simon Fraser.
391
392         * WebProcess/WebPage/WebPage.cpp:
393         (WebKit::WebPage::setLayerTreeStateIsFrozen):
394
395         Layer tree should stay frozen in m_shouldResetDrawingArea state. Otherwise spurious commit transactions may
396         mess up state on UI process side.
397
398         Specifically WKWebView._needsResetViewStateAfterCommitLoadForMainFrame would get stuck to TRUE and prevent
399         all viewport updates because WKWebView._firstPaintAfterCommitLoadTransactionID has value greater
400         than any current transaction IDs.
401
402 2018-11-16  Chris Dumez  <cdumez@apple.com>
403
404         Unreviewed typo fix in comment added in r238250.
405
406         * UIProcess/WebProcessPool.cpp:
407         (WebKit::WebProcessPool::ensureNetworkProcess):
408
409 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
410
411         Storing blobs in IDB on iOS: "Error preparing blob/file"
412         https://bugs.webkit.org/show_bug.cgi?id=188438
413         <rdar://problem/43097279>
414
415         Reviewed by Alex Christensen.
416
417         Grant sandbox extension of temp folder to network process, and clean up some code that managed sandbox extension
418         of IDB temporary blob files in network process.
419
420         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
421         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
422         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
423         (WebKit::WebIDBConnectionToClient::handleGetResult):
424         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
425         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
426         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Deleted.
427         (WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath): Deleted.
428         * NetworkProcess/NetworkConnectionToWebProcess.h:
429         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
430         * NetworkProcess/NetworkProcess.cpp:
431         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
432         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
433         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): Deleted.
434         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): Deleted.
435         * NetworkProcess/NetworkProcess.h:
436         * NetworkProcess/NetworkProcessCreationParameters.cpp:
437         (WebKit::NetworkProcessCreationParameters::encode const):
438         (WebKit::NetworkProcessCreationParameters::decode):
439         * NetworkProcess/NetworkProcessCreationParameters.h:
440         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
441         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
442         * UIProcess/WebProcessPool.cpp:
443         (WebKit::WebProcessPool::ensureNetworkProcess):
444         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
445         (WebKit::WebIDBConnectionToServer::didGetRecord):
446         (WebKit::WebIDBConnectionToServer::didGetAllRecords):
447         (WebKit::WebIDBConnectionToServer::didOpenCursor):
448         (WebKit::WebIDBConnectionToServer::didIterateCursor):
449         (WebKit::preregisterSandboxExtensionsIfNecessary): Deleted.
450
451 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
452
453         Add USE(LIBWPE) to WebCore
454         https://bugs.webkit.org/show_bug.cgi?id=191401
455
456         Reviewed by Michael Catanzaro.
457
458         Rename PlatformDisplayWPE to PlatformDisplayLibWPE.
459
460         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
461         (WebKit::AcceleratedSurfaceWPE::initialize):
462         * WebProcess/wpe/WebProcessMainWPE.cpp:
463
464 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
465
466         [GStreamer][WebRTC] Add API to enable/disable device mocks
467         https://bugs.webkit.org/show_bug.cgi?id=191699
468
469         This basically us to test MediaStream/WebRTC support without
470         requiring cameras or microphones and is quite useful.
471
472         Also fix the GStreamerAudioMock by:
473           - Stop setting `leaky-upstream` on the GStreamerCapturer queue,
474             this was usefull when we were trying to bring the MediaStream
475             sources inside the main pipeline, it is not the case anymore
476             (and not doable with latest version of LibWebRTC).
477           - Use a 'ticks' wave on the gstreamer audiotestsrc so the test
478             stream is similar to what Apple port does.
479
480         Reviewed by Xabier Rodriguez-Calvar.
481
482         The mocks are already tested and the API is really simple.
483
484         * UIProcess/API/glib/WebKitSettings.cpp:
485         (webKitSettingsSetProperty):
486         (webKitSettingsGetProperty):
487         (webkit_settings_class_init):
488         (webkit_settings_get_enable_mock_capture_devices):
489         (webkit_settings_set_enable_mock_capture_devices):
490         * UIProcess/API/gtk/WebKitSettings.h:
491         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
492
493 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
494
495         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
496         https://bugs.webkit.org/show_bug.cgi?id=191744
497
498         It should always have been there.
499
500         Reviewed by Carlos Garcia Campos.
501
502         * UIProcess/API/gtk/webkit2.h:
503
504 2018-11-16  Antoine Quint  <graouts@apple.com>
505
506         PointerEvents should not require touch event listeners to be registered
507         https://bugs.webkit.org/show_bug.cgi?id=191333
508         <rdar://problem/45857523>
509
510         Reviewed by Dean Jackson.
511
512         * UIProcess/WebPageProxy.cpp:
513         (WebKit::WebPageProxy::updateTouchEventTracking):
514         (WebKit::WebPageProxy::touchEventTrackingType const):
515         (WebKit::WebPageProxy::handleTouchEventSynchronously):
516         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
517         (WebKit::WebPageProxy::handleTouchEvent):
518         (WebKit::WebPageProxy::resetState):
519         * UIProcess/WebPageProxy.h:
520
521 2018-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
522
523         WKPreferencesSetFontSmoothingLevel doesn't actually do anything
524         https://bugs.webkit.org/show_bug.cgi?id=191708
525
526         Reviewed by Simon Fraser.
527
528         Delete the symbol because no one calls it and it doesn't do anything
529
530         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
531         * Shared/FontSmoothingLevel.h: Removed.
532         * Shared/WebPreferences.yaml:
533         * UIProcess/API/C/WKAPICast.h:
534         (WebKit::toFontSmoothingLevel): Deleted.
535         * UIProcess/API/C/WKPreferences.cpp:
536         (WKPreferencesSetFontSmoothingLevel): Deleted.
537         (WKPreferencesGetFontSmoothingLevel): Deleted.
538         * UIProcess/API/C/WKPreferencesRefPrivate.h:
539         * UIProcess/WebPreferences.h:
540         * WebKit.xcodeproj/project.pbxproj:
541         * mac/WebKit2.order:
542
543 2018-11-15  Truitt Savell  <tsavell@apple.com>
544
545         Unreviewed, rolling out r238244.
546
547         Caused High Sierra test runs to fail early with 50 crashes and
548         casued 25 API failures.
549
550         Reverted changeset:
551
552         "[css-logical] Implement flow-relative margin, padding and
553         border shorthands"
554         https://bugs.webkit.org/show_bug.cgi?id=188697
555         https://trac.webkit.org/changeset/238244
556
557 2018-11-15  Joseph Pecoraro  <pecoraro@apple.com>
558
559         Web Inspector: Remove unused WebInspectorProxy code
560         https://bugs.webkit.org/show_bug.cgi?id=191674
561
562         Reviewed by Dean Jackson.
563
564         * UIProcess/WebInspectorProxy.cpp:
565         (WebKit::WebInspectorProxy::createInspectorPage):
566         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
567         * UIProcess/WebInspectorProxy.h:
568         * UIProcess/mac/WebInspectorProxyMac.mm:
569         (WebKit::WebInspectorProxy::setInspectorWindowFrame): Deleted.
570         (WebKit::WebInspectorProxy::inspectorWindowFrame): Deleted.
571         * WebProcess/WebPage/WebInspector.h:
572
573 2018-11-15  Ryosuke Niwa  <rniwa@webkit.org>
574
575         Enable process swap on cross-site navigation by default on macOS
576         https://bugs.webkit.org/show_bug.cgi?id=191572
577
578         Reviewed by Chris Dumez.
579
580         Enabled the feature by default on macOS.
581
582         * Shared/WebPreferences.yaml:
583         * Shared/WebPreferencesDefaultValues.h:
584
585 2018-11-15  Chris Dumez  <cdumez@apple.com>
586
587         IndexedDB.IndexedDBTempFileSize API test times out with process prewarming enabled
588         https://bugs.webkit.org/show_bug.cgi?id=191671
589         <rdar://problem/46086062>
590
591         Reviewed by Alex Christensen.
592
593         Enabling process prewarming caused IndexedDB.IndexedDBTempFileSize API to time out and print
594         the following line:
595         "Attempted to create a NetworkLoad with a session (id=2) that does not exist."
596
597         This actually identified a pre-existing bug with our handling of non-default data store.
598         Whenever a page starts using a data store, we call WebProcessPool::pageBeginUsingWebsiteDataStore()
599         which will call NetworkProcessProxy::addSession() if the network process was already started
600         to let the network process know about this non-default session. There are several issues with the
601         current model:
602         1. If the network process was not created yet when pageBeginUsingWebsiteDataStore() is called,
603            then the network process will not know about the non-default session when it actually gets
604            started later on. This is unlikely to happen in practice, except in case of network process
605            crash because we create the network process as soon as we initialize the first WebProcessProxy.
606         2. Even if we successfuly managed to register the session with the network process proxy, we get
607            in trouble if the network process crashes or is terminated later on as we do not re-register
608            those sessions with the new network process.
609
610         To address these 2 issues, WebProcessPool::ensureNetworkProcess() now takes care of registering
611         all the non-default sessions (that are associated with this process pool) with the new network
612         process. The WebProcessPool knows about these sessions because it adds them to m_sessionToPagesMap
613         whenever WebProcessPool::pageBeginUsingWebsiteDataStore() is called, even if the network process
614         proxy was not created yet.
615
616         The reason the IndexedDB.IndexedDBTempFileSize API test was failing was because it did:
617         1. A load in a WebView V1 with a non-default session
618         2. Process prewarming kicked in after this load and would create a new WebProcessProxy.
619         3. Terminate the network process
620         4. Another load in a WebView V2 with the same non-defaut session, which would reuse the
621           prewarmed process. Because the network process was terminated, constructing the new
622           page would not register the session ID with the new network process when
623           pageBeginUsingWebsiteDataStore() is called.
624         -> The load would hang because the new network process would not know about the
625            non-default session when started later on.
626
627         The bug was previously hidden without process prewarming because step 4 would create a *new*
628         WebProcessProxy and WebProcessPool::initializeNewWebProcess() would call ensureNetworkProcess()
629         so that pageBeginUsingWebsiteDataStore() would successfuly register the session with the
630         network process later on.
631
632         I wrote a second API test (WebKit.DoLoadWithNonDefaultDataStoreAfterTerminatingNetworkProcess)
633         to demonstrate the pre-existing bug without process prewarming enabled.
634
635         * UIProcess/WebProcessPool.cpp:
636         (WebKit::WebProcessPool::ensureNetworkProcess):
637
638 2018-11-15  Vivek Seth  <v_seth@apple.com>
639
640         Create feature flag (HTTPS_UPGRADE)
641         https://bugs.webkit.org/show_bug.cgi?id=191613
642         <rdar://problem/45851068>
643
644         Reviewed by Dean Jackson.
645
646         * config.h:
647
648 2018-11-15  Chris Dumez  <cdumez@apple.com>
649
650         Regression(r238215) WKProcessPool.WarmInitialProcess API test is failing
651         https://bugs.webkit.org/show_bug.cgi?id=191693
652
653         Reviewed by Alex Christensen.
654
655         Allow *explicit* process prewarming to construct the default data store if necessary or we would
656         not be obeying the client's request. Only automatic process prewarming should avoid constructing
657         the default data store unnecessarily to avoid causing memory regressions.
658
659         * UIProcess/API/C/WKContext.cpp:
660         (WKContextWarmInitialProcess):
661         * UIProcess/API/Cocoa/WKProcessPool.mm:
662         (-[WKProcessPool _warmInitialProcess]):
663         * UIProcess/WebProcessPool.cpp:
664         (WebKit::WebProcessPool::prewarmProcess):
665         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
666         * UIProcess/WebProcessPool.h:
667         (WebKit::WebProcessPool::sendToOneProcess):
668
669 2018-11-14  Jiewen Tan  <jiewen_tan@apple.com>
670
671         Unreviewed, comment improvement over r238166.
672
673         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
674         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
675         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
676
677 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
678
679         [WebAuthN] Use a real nonce for CTAPHID_INIT
680         https://bugs.webkit.org/show_bug.cgi?id=191533
681         <rdar://problem/46103502>
682
683         Reviewed by Brent Fulgham.
684
685         Use a real nonce for CTAPHID_INIT request according to:
686         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid_init-0x06.
687         The challenge here is the new transaction needs to start in the next runloop otherwise a dead lock will form:
688         wrong nonce -> new transaction -> new nonce -> write init request -> read init response from last run as it
689         piped in the run loop -> wrong nonce of course -> ...
690         To break the above dead lock, we have to start the new transaction in the next run. However, that isn't
691         sufficient as the arrived init response will be piped in HidConnection::m_inputReports, which is designed
692         on purpose to store any data packets within (initialized, terminated) time interval to prevent data loss in
693         the case when HidConnection::registerDataReceivedCallback is called after the first data packet's arrival.
694         In order to break the dead lock completely, HidConnection::invalidateCache will bnnne called prior to every
695         send to delete any potential init response from last run. HidConnection::invalidateCache is not necessary
696         for other protocols though. The above scenario is more or less a design flaw in CTAP HID.
697
698         Of course, all above scenarios are covered in our mock tests.
699
700         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
701         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
702         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
703         (WebKit::HidConnection::invalidateCache):
704         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
705         (WebKit::MockHidConnection::send):
706         (WebKit::MockHidConnection::parseRequest):
707         (WebKit::MockHidConnection::feedReports):
708         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
709         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
710         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
711         (WebKit::CtapHidDriver::Worker::transact):
712         (WebKit::CtapHidDriver::CtapHidDriver):
713         (WebKit::CtapHidDriver::transact):
714         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
715         (WebKit::CtapHidDriver::returnResponse):
716         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
717
718 2018-11-15  Oriol Brufau  <obrufau@igalia.com>
719
720         [css-logical] Implement flow-relative margin, padding and border shorthands
721         https://bugs.webkit.org/show_bug.cgi?id=188697
722
723         Reviewed by Simon Fraser and Antti Koivisto.
724
725         Add a CSSLogicalEnabled runtime flag.
726
727         * Shared/WebPreferences.yaml:
728
729 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
730
731         [WebAuthN] PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::AuthenticatorAttachment should be optional
732         https://bugs.webkit.org/show_bug.cgi?id=191522
733
734         Reviewed by Brent Fulgham.
735
736         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
737         (WebKit::AuthenticatorManagerInternal::collectTransports):
738
739 2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
740
741         [SOUP] Make Accept-Languages header look more like other browsers
742         https://bugs.webkit.org/show_bug.cgi?id=191614
743
744         Reviewed by Carlos Garcia Campos.
745
746         This changes our Accept-Language header to better match other browsers, from something
747         like this:
748
749         Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
750
751         to something like this:
752
753         Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
754
755         There's no particular motivation for this change. I just noticed we were different for no
756         clear reason.
757
758         * NetworkProcess/soup/NetworkProcessSoup.cpp:
759         (WebKit::buildAcceptLanguages):
760         * UIProcess/API/glib/WebKitWebContext.cpp:
761         (webkit_web_context_set_preferred_languages):
762
763 2018-11-15  Daniel Bates  <dabates@apple.com>
764
765         [iOS] Shift + Tab does not focus previous field
766         https://bugs.webkit.org/show_bug.cgi?id=191596
767         <rdar://problem/45892053>
768
769         Reviewed by Wenson Hsieh.
770
771         Wire up the the tab and shift + tab key commands to the WKWebView/WKContentView's
772         action forwarding mechanism. Also rename -_prevAccessoryTab to -_previousAccessoryTab.
773
774         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
775         * UIProcess/API/Cocoa/WKWebViewInternal.h:
776         * UIProcess/ios/WKContentViewInteraction.h:
777         * UIProcess/ios/WKContentViewInteraction.mm:
778         (-[WKContentView canPerformActionForWebView:withSender:]):
779         (-[WKContentView keyCommands]):
780         (-[WKContentView _nextAccessoryTabForWebView:]): Added.
781         (-[WKContentView _previousAccessoryTabForWebView:]): Added.
782         (-[WKContentView _nextAccessoryTab:]): Deleted.
783         (-[WKContentView _prevAccessoryTab:]): Deleted.
784
785 2018-11-15  Keith Rollin  <krollin@apple.com>
786
787         Delete old .xcfilelist files
788         https://bugs.webkit.org/show_bug.cgi?id=191669
789         <rdar://problem/46081994>
790
791         Reviewed by Chris Dumez.
792
793         .xcfilelist files were created and added to the Xcode project files in
794         https://trac.webkit.org/changeset/238008/webkit. However, they caused
795         build issues and they were removed from the Xcode projects in
796         https://trac.webkit.org/changeset/238055/webkit. This check-in removes
797         the files from the repository altogether. They'll ultimately be
798         replaced with new files with names that indicate whether the
799         associated files are inputs to the Run Script phase or are files
800         created by the Run Script phase.
801
802         * DerivedSources.xcfilelist: Removed.
803         * UnifiedSources.xcfilelist: Removed.
804
805 2018-11-15  Frederic Wang  <fwang@igalia.com>
806
807         [WebAuthN] Make AuthenticatorManager
808         https://bugs.webkit.org/show_bug.cgi?id=189279
809
810         Unreviewed build fix.
811
812         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Add missing header.
813         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Ditto.
814         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Ditto.
815
816 2018-11-14  Keith Rollin  <krollin@apple.com>
817
818         Move scripts for Derived and Unified Sources to external files
819         https://bugs.webkit.org/show_bug.cgi?id=191670
820         <rdar://problem/46082278>
821
822         Reviewed by Keith Miller.
823
824         Move the scripts in the Generate Derived Sources and Generate Unified
825         Sources Run Script phases from the Xcode projects to external shell
826         script files. Then invoke those scripts from the Run Script phases.
827         This refactoring is being performed to support later work that will
828         invoke these scripts in other contexts.
829
830         The scripts were maintained as-is when making the move. I did a little
831         reformatting and added 'set -e' to the top of each file, but that's
832         it.
833
834         * Scripts/generate-derived-sources.sh: Added.
835         * Scripts/generate-unified-sources.sh: Added.
836         * WebKit.xcodeproj/project.pbxproj:
837
838 2018-11-14  Chris Dumez  <cdumez@apple.com>
839
840         WebKit.DecidePolicyForNavigationActionForHyperlinkThatRedirects API fails when PSON is enabled
841         https://bugs.webkit.org/show_bug.cgi?id=191640
842
843         Reviewed by Alex Christensen.
844
845         The issue was that when process-swapping on a redirect, the parameters provided by the new
846         WebContent process for navigationActionData / originatingFrameInfoData / frameSecurityOrigin
847         are not correct because it does not have sufficient information (it does not know a swap
848         happened).
849
850         To address the issue, we now store the navigationActionData / originatingFrameInfoData /
851         frameSecurityOrigin on the Navigation object whenever decidePolicyForNavigationAction is
852         called. If the decidePolicyForNavigationAction is for a redirect, use the ones we stored
853         on the Navigation object instead of the ones provided by the WebContent process. In case
854         of redirect, those do not change anyway.
855
856         This fixes all WebKit.DecidePolicyForNavigationAction* tests with PSON enabled.
857
858         * UIProcess/API/APINavigation.h:
859         (API::Navigation::currentRequestIsRedirect const):
860         (API::Navigation::wasUserInitiated const):
861         (API::Navigation::shouldForceDownload const):
862         (API::Navigation::treatAsSameOriginNavigation const):
863         (API::Navigation::hasOpenedFrames const):
864         (API::Navigation::openedViaWindowOpenWithOpener const):
865         (API::Navigation::opener const):
866         (API::Navigation::requesterOrigin const):
867         (API::Navigation::lockHistory const):
868         (API::Navigation::lockBackForwardList const):
869         (API::Navigation::clientRedirectSourceForHistory const):
870         (API::Navigation::setLastNavigationAction):
871         (API::Navigation::lastNavigationAction const):
872         (API::Navigation::setOriginatingFrameInfo):
873         (API::Navigation::originatingFrameInfo const):
874         (API::Navigation::setDestinationFrameSecurityOrigin):
875         (API::Navigation::destinationFrameSecurityOrigin const):
876         * UIProcess/WebPageProxy.cpp:
877         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
878         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
879         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
880         * UIProcess/WebPageProxy.h:
881
882 2018-11-14  Chris Dumez  <cdumez@apple.com>
883
884         WebKit.WebsiteDataStoreCustomPaths API test is failing when enabling process prewarming
885         https://bugs.webkit.org/show_bug.cgi?id=191638
886
887         Reviewed by Alex Christensen.
888
889         WebProcessPool::prewarmProcess() should not create the default WebSite Data Store if it
890         does not exist yet. This is bad for memory consumption and it is what was causing this
891         API test to fail.
892
893         WebProcessPool::prewarmProcess() now tries to use the following data stores in this
894         order of preference:
895         1. WebProcessPool::m_websiteDataStore (aka this process pool's primary data store)
896         2. The data store of the last WebProcessProxy that was created
897         3. The default data store if it exists
898
899         If no suitable data store is found, we cancel the process prewarming and log a console
900         message instead.
901
902         * UIProcess/WebProcessPool.cpp:
903         (WebKit::WebProcessPool::prewarmProcess):
904
905 2018-11-14  Timothy Hatcher  <timothy@apple.com>
906
907         Enabled dark mode CSS support by default.
908         https://bugs.webkit.org/show_bug.cgi?id=191609
909         rdar://problem/46046861
910
911         Reviewed by Megan Gardner.
912
913         * Shared/WebPreferences.yaml: Set DarkModeCSSEnabled's defaultValue to true.
914
915 2018-11-14  Timothy Hatcher  <timothy@apple.com>
916
917         Default the view background color and text color to different values when in dark mode.
918         https://bugs.webkit.org/show_bug.cgi?id=191607
919         rdar://problem/46045854
920
921         Reviewed by Dean Jackson.
922
923         * UIProcess/Cocoa/WebViewImpl.mm:
924         (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
925         (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
926         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
927         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
928         * WebProcess/WebPage/WebPage.cpp:
929         (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
930
931 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
932
933         Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
934         https://bugs.webkit.org/show_bug.cgi?id=191612
935
936         Reviewed by Matt Baker.
937
938         * UIProcess/Automation/WebAutomationSession.cpp:
939         (WebKit::WebAutomationSession::connect):
940         (WebKit::WebAutomationSession::disconnect):
941         (WebKit::WebAutomationSession::terminate):
942         * UIProcess/Automation/WebAutomationSession.h:
943         * UIProcess/WebPageDebuggable.cpp:
944         (WebKit::WebPageDebuggable::connect):
945         (WebKit::WebPageDebuggable::disconnect):
946         * UIProcess/WebPageDebuggable.h:
947         * UIProcess/WebPageInspectorController.cpp:
948         (WebKit::WebPageInspectorController::connectFrontend):
949         (WebKit::WebPageInspectorController::disconnectFrontend):
950         * UIProcess/WebPageInspectorController.h:
951         * WebProcess/WebPage/WebInspector.cpp:
952         (WebKit::WebInspector::close):
953         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
954         (WebKit::WebPageInspectorTarget::connect):
955         (WebKit::WebPageInspectorTarget::disconnect):
956
957 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
958
959         Unreviewed attempted wincairo build fix after 238192.
960
961         * WebProcess/WebPage/WebPageInspectorTargetController.h:
962         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
963
964 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
965
966         Web Inspector: Follow-up: Keep Disabling Process Swap for Local Web Inspector
967         https://bugs.webkit.org/show_bug.cgi?id=191494
968         <rdar://problem/45469854>
969
970         Reviewed by Devin Rousso.
971
972         Continue to have the Local Inspector disable PSON while open
973         until support is added.
974
975         * UIProcess/WebPageProxy.cpp:
976         (WebKit::WebPageProxy::resetState):
977         * UIProcess/WebPageProxy.h:
978         (WebKit::WebPageProxy::hasLocalInspectorFrontend const):
979         (WebKit::WebPageProxy::setHasLocalInspectorFrontend):
980         * UIProcess/WebPageProxy.messages.in:
981         * UIProcess/WebProcessPool.cpp:
982         (WebKit::WebProcessPool::processForNavigationInternal):
983         * WebProcess/WebPage/WebInspector.cpp:
984         (WebKit::WebInspector::openFrontendConnection):
985         (WebKit::WebInspector::closeFrontendConnection):
986         * WebProcess/WebPage/WebPage.cpp:
987         (WebKit::WebPage::setHasLocalInspectorFrontend):
988         * WebProcess/WebPage/WebPage.h:
989
990 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
991
992         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
993         https://bugs.webkit.org/show_bug.cgi?id=191494
994         <rdar://problem/45469854>
995
996         Reviewed by Devin Rousso.
997
998         To support process swapping a slim Web Inspector backend lives in the UIProcess.
999         The Web Inspector frontend connects to it and is told about sub-targets, namely
1000         pages, that it can further connect to. When performing a process swap the backend
1001         tells the frontend to destroy existing targets and create new targets.
1002
1003         In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single
1004         TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector
1005         protocol messages go through this inspector controller and are routed to the
1006         WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides
1007         when to close and expose new page targets during process swap, or basically
1008         any time it reconnects to a WebProcess. So this patch also makes Web Inspector
1009         stay alive and reconnect to a page when the inspected page crashes!
1010
1011         In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also
1012         has a WebPageInspectorTargetController in anticipation of further sub-targets
1013         within the page (workers, frames) but none exist at the moment. The WebPage
1014         relies on the WebPageProxy to know when to expose this target as a debuggable.
1015
1016         * Sources.txt:
1017         * WebKit.xcodeproj/project.pbxproj:
1018         New files.
1019
1020         * Shared/WebPageCreationParameters.cpp:
1021         (WebKit::WebPageCreationParameters::encode const):
1022         (WebKit::WebPageCreationParameters::decode):
1023         * Shared/WebPageCreationParameters.h:
1024         Remote inspector state can now stay in the UIProcess and does not need to
1025         be passed down to the WebContentProcess.
1026
1027         * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp.
1028         (WebKit::WebPageDebuggable::WebPageDebuggable):
1029         (WebKit::WebPageDebuggable::name const):
1030         (WebKit::WebPageDebuggable::url const):
1031         (WebKit::WebPageDebuggable::hasLocalDebugger const):
1032         (WebKit::WebPageDebuggable::connect):
1033         (WebKit::WebPageDebuggable::disconnect):
1034         (WebKit::WebPageDebuggable::dispatchMessageFromRemote):
1035         (WebKit::WebPageDebuggable::setIndicating):
1036         (WebKit::WebPageDebuggable::setNameOverride):
1037         * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h.
1038         Remote debuggable entry point into the UIProcess for a page.
1039         This is pretty much identical to the PageDebuggable in WebCore.
1040
1041         * Scripts/webkit/messages.py:
1042         * UIProcess/WebPageProxy.messages.in:
1043         * UIProcess/WebPageProxy.cpp:
1044         (WebKit::m_resetRecentCrashCountTimer):
1045         (WebKit::WebPageProxy::finishAttachingToWebProcess):
1046         (WebKit::WebPageProxy::close):
1047         (WebKit::WebPageProxy::createInspectorTarget):
1048         (WebKit::WebPageProxy::destroyInspectorTarget):
1049         (WebKit::WebPageProxy::sendMessageToInspectorFrontend):
1050         (WebKit::WebPageProxy::setIndicating):
1051         (WebKit::WebPageProxy::allowsRemoteInspection const):
1052         (WebKit::WebPageProxy::setAllowsRemoteInspection):
1053         (WebKit::WebPageProxy::remoteInspectionNameOverride const):
1054         (WebKit::WebPageProxy::setRemoteInspectionNameOverride):
1055         (WebKit::WebPageProxy::remoteInspectorInformationDidChange):
1056         (WebKit::WebPageProxy::clearInspectorTargets):
1057         (WebKit::WebPageProxy::createInspectorTargets):
1058         (WebKit::WebPageProxy::didCommitLoadForFrame):
1059         (WebKit::WebPageProxy::didReceiveTitleForFrame):
1060         (WebKit::WebPageProxy::creationParameters):
1061         * UIProcess/WebPageProxy.h:
1062         (WebKit::WebPageProxy::inspectorController):
1063         (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted.
1064         (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted.
1065         Own more inspector state in the UIProcess including a debuggable and inspector controller.
1066
1067         * UIProcess/WebPageInspectorController.h: Added.
1068         * UIProcess/WebPageInspectorController.cpp: Added.
1069         (WebKit::WebPageInspectorController::WebPageInspectorController):
1070         (WebKit::WebPageInspectorController::pageClosed):
1071         (WebKit::WebPageInspectorController::hasLocalFrontend const):
1072         (WebKit::WebPageInspectorController::hasRemoteFrontend const):
1073         (WebKit::WebPageInspectorController::connectFrontend):
1074         (WebKit::WebPageInspectorController::disconnectFrontend):
1075         (WebKit::WebPageInspectorController::disconnectAllFrontends):
1076         (WebKit::WebPageInspectorController::dispatchMessageFromFrontend):
1077         (WebKit::WebPageInspectorController::setIndicating):
1078         (WebKit::WebPageInspectorController::clearTargets):
1079         (WebKit::WebPageInspectorController::createInspectorTarget):
1080         (WebKit::WebPageInspectorController::destroyInspectorTarget):
1081         (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend):
1082         InspectorController with a single TargetAgent in the UIProcess.
1083
1084         * UIProcess/WebPageInspectorTargetAgent.h:
1085         * UIProcess/WebPageInspectorTargetAgent.cpp:
1086         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
1087         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
1088         Target agent implementation.
1089
1090         * UIProcess/InspectorTargetProxy.cpp:
1091         (WebKit::InspectorTargetProxy::create):
1092         (WebKit::InspectorTargetProxy::InspectorTargetProxy):
1093         (WebKit::InspectorTargetProxy::connect):
1094         (WebKit::InspectorTargetProxy::disconnect):
1095         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
1096         * UIProcess/InspectorTargetProxy.h:
1097         UIProcess proxy for an InspectorTarget in the WebContentProcess.
1098
1099         * UIProcess/WebProcessPool.cpp:
1100         (WebKit::WebProcessPool::processForNavigationInternal):
1101
1102         * WebProcess/WebPage/WebPage.cpp:
1103         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
1104         (WebKit::WebPage::connectInspector):
1105         (WebKit::WebPage::disconnectInspector):
1106         (WebKit::WebPage::sendMessageToTargetBackend):
1107         (WebKit::WebPage::setIndicating):
1108         (WebKit::WebPage::setAllowsRemoteInspection): Deleted.
1109         (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted.
1110         * WebProcess/WebPage/WebPage.h:
1111         * WebProcess/WebPage/WebPage.messages.in:
1112
1113         * WebProcess/WebPage/WebPageInspectorTarget.h:
1114         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
1115         (WebKit::WebPageInspectorTarget::WebPageInspectorTarget):
1116         (WebKit::WebPageInspectorTarget::identifier const):
1117         (WebKit::WebPageInspectorTarget::connect):
1118         (WebKit::WebPageInspectorTarget::disconnect):
1119         (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend):
1120         InspectorTarget for this WebPage.
1121
1122         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added.
1123         (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController):
1124         (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController):
1125         (WebKit::WebPageInspectorTargetController::addTarget):
1126         (WebKit::WebPageInspectorTargetController::removeTarget):
1127         (WebKit::WebPageInspectorTargetController::connectInspector):
1128         (WebKit::WebPageInspectorTargetController::disconnectInspector):
1129         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend):
1130         (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend):
1131         * WebProcess/WebPage/WebPageInspectorTargetController.h:
1132         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
1133         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
1134         (WebKit::WebPageInspectorTargetFrontendChannel::create):
1135         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
1136         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
1137         Preparation for more target managment in the WebContentProcess.
1138
1139 2018-11-14  Alex Christensen  <achristensen@webkit.org>
1140
1141         Add SPI to show a safe browsing warning
1142         https://bugs.webkit.org/show_bug.cgi?id=191604
1143
1144         Reviewed by Andy Estes.
1145
1146         Safari has a case where it shows safe browsing warnings for a reason other than being told to by the SafeBrowsing framework.
1147         Because safe browsing is moving to WebKit, we will have Safari call this WebKit SPI in that case.
1148         The warning looks a little different, so I had to change the structure of a SafeBrowsingResult and the location of the string processing,
1149         but the existing behavior is the same as verified by existing unit tests.  I added a unit test to verify behavior of the new SPI.
1150
1151         * SourcesCocoa.txt:
1152         * UIProcess/API/Cocoa/WKWebView.mm:
1153         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
1154         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1155         (+[WKWebView _confirmMalwareSentinel]):
1156         (+[WKWebView _visitUnsafeWebsiteSentinel]):
1157         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1158         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1159         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Removed.
1160         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm.
1161         (WebKit::malwareDetailsBase):
1162         (WebKit::learnMoreURL):
1163         (WebKit::reportAnErrorBase):
1164         (WebKit::localizedProvider):
1165         (WebKit::SafeBrowsingWarning::visitUnsafeWebsiteSentinel):
1166         (WebKit::SafeBrowsingWarning::confirmMalwareSentinel):
1167         (WebKit::replace):
1168         (WebKit::addLinkAndReplace):
1169         (WebKit::reportAnErrorURL):
1170         (WebKit::malwareDetailsURL):
1171         (WebKit::safeBrowsingTitleText):
1172         (WebKit::safeBrowsingWarningText):
1173         (WebKit::safeBrowsingDetailsText):
1174         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
1175         (WebKit::learnMore): Deleted.
1176         (WebKit::SafeBrowsingResult::SafeBrowsingResult): Deleted.
1177         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1178         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1179         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
1180         (-[WKSafeBrowsingWarning addContent]):
1181         (-[WKSafeBrowsingWarning showDetailsClicked]):
1182         (-[WKSafeBrowsingWarning clickedOnLink:]):
1183         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1184         (confirmMalwareSentinel): Deleted.
1185         (visitUnsafeWebsiteSentinel): Deleted.
1186         (replace): Deleted.
1187         (addLinkAndReplace): Deleted.
1188         (reportAnErrorURL): Deleted.
1189         (malwareDetailsURL): Deleted.
1190         (titleText): Deleted.
1191         (warningText): Deleted.
1192         (detailsText): Deleted.
1193         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]): Deleted.
1194         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1195         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1196         * UIProcess/Cocoa/WebViewImpl.h:
1197         * UIProcess/Cocoa/WebViewImpl.mm:
1198         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1199         * UIProcess/PageClient.h:
1200         (WebKit::PageClient::showSafeBrowsingWarning):
1201         * UIProcess/SafeBrowsingResult.h: Removed.
1202         * UIProcess/SafeBrowsingWarning.h: Copied from Source/WebKit/UIProcess/SafeBrowsingResult.h.
1203         (WebKit::SafeBrowsingWarning::create):
1204         (WebKit::SafeBrowsingWarning::title const):
1205         (WebKit::SafeBrowsingWarning::warning const):
1206         (WebKit::SafeBrowsingWarning::details const):
1207         (WebKit::SafeBrowsingResult::create): Deleted.
1208         (WebKit::SafeBrowsingResult::isPhishing const): Deleted.
1209         (WebKit::SafeBrowsingResult::isMalware const): Deleted.
1210         (WebKit::SafeBrowsingResult::isUnwantedSoftware const): Deleted.
1211         (WebKit::SafeBrowsingResult::url const): Deleted.
1212         (WebKit::SafeBrowsingResult::provider const): Deleted.
1213         (WebKit::SafeBrowsingResult::localizedProviderName const): Deleted.
1214         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const): Deleted.
1215         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const): Deleted.
1216         (WebKit::SafeBrowsingResult::learnMoreURL const): Deleted.
1217         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const): Deleted.
1218         (): Deleted.
1219         * UIProcess/WebFramePolicyListenerProxy.cpp:
1220         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
1221         (WebKit::WebFramePolicyListenerProxy::use):
1222         * UIProcess/WebFramePolicyListenerProxy.h:
1223         * UIProcess/WebFrameProxy.cpp:
1224         (WebKit::WebFrameProxy::WebFrameProxy):
1225         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
1226         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
1227         * UIProcess/WebFrameProxy.h:
1228         (WebKit::WebFrameProxy::create):
1229         (WebKit::WebFrameProxy::page const):
1230         * UIProcess/WebPageProxy.cpp:
1231         (WebKit::WebPageProxy::swapToWebProcess):
1232         (WebKit::WebPageProxy::didCreateMainFrame):
1233         (WebKit::WebPageProxy::didCreateSubframe):
1234         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1235         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1236         (WebKit::WebPageProxy::decidePolicyForResponse):
1237         * UIProcess/ios/PageClientImplIOS.h:
1238         * UIProcess/ios/PageClientImplIOS.mm:
1239         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1240         * UIProcess/mac/PageClientImplMac.h:
1241         * UIProcess/mac/PageClientImplMac.mm:
1242         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1243         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1244         * WebKit.xcodeproj/project.pbxproj:
1245
1246 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1247
1248         [iOS] A few drag and drop tests are crashing after r238146
1249         https://bugs.webkit.org/show_bug.cgi?id=191617
1250
1251         Reviewed by Dean Jackson.
1252
1253         The notion of temporarily suppressing the selection assistant was introduced during iOS drag and drop
1254         development as a way of allowing both the selection view and dropped content snapshot to fade in simultaneously
1255         during a drop in an editable element. r238146 piggy-backs on this mechanism by changing selection suppression
1256         state when an element is focused, when the selection changes, and when an element is blurred, depending on
1257         whether the currently focused element is transparent.
1258
1259         However, in the case where the selection assistant is suppressed due to a running drop animation, if focus moves
1260         to an element that is not fully transparent, we end up prematurely unsuppressing the text selection assistant.
1261         This subsequently causes selection UI to immediately show up after a drop instead of animating in alongside a
1262         snapshot of the inserted document fragment, if the drop moved focus to an editable element.
1263
1264         A number of drag and drop tests on iOS exercised this codepath by dragging content into editable fields and/or
1265         moving content between editable elements in a web view. These tests began to crash due to selection views and
1266         the accompanying callout bar appearing earlier than usual, which triggers an unrelated UIKit assertion in
1267         <https://webkit.org/b/190401>.
1268
1269         This patch fixes the failing tests by refactoring our selection assistant suppression code. Instead of
1270         maintaining a single `BOOL` flag indicating whether the selection is suppressed, we use an `OptionSet` of
1271         `SuppressSelectionAssistantReason`s, which (at the moment) only include (1) a running drop animation, and (2)
1272         focusing a transparent element. The text selection assistant is considered suppressed when either of the reasons
1273         apply. This allows us to correctly handle a drop animation that occurs simultaneously as an element is focused
1274         without unsuppressing the selection assistant early, and also allows us to handle selection assistant
1275         suppression in more nuanced ways, depending on the suppression reason.
1276
1277         * UIProcess/ios/WKContentViewInteraction.h:
1278         * UIProcess/ios/WKContentViewInteraction.mm:
1279         (-[WKContentView cleanupInteraction]):
1280         (-[WKContentView _displayFormNodeInputView]):
1281
1282         Only prevent zooming to the focused element during drop if we're suppressing the selection assistant due to
1283         focusing a transparent element. In the case of a drop, we still want to allow scrolling and zooming.
1284
1285         (-[WKContentView canShowNonEmptySelectionView]):
1286         (-[WKContentView hasSelectablePositionAtPoint:]):
1287         (-[WKContentView pointIsNearMarkedText:]):
1288         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1289         (-[WKContentView _startAssistingKeyboard]):
1290         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1291         (-[WKContentView _stopAssistingNode]):
1292         (-[WKContentView _updateChangedSelection:]):
1293         (-[WKContentView _shouldSuppressSelectionCommands]):
1294         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
1295         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
1296
1297         Add helper methods for adding or removing selection assistant suppression reasons. When the last selection
1298         assistant suppression reason is removed, we activate the selection assistant, and conversely, when the first
1299         suppression reason is added, we deactivate the selection assistant.
1300
1301         (-[WKContentView _didConcludeEditDataInteraction:]):
1302         (-[WKContentView _didPerformDragOperation:]):
1303         (-[WKContentView dropInteraction:performDrop:]):
1304         (-[WKContentView suppressAssistantSelectionView]): Deleted.
1305         (-[WKContentView setSuppressAssistantSelectionView:]): Deleted.
1306
1307 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1308
1309         [Cocoa] [WebKit2] Hook up some more editing actions (-_pasteAndMatchStyle:, -makeTextWritingDirectionNatural:)
1310         https://bugs.webkit.org/show_bug.cgi?id=191605
1311         <rdar://problem/45813991>
1312
1313         Reviewed by Dean Jackson.
1314
1315         Hook up a couple of editing actions on iOS and macOS. The `-pasteAndMatchStyle:` selector is privately declared
1316         in UIKit, but does not exist on macOS; as such, add `-_pasteAndMatchStyle:` as SPI on WKWebView, and
1317         additionally implement the unprefixed version, `-pasteAndMatchStyle:`, on iOS.
1318
1319         Since `-makeTextWritingDirectionNatural:` is already declared on both iOS and macOS (SPI on UIResponder and API
1320         on macOS, respectively) we simply implement the unprefixed variant on both platforms.
1321
1322         * Platform/spi/ios/UIKitSPI.h:
1323         * UIProcess/API/Cocoa/WKWebView.mm:
1324         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1325         * UIProcess/ios/WKContentViewInteraction.h:
1326         * UIProcess/ios/WKContentViewInteraction.mm:
1327         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
1328         (-[WKContentView canPerformActionForWebView:withSender:]):
1329
1330 2018-11-14  Per Arne Vollan  <pvollan@apple.com>
1331
1332         REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
1333         https://bugs.webkit.org/show_bug.cgi?id=190884
1334
1335         Reviewed by Dean Jackson.
1336
1337         Since the Web page currently owns the display link on the UI process side, the display link will be
1338         deleted in the UI process when a Web page is closed. This is incorrect, since a display link can be
1339         reused between Web pages in the WebContent process. This patch moves the ownership of the UI process
1340         display links to the Web process object to address this issue. Also, the display ID of the display
1341         being updated is included in the message to the WebContent process.
1342
1343         * UIProcess/WebPageProxy.cpp:
1344         (WebKit::WebPageProxy::close):
1345         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1346         * UIProcess/WebPageProxy.h:
1347         * UIProcess/WebPageProxy.messages.in:
1348         * UIProcess/WebProcessProxy.h:
1349         * UIProcess/WebProcessProxy.messages.in:
1350         * UIProcess/mac/DisplayLink.cpp:
1351         (WebKit::DisplayLink::DisplayLink):
1352         (WebKit::DisplayLink::displayLinkCallback):
1353         * UIProcess/mac/DisplayLink.h:
1354         (WebKit::DisplayLink::displayID const):
1355         * UIProcess/mac/WebPageProxyMac.mm:
1356         (WebKit::WebPageProxy::startDisplayLink): Deleted.
1357         (WebKit::WebPageProxy::stopDisplayLink): Deleted.
1358         * UIProcess/mac/WebProcessProxyMac.mm:
1359         (WebKit::WebProcessProxy::startDisplayLink):
1360         (WebKit::WebProcessProxy::stopDisplayLink):
1361         * WebProcess/WebPage/DrawingArea.h:
1362         * WebProcess/WebPage/DrawingArea.messages.in:
1363         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
1364         (WebKit::DisplayRefreshMonitorMac::create):
1365         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
1366         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
1367         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
1368         (WebKit::DrawingArea::createDisplayRefreshMonitor):
1369         (WebKit::DrawingArea::displayWasRefreshed): Deleted.
1370         * WebProcess/WebProcess.h:
1371         * WebProcess/WebProcess.messages.in:
1372         * WebProcess/cocoa/WebProcessCocoa.mm:
1373         (WebKit::WebProcess::displayWasRefreshed):
1374
1375 2018-11-14  Chris Dumez  <cdumez@apple.com>
1376
1377         Client should be able to disable PSON even if the experimental feature is on by default
1378         https://bugs.webkit.org/show_bug.cgi?id=191634
1379
1380         Reviewed by Dean Jackson.
1381
1382         Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
1383         when the experimental is enabled, use a separate flag to store this information. If the client
1384         explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
1385         the client's request, otherwise, we fall back to using the state from experimental features.
1386
1387         This allows:
1388         - API tests to explicitely disable PSON / Process prewarming even if those are on by default
1389           in experimental features.
1390         - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
1391           then the experimental feature flag still fully controls the feature.
1392
1393         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1394         (API::ProcessPoolConfiguration::copy):
1395         * UIProcess/API/APIProcessPoolConfiguration.h:
1396         * UIProcess/WebProcessPool.cpp:
1397         (WebKit::WebProcessPool::createWebPage):
1398
1399 2018-11-14  Chris Dumez  <cdumez@apple.com>
1400
1401         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
1402         https://bugs.webkit.org/show_bug.cgi?id=191602
1403
1404         Reviewed by Alex Christensen.
1405
1406         Add support for process swapping for a [WKWebView loadHTML:] load by storing
1407         the necessary data on the API::Navigation and doing a loadData() instead of
1408         a loadRequest() after process swapping when this data is present on the
1409         navigation.
1410
1411         * UIProcess/API/APINavigation.cpp:
1412         (API::Navigation::Navigation):
1413         * UIProcess/API/APINavigation.h:
1414         (API::Navigation::create):
1415         (API::Navigation::substituteData const):
1416         * UIProcess/WebNavigationState.cpp:
1417         (WebKit::WebNavigationState::createLoadDataNavigation):
1418         * UIProcess/WebNavigationState.h:
1419         * UIProcess/WebPageProxy.cpp:
1420         (WebKit::WebPageProxy::loadData):
1421         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1422
1423 2018-11-14  Antti Koivisto  <antti@apple.com>
1424
1425         Align Mac WK2 layer flush throttling with iOS
1426         https://bugs.webkit.org/show_bug.cgi?id=191632
1427
1428         Reviewed by Zalan Bujtas.
1429
1430         Currently Mac WK2 uses WebCore side throttling implementation in RenderLayerCompositor. This code has
1431         throttling timer per-frame while the actual decision making and layer flushes itself are per page. These
1432         timers generate way more flushes than expected in presence of multiple frames. There are also bugs in how
1433         flushing state is updated when frames are created dynamically.
1434
1435         On iOS WK2 throttling is implemented on WebKit side and controlled by a per-page timer. Recent fixes also
1436         make this implementation visually fast. We should align the Mac implementation and eventually unify them.
1437
1438         This patch implements throttling in TiledCoreAnimationDrawingArea mirroring the iOS RemoteLayerTreeDrawingArea
1439         implementation. There are some adjustments for platform differences (local vs remote layers) and we continue
1440         using runloop observer for the actual flushes. Timings are as in the existing Mac code.
1441
1442         The patch appears to be a significant performance progression.
1443
1444         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1445         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1446         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
1447         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
1448
1449         Schedule an immediate flush when layers are unfrozen.
1450
1451         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
1452         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
1453
1454         Track pending flushes with m_hasPendingFlush bit.
1455         Delay flush if the flush throttling timer is active. Start it if we throttling but it is not active yet.
1456
1457         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1458
1459         Clear m_hasPendingFlush if the flush succeeded.
1460         Restart the throttling timer if we are still throttling.
1461         Manage runloop observer invalidation here instead of the caller (and stop returning value).
1462
1463         (WebKit::TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback):
1464         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
1465
1466         Returning 'true' here disables WebCore side throttling code.
1467
1468         Start or stop the throttling timer on state changes.
1469
1470         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingIsActive const):
1471
1472         This is used to control style and layout timers on WebCore side. Return false on frozen
1473         state since unfreezing depends on style and layout.
1474
1475         (WebKit::TiledCoreAnimationDrawingArea::startLayerFlushThrottlingTimer):
1476         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
1477
1478 2018-11-14  Chris Dumez  <cdumez@apple.com>
1479
1480         WebKit.WKHTTPCookieStoreWithoutProcessPool API test is failing with process prewarming is enabled
1481         https://bugs.webkit.org/show_bug.cgi?id=191624
1482
1483         Reviewed by Alex Christensen.
1484
1485         Stop setting the WebProcessPool's primary data store (m_websiteDataStore) to the default one in
1486         WebProcessPool::prewarmProcess(). We did not really need to, we can pass the default data store
1487         to the new WebPageProxy without having to set m_websiteDataStore. m_websiteDataStore only gets
1488         set upon constructor if thr default data store already exists or later on when creating a WebPage
1489         that uses the default data store.
1490
1491         In the case of the API test, the following was happening:
1492         1. Create an ephemeral data store EDS
1493         2. Create a WebView V1 using datastore EDS
1494         3. Do a load in V1
1495         4. Process prewarming would kick in and wrongly associated V1's process pool PP1 with the default data store
1496         5. Create/Get the default datastore and set a few cookies on it
1497         6. Create a WebView V2 using default datastore and a fresh new process pool PP2
1498         7. Do a load in V2 and expect the cookies to be there
1499
1500         In HTTPCookieStore::setCookie() that is called at step 5, we call:
1501         m_owningDataStore->processPoolForCookieStorageOperations()
1502
1503         In this case, m_owningDataStore is the default datastore and this call would previously return null because
1504         there is no WebProcessPool yet associated with the default datastore. However, with the process prewarming
1505         bug at step 4, the process pool PP1 would be returned since it was wrongly associated with the default
1506         data store. As a result, we would call setCookie() on PP1's WebCookieManagerProxy and this would fail
1507         because PP1's network process knows nothing about this session ID (it was only ever used with an ephemeral
1508         session).
1509
1510         * UIProcess/WebProcessPool.cpp:
1511         (WebKit::WebProcessPool::prewarmProcess):
1512
1513 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
1514
1515         [WebAuthN] Support CTAP HID authenticators on macOS
1516         https://bugs.webkit.org/show_bug.cgi?id=188623
1517         <rdar://problem/43353777>
1518
1519         Reviewed by Brent Fulgham and Chris Dumez.
1520
1521         This patch introduces a primitive support of CTAP HID authenticators for WebAuthN in macOS.
1522         It involves low level HID device management&communication, high level CTAP HID authenticator
1523         management&communication, and mock testing. The above three aspects will be covered in details:
1524         1) Low level HID device management&communication: HidService&HidConnection
1525         It relies on IOHIDManager to discover appropriate hid devices by passing a matching dictionary:
1526         { PrimaryUsagePage: 0xf1d0, PrimaryUsage: 0x01}. For communication, it utilizes HID reports.
1527         To send a report, it calls IOHIDDeviceSetReport since the async version is not implemented.
1528         To recieve a report, it calls IOHIDDeviceRegisterInputReportCallback to asynchronously wait
1529         for incoming reports.
1530         Here is the corresponding reference:
1531         https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW2
1532         2) High level CTAP HID authenticator management&communication: HidService&CtapHidDriver
1533         Whenever an appropriate hid device is discovered by IOHIDManager, an AuthenticatorGetInfo command
1534         is sent to the device to determine properties of the authenticator, says, which version of protocol
1535         it supports, i.e. CTAP or U2F. So far, we only support CTAP authenticators. Once the authenticator
1536         is determined to support CTAP, we then instantiate CtapHidAuthenticator which will then take care
1537         of even higher level WebAuthN requests&responses.
1538         Binaries are constructed and packaged according to the CTAP HID porotocol. CtapHidDriver takes care
1539         of concurrency and channels, i.e. allocating channel and establishing the actual request/response
1540         transaction. At the meantime, CtapHidDriver::Worker is then responsible for each single transaction.
1541         Here is the corresponding reference:
1542         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb.
1543         3) Mock Testing: MockHidService & MockHidConnection
1544         A CTAP hid authenticator is simulated within MockHidConnection with options of specifying specific
1545         error scenarios and of course could take care of successful cases. Four stages are presented in the
1546         simulated authenticator to reflect: a) allocating channel for AuthenticatorGetInfo, b) sending
1547         AuthenticatorGetInfo, c) allocating channel for actual request, and d) sending the actual request.
1548
1549         Besides implementing the above, it also does a few other things:
1550         1) Make AuthenticatorManager::clearState asynchronous to avoid cyclic dependency:
1551         Authenticator::returnResponse => AuthenticatorManager::respondReceived => AuthenticatorManager::clearState
1552         => Authenticator::~Authenticator.
1553         2) Reorganize unified build sources to make it clear that which files are .mm and which are .cpp.
1554         3) Import LocalAuthentication.framework in LocalAuthenticationSoftLink instead of being scattered.
1555
1556         * Sources.txt:
1557         * SourcesCocoa.txt:
1558         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1559         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1560         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
1561         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1562         (WebKit::AuthenticatorManagerInternal::collectTransports):
1563         (WebKit::AuthenticatorManager::clearStateAsync):
1564         (WebKit::AuthenticatorManager::respondReceived):
1565         (WebKit::AuthenticatorManager::initTimeOutTimer):
1566         * UIProcess/WebAuthentication/AuthenticatorManager.h:
1567         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
1568         (WebKit::AuthenticatorTransportService::create):
1569         (WebKit::AuthenticatorTransportService::createMock):
1570         (WebKit::AuthenticatorTransportService::startDiscovery):
1571         (WebKit::AuthenticatorTransportService::startDiscovery const): Deleted.
1572         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
1573         * UIProcess/WebAuthentication/Cocoa/HidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h.
1574         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: Added.
1575         (WebKit::reportReceived):
1576         (WebKit::HidConnection::HidConnection):
1577         (WebKit::HidConnection::~HidConnection):
1578         (WebKit::HidConnection::initialize):
1579         (WebKit::HidConnection::terminate):
1580         (WebKit::HidConnection::send):
1581         (WebKit::HidConnection::registerDataReceivedCallback):
1582         (WebKit::HidConnection::unregisterDataReceivedCallback):
1583         (WebKit::HidConnection::receiveReport):
1584         (WebKit::HidConnection::consumeReports):
1585         (WebKit::HidConnection::registerDataReceivedCallbackInternal):
1586         * UIProcess/WebAuthentication/Cocoa/HidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
1587         * UIProcess/WebAuthentication/Cocoa/HidService.mm: Added.
1588         (WebKit::deviceAddedCallback):
1589         (WebKit::deviceRemovedCallback):
1590         (WebKit::HidService::HidService):
1591         (WebKit::HidService::~HidService):
1592         (WebKit::HidService::startDiscoveryInternal):
1593         (WebKit::HidService::platformStartDiscovery):
1594         (WebKit::HidService::createHidConnection const):
1595         (WebKit::HidService::deviceAdded):
1596         (WebKit::HidService::continueAddDeviceAfterGetInfo):
1597         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
1598         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
1599         * UIProcess/WebAuthentication/Cocoa/LocalService.h:
1600         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1601         (WebKit::LocalService::startDiscoveryInternal):
1602         (WebKit::LocalService::startDiscoveryInternal const): Deleted.
1603         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1604         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1605         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: Added.
1606         (WebKit::MockHidConnection::MockHidConnection):
1607         (WebKit::MockHidConnection::initialize):
1608         (WebKit::MockHidConnection::terminate):
1609         (WebKit::MockHidConnection::send):
1610         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
1611         (WebKit::MockHidConnection::assembleRequest):
1612         (WebKit::MockHidConnection::parseRequest):
1613         (WebKit::MockHidConnection::feedReports):
1614         (WebKit::MockHidConnection::stagesMatch const):
1615         (WebKit::MockHidConnection::shouldContinueFeedReports):
1616         (WebKit::MockHidConnection::continueFeedReports):
1617         * UIProcess/WebAuthentication/Mock/MockHidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
1618         * UIProcess/WebAuthentication/Mock/MockHidService.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
1619         (WebKit::MockHidService::MockHidService):
1620         (WebKit::MockHidService::platformStartDiscovery):
1621         (WebKit::MockHidService::createHidConnection const):
1622         * UIProcess/WebAuthentication/Mock/MockHidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
1623         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
1624         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
1625         * UIProcess/WebAuthentication/Mock/MockLocalService.mm: Renamed from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
1626         (WebKit::MockLocalService::MockLocalService):
1627         (WebKit::MockLocalService::platformStartDiscovery const):
1628         (WebKit::MockLocalService::createLocalConnection const):
1629         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
1630         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: Added.
1631         (WebKit::CtapHidAuthenticator::CtapHidAuthenticator):
1632         (WebKit::CtapHidAuthenticator::makeCredential):
1633         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
1634         (WebKit::CtapHidAuthenticator::getAssertion):
1635         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const):
1636         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
1637         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: Added.
1638         (WebKit::CtapHidDriver::Worker::Worker):
1639         (WebKit::CtapHidDriver::Worker::~Worker):
1640         (WebKit::CtapHidDriver::Worker::transact):
1641         (WebKit::CtapHidDriver::Worker::write):
1642         (WebKit::CtapHidDriver::Worker::read):
1643         (WebKit::CtapHidDriver::Worker::returnMessage):
1644         (WebKit::CtapHidDriver::CtapHidDriver):
1645         (WebKit::CtapHidDriver::transact):
1646         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
1647         (WebKit::CtapHidDriver::continueAfterResponseReceived):
1648         (WebKit::CtapHidDriver::returnResponse):
1649         * UIProcess/WebAuthentication/fido/CtapHidDriver.h: Added.
1650         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1651         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
1652         * WebKit.xcodeproj/project.pbxproj:
1653
1654 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
1655
1656         Unreviewed correction to previous build fix to avoid any internal/downstream repercussions.
1657
1658         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1659
1660 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
1661
1662         Unreviewed GTK/WPE build fix for r238159. 
1663
1664         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1665
1666 2018-11-13  Timothy Hatcher  <timothy@apple.com>
1667
1668         Use a light scrollbar for transparent web views in dark mode.
1669         https://bugs.webkit.org/show_bug.cgi?id=191559
1670         rdar://problem/46000489
1671
1672         Reviewed by Dean Jackson.
1673
1674         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1675         (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance().
1676         * WebProcess/WebPage/WebPage.cpp:
1677         (WebKit::WebPage::drawRect): Ditto.
1678
1679 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1680
1681         [iOS] Do not show selection UI for editable elements with opacity near zero
1682         https://bugs.webkit.org/show_bug.cgi?id=191442
1683         <rdar://problem/45958625>
1684
1685         Reviewed by Simon Fraser.
1686
1687         Add support for suppressing native selection UI (for instance, selection highlight views, selection handles, and
1688         selection-related gestures) when the selection is inside a transparent editable element. This helps maintain
1689         compatibility with text editors that work by capturing key events and input events hidden contenteditable
1690         elements, and reflect these changes in different document or different part of the document.
1691
1692         Since selection UI is rendered in the UI process on iOS using element geometry propagated from the web process,
1693         selection rendering is entirely decoupled from the process of painting in the web process. This means that if
1694         the editable root has an opacity of 0, we would correctly hide the caret and selection on macOS, but draw over
1695         the transparent element on iOS. When these hidden editable elements are focused, this often results in unwanted
1696         behaviors, such as double caret painting, native and custom selection UI from the page being drawn on top of one
1697         another, and the ability to change selection via tap and loupe gestures within hidden text.
1698
1699         To fix this, we compute whether the focused element is transparent when an element is focused, or when the
1700         selection changes, and send this information over to the UI process via `AssistedNodeInformation` and
1701         `EditorState`. In the UI process, we then respect this information by suppressing the selection assistant if the
1702         focused element is transparent; this disables showing and laying out selection views, as well as gestures
1703         associated with selection overlays. However, this still allows for contextual autocorrection and spell checking.
1704
1705         * Shared/AssistedNodeInformation.cpp:
1706         (WebKit::AssistedNodeInformation::encode const):
1707         (WebKit::AssistedNodeInformation::decode):
1708         * Shared/AssistedNodeInformation.h:
1709         * Shared/EditorState.cpp:
1710         (WebKit::EditorState::PostLayoutData::encode const):
1711         (WebKit::EditorState::PostLayoutData::decode):
1712         * Shared/EditorState.h:
1713
1714         Add `elementIsTransparent` flags, and also add boilerplate IPC code.
1715
1716         * UIProcess/ios/WKContentViewInteraction.mm:
1717         (-[WKContentView _displayFormNodeInputView]):
1718
1719         Prevent zooming to the focused element if the focused element is hidden.
1720
1721         (-[WKContentView hasSelectablePositionAtPoint:]):
1722         (-[WKContentView pointIsNearMarkedText:]):
1723         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1724
1725         Don't allow these text interaction gestures to begin while suppressing the selection assistant.
1726
1727         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1728
1729         When an element is focused, begin suppressing the selection assistant if the element is fully transparent.
1730
1731         (-[WKContentView _stopAssistingNode]):
1732
1733         When the focused element is blurred, reset state by ending selection assistant suppression (additionally
1734         reactivating the selection assistant if needed). This ensures that selection in non-editable text isn't broken
1735         after focusing a hidden editable element.
1736
1737         (-[WKContentView _updateChangedSelection:]):
1738
1739         If needed, suppress or un-suppress the selection assistant when the selection changes. On certain rich text
1740         editors, a combination of custom selection UI and native selection UI is used. For instance, on Microsoft Office
1741         365, caret selections are rendered using the native caret view, but as soon as the selection becomes ranged, the
1742         editable root becomes fully transparent, and Office's selection UI takes over.
1743
1744         (-[WKContentView _shouldSuppressSelectionCommands]):
1745
1746         Override this UIKit SPI hook to suppress selection commands (e.g. the callout bar) when suppressing the
1747         selection assistant.
1748
1749         * WebProcess/WebPage/ios/WebPageIOS.mm:
1750         (WebKit::WebPage::platformEditorState const):
1751         (WebKit::WebPage::getAssistedNodeInformation):
1752
1753         Compute and set `elementIsTransparent` using the assisted node.
1754
1755 2018-11-13  Ryan Haddad  <ryanhaddad@apple.com>
1756
1757         Unreviewed, rolling out r238137.
1758
1759         Introduced API test failures on macOS.
1760
1761         Reverted changeset:
1762
1763         "Enable process swap on cross-site navigation by default on
1764         macOS"
1765         https://bugs.webkit.org/show_bug.cgi?id=191572
1766         https://trac.webkit.org/changeset/238137
1767
1768 2018-11-13  Ryosuke Niwa  <rniwa@webkit.org>
1769
1770         Enable process swap on cross-site navigation by default on macOS
1771         https://bugs.webkit.org/show_bug.cgi?id=191572
1772
1773         Reviewed by Chris Dumez.
1774
1775         Enabled the feature by default on macOS.
1776
1777         * Shared/WebPreferences.yaml:
1778         * Shared/WebPreferencesDefaultValues.h:
1779
1780 2018-11-13  Daniel Bates  <dabates@apple.com>
1781
1782         Consolidate WebKit UIKitSPI.h and UIKitTestSPI.h
1783         https://bugs.webkit.org/show_bug.cgi?id=173341
1784         <rdar://problem/32752890>
1785
1786         Reviewed by Simon Fraser.
1787
1788         * Platform/spi/ios/UIKitSPI.h:
1789
1790 2018-11-13  Alex Christensen  <achristensen@webkit.org>
1791
1792         Fix internal builds after r238115
1793         https://bugs.webkit.org/show_bug.cgi?id=191441
1794
1795         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1796         (-[WKSafeBrowsingTextView intrinsicContentSize]):
1797         Some iOS-like operating systems don't have safe browsing.  Don't use symbols that don't exist on those systems.
1798
1799 2018-11-13  Ali Juma  <ajuma@chromium.org>
1800
1801         Turn Intersection Observer on by default
1802         https://bugs.webkit.org/show_bug.cgi?id=191569
1803
1804         Reviewed by Simon Fraser.
1805
1806         * Shared/WebPreferences.yaml:
1807
1808 2018-11-12  Darshan Kadu  <darsh7807@gmail.com>
1809
1810         Implement Cache API support for WPE/GTK
1811         https://bugs.webkit.org/show_bug.cgi?id=178316
1812
1813         Reviewed by Michael Catanzaro.
1814
1815         Added a new API function WKWebsiteDataStoreSetCacheStoragePerOriginQuota which sets the
1816         cache limit per origin.
1817
1818         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1819         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota):
1820         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1821
1822 2018-11-12  Alex Christensen  <achristensen@webkit.org>
1823
1824         [iOS] Implement safe browsing in WebKit
1825         https://bugs.webkit.org/show_bug.cgi?id=191441
1826
1827         Reviewed by Tim Horton.
1828
1829         In r237863 I implemented this for Mac.  This refines the UI and implements it for iOS.
1830
1831         * Shared/WebPreferences.yaml:
1832         * Shared/WebPreferencesDefaultValues.h:
1833         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
1834         (WKContextHandlesSafeBrowsing):
1835         * UIProcess/API/Cocoa/WKWebView.mm:
1836         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1837         (-[WKWebView _clearSafeBrowsingWarning]):
1838         (-[WKWebView layoutSubviews]):
1839         (-[WKWebView setFrameSize:]):
1840         (+[WKWebView _handlesSafeBrowsing]):
1841         (-[WKWebView _safeBrowsingWarningForTesting]):
1842         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1843         * UIProcess/Cocoa/PageClientImplCocoa.h:
1844         * UIProcess/Cocoa/PageClientImplCocoa.mm:
1845         (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
1846         (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
1847         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1848         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1849         (confirmMalwareSentinel):
1850         (visitUnsafeWebsiteSentinel):
1851         (colorForItem):
1852         (addLinkAndReplace):
1853         (-[WKSafeBrowsingExclamationPoint drawRect:]):
1854         (makeButton):
1855         (makeTitleLabel):
1856         (setBackground):
1857         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
1858         (-[WKSafeBrowsingWarning addContent]):
1859         (-[WKSafeBrowsingWarning showDetailsClicked]):
1860         (-[WKSafeBrowsingWarning layoutText]):
1861         (-[WKSafeBrowsingWarning textView:clickedOnLink:atIndex:]):
1862         (-[WKSafeBrowsingWarning layout]):
1863         (-[WKSafeBrowsingWarning layoutSubviews]):
1864         (-[WKSafeBrowsingWarning textView:shouldInteractWithURL:inRange:interaction:]):
1865         (-[WKSafeBrowsingWarning didMoveToWindow]):
1866         (-[WKSafeBrowsingWarning clickedOnLink:]):
1867         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
1868         (-[WKSafeBrowsingTextView intrinsicContentSize]):
1869         (colorNamed): Deleted.
1870         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]): Deleted.
1871         (+[WKSafeBrowsingTextView viewWithString:]): Deleted.
1872         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]): Deleted.
1873         * UIProcess/ios/PageClientImplIOS.mm:
1874         (WebKit::PageClientImpl::isViewWindowActive):
1875         (WebKit::PageClientImpl::isViewFocused):
1876         (WebKit::PageClientImpl::isViewVisible):
1877         (WebKit::PageClientImpl::isViewInWindow):
1878         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
1879         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
1880         (WebKit::PageClientImpl::showSafeBrowsingWarning):
1881         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
1882         (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
1883         (WebKit::PageClientImpl::navigationGestureDidBegin):
1884         (WebKit::PageClientImpl::navigationGestureWillEnd):
1885         (WebKit::PageClientImpl::navigationGestureDidEnd):
1886         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
1887         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
1888         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
1889         * UIProcess/mac/PageClientImplMac.mm:
1890         (WebKit::PageClientImpl::showShareSheet):
1891         (WebKit::PageClientImpl::navigationGestureDidBegin):
1892         (WebKit::PageClientImpl::navigationGestureWillEnd):
1893         (WebKit::PageClientImpl::navigationGestureDidEnd):
1894         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
1895         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
1896
1897 2018-11-12  Tim Horton  <timothy_horton@apple.com>
1898
1899         Make it possible to edit images inline
1900         https://bugs.webkit.org/show_bug.cgi?id=191352
1901         <rdar://problem/30107985>
1902
1903         Reviewed by Dean Jackson.
1904
1905         * Platform/spi/ios/PencilKitSPI.h: Added.
1906         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1907         (WebKit::RemoteLayerBackingStore::drawInContext):
1908         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1909         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1910         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
1911         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
1912         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
1913         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
1914         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
1915         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
1916         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1917         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
1918         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
1919         (WebKit::PlatformCALayerRemote::embeddedViewID const):
1920         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1921         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1922         (WebKit::RemoteLayerTreeContext::layerWasCreated):
1923         Propagate EmbeddedViewID through the PlatformCALayer constructor and
1924         through the layer creation parameters to the UI process.
1925
1926         * Shared/WebPreferences.yaml:
1927         * UIProcess/API/Cocoa/WKWebView.mm:
1928         (-[WKWebView _initializeWithConfiguration:]):
1929         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1930         (-[WKWebViewConfiguration init]):
1931         (-[WKWebViewConfiguration copyWithZone:]):
1932         (-[WKWebViewConfiguration _setEditableImagesEnabled:]):
1933         (-[WKWebViewConfiguration _editableImagesEnabled]):
1934         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1935         Add a preference to enable editable images.
1936
1937         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1938         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1939         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
1940         (WebKit::RemoteLayerTreeHost::clearLayers):
1941         (WebKit::RemoteLayerTreeHost::createLayer):
1942         Keep track of "embedded views" in two maps: embeddedViewID->UIView,
1943         and layerID->embeddedViewID. Clean them up when layers go away.
1944         If a embedded view is reparented, currently it must be added to a new
1945         layer in the same commit as it is removed from the previous layer
1946         in order to persist the view's state (otherwise the view will be
1947         destroyed and recreated). This will be less of a problem after future
1948         patches introduce serialization of image data and whatnot.
1949
1950         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1951         (WebKit::RemoteLayerTreeHost::createLayer):
1952         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
1953         Move the various remote layer tree UIView subclasses out into a separate file.
1954
1955         Add createEmbeddedView, which is used for LayerTypeEditableImageLayer,
1956         and creates a WKDrawingView and sticks it in the maps.
1957
1958         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: Added.
1959         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Added.
1960         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]):
1961         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1962         (-[WKCompositingView hitTest:withEvent:]):
1963         (-[WKCompositingView description]):
1964         (+[WKTransformView layerClass]):
1965         (+[WKSimpleBackdropView layerClass]):
1966         (+[WKShapeView layerClass]):
1967         (-[WKRemoteView initWithFrame:contextID:]):
1968         (+[WKRemoteView layerClass]):
1969         (-[WKBackdropView hitTest:withEvent:]):
1970         (-[WKBackdropView description]):
1971         (-[WKChildScrollView initWithFrame:]):
1972         Move various remote layer tree UIView subclasses here, to their own file.
1973         Make our UIView hit testing override test for views that conform to the
1974         protocol "WKNativelyInteractible", which switches to normal UIView hit
1975         testing. WKDrawingView will be the one such view.
1976
1977         Add WKChildScrollView and pull the one thing we customize out into it,
1978         to make RemoteLayerTreeHost::createLayer less logic-ful.
1979
1980         * UIProcess/ios/WKDrawingView.h: Added.
1981         * UIProcess/ios/WKDrawingView.mm: Added.
1982         (-[WKDrawingView init]):
1983         (-[WKDrawingView layoutSubviews]):
1984         Add a very simple WKDrawingView, which uses PKCanvasView to edit the image.
1985
1986         * WebKit.xcodeproj/project.pbxproj:
1987         * SourcesCocoa.txt:
1988         Add the new files.
1989
1990 2018-11-12  Don Olmstead  <don.olmstead@sony.com>
1991
1992         Shipped PNGs include bad profiles: iCCP: known incorrect sRGB profile
1993         https://bugs.webkit.org/show_bug.cgi?id=189230
1994         <rdar://problem/44050379>
1995
1996         Reviewed by Joseph Pecoraro.
1997
1998         Runs all png images through zopflipng. This results in a smaller file
1999         size and takes care of this issue as a byproduct.
2000
2001         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png:
2002         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png:
2003         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png:
2004         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png:
2005         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png:
2006         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png:
2007
2008 2018-11-12  Eric Carlson  <eric.carlson@apple.com>
2009
2010         [MediaStream] Screen capture should be an experimental feature on OSX only
2011         https://bugs.webkit.org/show_bug.cgi?id=191552
2012         <rdar://problem/45994142>
2013
2014         Reviewed by Youenn Fablet.
2015
2016         * Shared/WebPreferences.yaml: Make ScreenCaptureEnabled.condition ENABLE(MEDIA_STREAM) && PLATFORM(MAC).
2017
2018 2018-11-12  Takashi Komori  <Takashi.Komori@sony.com>
2019
2020         Resurrect WebKitTestRunner for Windows port
2021         https://bugs.webkit.org/show_bug.cgi?id=189257
2022
2023         Reviewed by Fujii Hironori.
2024
2025         * PlatformWin.cmake:
2026
2027 2018-11-12  Antoine Quint  <graouts@apple.com>
2028
2029         [Web Animations] Turn Web Animations experimental
2030         https://bugs.webkit.org/show_bug.cgi?id=191543
2031
2032         Reviewed by Dean Jackson.
2033
2034         * Shared/WebPreferences.yaml:
2035
2036 2018-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2037
2038         Implement a new edit command to change the enclosing list type
2039         https://bugs.webkit.org/show_bug.cgi?id=191487
2040         <rdar://problem/45955922>
2041
2042         Reviewed by Ryosuke Niwa.
2043
2044         * UIProcess/WebEditCommandProxy.cpp:
2045         (WebKit::WebEditCommandProxy::nameForEditAction):
2046
2047         Add undo/redo edit action strings for ConvertToOrderedList and ConvertToUnorderedList.
2048
2049         * WebProcess/WebPage/WebPage.cpp:
2050         (WebKit::WebPage::increaseListLevel):
2051         (WebKit::WebPage::decreaseListLevel):
2052         (WebKit::WebPage::changeListType):
2053
2054         Remove preflight checks for these list editing commands. These are not necessary because these commands fall
2055         back to being noops if these checks return false. This avoids an extraneous ancestor walk to determine the
2056         enclosing list element when changing list type.
2057
2058 2018-11-11  Daniel Bates  <dabates@apple.com>
2059
2060         [iOS] Draw caps lock indicator in password fields
2061         https://bugs.webkit.org/show_bug.cgi?id=190565
2062         <rdar://problem/45262343>
2063
2064         Reviewed by Dean Jackson.
2065
2066         Notify the WebContent process with the current modifer state on window activation changes. Notify
2067         the WebContent process when hardware keyboard availability changes (e.g. a keyboard is attached).
2068
2069         * UIProcess/API/Cocoa/WKWebView.mm:
2070         (-[WKWebView _initializeWithConfiguration:]): Register for hardware keyboard availability changed notifications.
2071         (-[WKWebView dealloc]): Unregister from hardware availability changed notifications.
2072         (hardwareKeyboardAvailabilityChangedCallback): Added.
2073         * UIProcess/WebPageProxy.cpp:
2074         (WebKit::WebPageProxy::updateCurrentModifierState): Compile this code when building for iOS.
2075         * UIProcess/WebPageProxy.h:
2076         * UIProcess/ios/WKContentViewInteraction.mm:
2077         (-[WKContentView _handleKeyUIEvent:]): Update the current modifier state if this event is a hardware
2078         keyboard flags changed event.
2079         * UIProcess/ios/WebPageProxyIOS.mm:
2080         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged): Added.
2081
2082         * WebProcess/WebPage/WebPage.h:
2083         * WebProcess/WebPage/WebPage.messages.in:
2084         * WebProcess/WebPage/ios/WebPageIOS.mm:
2085         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
2086         Added new message HardwareKeyboardAvailabilityChanged. Notify the focused HTML input element (if we have
2087         one) that the caps lock state may have changed when we receive message HardwareKeyboardAvailabilityChanged
2088         so that we toggle visibility of the caps lock indicator.
2089
2090 2018-11-11  Dan Bernstein  <mitz@apple.com>
2091
2092         ProcessPoolConfiguration::copy() doesn’t copy m_customWebContentServiceBundleIdentifier
2093         https://bugs.webkit.org/show_bug.cgi?id=191514
2094
2095         Reviewed by Geoffrey Garen.
2096
2097         Test: WebKitCocoa/WKProcessPoolConfiguration.mm
2098
2099         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2100         (API::ProcessPoolConfiguration::copy): Copy m_customWebContentServiceBundleIdentifier.
2101
2102 2018-11-11  Benjamin Poulain  <benjamin@webkit.org>
2103
2104         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
2105         https://bugs.webkit.org/show_bug.cgi?id=191492
2106
2107         Reviewed by Alex Christensen.
2108
2109         * Platform/mac/StringUtilities.mm:
2110         * UIProcess/ApplicationStateTracker.mm:
2111         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2112         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2113
2114 2018-11-10  Benjamin Poulain  <benjamin@webkit.org>
2115
2116         Fix a fixme: rename wtfObjcMsgSend to wtfObjCMsgSend
2117         https://bugs.webkit.org/show_bug.cgi?id=191492
2118
2119         Reviewed by Alex Christensen.
2120
2121         * Platform/mac/StringUtilities.mm:
2122         * UIProcess/ApplicationStateTracker.mm:
2123         (WebKit::ApplicationStateTracker::applicationDidEnterBackground):
2124         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground):
2125         (WebKit::ApplicationStateTracker::applicationWillEnterForeground):
2126         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
2127         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2128
2129 2018-11-10  Ryan Haddad  <ryanhaddad@apple.com>
2130
2131         Unreviewed, rolling out r238065.
2132
2133         Breaks internal builds.
2134
2135         Reverted changeset:
2136
2137         "Make it possible to edit images inline"
2138         https://bugs.webkit.org/show_bug.cgi?id=191352
2139         https://trac.webkit.org/changeset/238065
2140
2141 2018-11-10  Tim Horton  <timothy_horton@apple.com>
2142
2143         Make it possible to edit images inline
2144         https://bugs.webkit.org/show_bug.cgi?id=191352
2145         <rdar://problem/30107985>
2146
2147         Reviewed by Dean Jackson.
2148
2149         * Platform/spi/ios/PencilKitSPI.h: Added.
2150         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2151         (WebKit::RemoteLayerBackingStore::drawInContext):
2152         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2153         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2154         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
2155         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
2156         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
2157         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
2158         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
2159         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
2160         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
2161         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
2162         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
2163         (WebKit::PlatformCALayerRemote::embeddedViewID const):
2164         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
2165         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
2166         (WebKit::RemoteLayerTreeContext::layerWasCreated):
2167         Propagate EmbeddedViewID through the PlatformCALayer constructor and
2168         through the layer creation parameters to the UI process.
2169
2170         * Shared/WebPreferences.yaml:
2171         * UIProcess/API/Cocoa/WKWebView.mm:
2172         (-[WKWebView _initializeWithConfiguration:]):
2173         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2174         (-[WKWebViewConfiguration init]):
2175         (-[WKWebViewConfiguration copyWithZone:]):
2176         (-[WKWebViewConfiguration _setEditableImagesEnabled:]):
2177         (-[WKWebViewConfiguration _editableImagesEnabled]):
2178         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2179         Add a preference to enable editable images.
2180
2181         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
2182         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
2183         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
2184         (WebKit::RemoteLayerTreeHost::clearLayers):
2185         (WebKit::RemoteLayerTreeHost::createLayer):
2186         Keep track of "embedded views" in two maps: embeddedViewID->UIView,
2187         and layerID->embeddedViewID. Clean them up when layers go away.
2188         If a embedded view is reparented, currently it must be added to a new
2189         layer in the same commit as it is removed from the previous layer
2190         in order to persist the view's state (otherwise the view will be
2191         destroyed and recreated). This will be less of a problem after future
2192         patches introduce serialization of image data and whatnot.
2193
2194         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2195         (WebKit::RemoteLayerTreeHost::createLayer):
2196         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
2197         Move the various remote layer tree UIView subclasses out into a separate file.
2198
2199         Add createEmbeddedView, which is used for LayerTypeEditableImageLayer,
2200         and creates a WKDrawingView and sticks it in the maps.
2201
2202         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h: Added.
2203         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm: Added.
2204         (-[UIView _web_recursiveFindDescendantInteractibleViewAtPoint:withEvent:]):
2205         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
2206         (-[WKCompositingView hitTest:withEvent:]):
2207         (-[WKCompositingView description]):
2208         (+[WKTransformView layerClass]):
2209         (+[WKSimpleBackdropView layerClass]):
2210         (+[WKShapeView layerClass]):
2211         (-[WKRemoteView initWithFrame:contextID:]):
2212         (+[WKRemoteView layerClass]):
2213         (-[WKBackdropView hitTest:withEvent:]):
2214         (-[WKBackdropView description]):
2215         (-[WKChildScrollView initWithFrame:]):
2216         Move various remote layer tree UIView subclasses here, to their own file.
2217         Make our UIView hit testing override test for views that conform to the
2218         protocol "WKNativelyInteractible", which switches to normal UIView hit
2219         testing. WKDrawingView will be the one such view.
2220
2221         Add WKChildScrollView and pull the one thing we customize out into it,
2222         to make RemoteLayerTreeHost::createLayer less logic-ful.
2223
2224         * UIProcess/ios/WKDrawingView.h: Added.
2225         * UIProcess/ios/WKDrawingView.mm: Added.
2226         (-[WKDrawingView init]):
2227         (-[WKDrawingView layoutSubviews]):
2228         Add a very simple WKDrawingView, which uses PKCanvasView to edit the image.
2229
2230         * WebKit.xcodeproj/project.pbxproj:
2231         * SourcesCocoa.txt:
2232         Add the new files.
2233
2234 2018-11-09  Zalan Bujtas  <zalan@apple.com>
2235
2236         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
2237         https://bugs.webkit.org/show_bug.cgi?id=191078
2238         <rdar://problem/45736178>
2239
2240         Reviewed by Antti Koivisto.
2241
2242         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2243         (WebKit::WebChromeClient::layerFlushThrottlingIsActive const):
2244         * WebProcess/WebCoreSupport/WebChromeClient.h:
2245         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2246         (WebKit::AcceleratedDrawingArea::scheduleInitialDeferredPaint):
2247         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2248         * WebProcess/WebPage/DrawingArea.h:
2249         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
2250         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2251         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2252         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
2253         (WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen):
2254         (WebKit::RemoteLayerTreeDrawingArea::initialDeferredPaint):
2255         (WebKit::RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint):
2256         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
2257         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2258         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2259         (WebKit::TiledCoreAnimationDrawingArea::scheduleInitialDeferredPaint):
2260
2261 2018-11-09  John Wilander  <wilander@apple.com>
2262
2263         Add ability to configure document.cookie lifetime cap through user defaults
2264         https://bugs.webkit.org/show_bug.cgi?id=191480
2265         <rdar://problem/45240871>
2266
2267         Reviewed by Chris Dumez.
2268
2269         This change makes the capped lifetime in seconds configurable through
2270         user defaults.
2271
2272         * NetworkProcess/NetworkProcess.cpp:
2273         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
2274         (WebKit::NetworkProcess::setShouldCapLifetimeForClientSideCookies): Deleted.
2275             Renamed setAgeCapForClientSideCookies().
2276         * NetworkProcess/NetworkProcess.h:
2277         * NetworkProcess/NetworkProcess.messages.in:
2278         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2279         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2280         * UIProcess/Network/NetworkProcessProxy.cpp:
2281         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
2282         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
2283         (WebKit::NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies): Deleted.
2284             Renamed setAgeCapForClientSideCookies().
2285         (WebKit::NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies): Deleted.
2286             Renamed didSetAgeCapForClientSideCookies().
2287         * UIProcess/Network/NetworkProcessProxy.h:
2288         * UIProcess/Network/NetworkProcessProxy.messages.in:
2289         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2290         (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies):
2291         (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
2292         (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess):
2293             New function that handles all the things that need to be done when a network
2294             process has been created.
2295         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2296         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2297         (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
2298             Now just calls the corresponding function on its memory store where all the
2299             configuration parameters are available.
2300         * UIProcess/WebResourceLoadStatisticsStore.h:
2301         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2302         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
2303         (WebKit::WebsiteDataStore::setShouldCapLifetimeForClientSideCookies): Deleted.
2304             Renamed setAgeCapForClientSideCookies().
2305         * UIProcess/WebsiteData/WebsiteDataStore.h:
2306
2307 2018-11-09  Ryan Haddad  <ryanhaddad@apple.com>
2308
2309         Unreviewed, rolling out r238047.
2310
2311         Introduced layout test failures on iOS simulator.
2312
2313         Reverted changeset:
2314
2315         "[iOS] Draw caps lock indicator in password fields"
2316         https://bugs.webkit.org/show_bug.cgi?id=190565
2317         https://trac.webkit.org/changeset/238047
2318
2319 2018-11-09  Chris Dumez  <cdumez@apple.com>
2320
2321         Suspended page persists even after back/forward list item is gone
2322         https://bugs.webkit.org/show_bug.cgi?id=191488
2323         <rdar://problem/45953006>
2324
2325         Reviewed by Geoffrey Garen.
2326
2327         Currently, the WebProcessPool owns the SuspendedPageProxy objects and makes sure we cap how
2328         many we can have. The WebBackForwardListItem merely has a WeakPtr to its associated
2329         SuspendedPageProxy. However, there is no point in having the WebProcessPool keeping a
2330         SuspendedPageProxy object alive if there is no longer any WebBackForwardListItem pointing
2331         to it.
2332
2333         To address the issue, WebBackForwardListItem nows tells the WebProcessPool to destroy
2334         its SuspendedPageProxy when necessary. WebBackForwardList also takes care of nulling
2335         out the WebBackForwardListItem's SuspendedPageProxy after the item has been removed
2336         from the list (in case somebody keeps the item alive).
2337
2338         * Shared/WebBackForwardListItem.cpp:
2339         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
2340         (WebKit::WebBackForwardListItem::setSuspendedPage):
2341         (WebKit::WebBackForwardListItem::suspendedPageIsNoLongerNeeded):
2342         * Shared/WebBackForwardListItem.h:
2343         * UIProcess/SuspendedPageProxy.cpp:
2344         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
2345         * UIProcess/WebBackForwardList.cpp:
2346         (WebKit::WebBackForwardList::didRemoveItem):
2347         * UIProcess/WebProcessPool.cpp:
2348         (WebKit::WebProcessPool::removeSuspendedPageProxy):
2349         * UIProcess/WebProcessPool.h:
2350
2351 2018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2352
2353         [Cocoa] Implement SPI on WKWebView to increase and decrease list levels
2354         https://bugs.webkit.org/show_bug.cgi?id=191471
2355         <rdar://problem/45952472>
2356
2357         Reviewed by Tim Horton.
2358
2359         Implement these method stubs by calling into Editor.
2360
2361         Test: WKWebViewEditActions.ModifyListLevel
2362
2363         * WebProcess/WebPage/WebPage.cpp:
2364         (WebKit::WebPage::increaseListLevel):
2365         (WebKit::WebPage::decreaseListLevel):
2366         (WebKit::WebPage::changeListType):
2367
2368 2018-11-09  Keith Rollin  <krollin@apple.com>
2369
2370         Unreviewed build fix after https://bugs.webkit.org/show_bug.cgi?id=191324
2371
2372         Remove the use of .xcfilelists until their side-effects are better
2373         understood.
2374
2375         * WebKit.xcodeproj/project.pbxproj:
2376
2377 2018-11-09  Basuke Suzuki  <basuke.suzuki@sony.com>
2378
2379         [Curl][WebKit] Implement Proxy configuration API.
2380         https://bugs.webkit.org/show_bug.cgi?id=189053
2381
2382         Reviewed by Youenn Fablet.
2383
2384         Added proxy configuration API to WebsiteDataStore. Three API were added in WKWebsiteDataStoreRefCurl.h:
2385         - WKWebsiteDataStoreEnableDefaultNetworkProxySettings(WKWebsiteDataStoreRef)
2386         - WKWebsiteDataStoreEnableCustomNetworkProxySettings(WKWebsiteDataStoreRef, WKURLRef, WKStringRef ignoreHosts)
2387         - WKWebsiteDataStoreDisableNetworkProxySettings(WKWebsiteDataStoreRef)
2388
2389         * NetworkProcess/NetworkProcess.h:
2390         * NetworkProcess/NetworkProcess.messages.in:
2391         * NetworkProcess/NetworkSessionCreationParameters.h:
2392         (WebKit::NetworkSessionCreationParameters::encode const):
2393         (WebKit::NetworkSessionCreationParameters::decode):
2394         * NetworkProcess/curl/NetworkProcessCurl.cpp:
2395         (WebKit::NetworkProcess::setNetworkProxySettings):
2396         * NetworkProcess/curl/NetworkSessionCurl.cpp:
2397         (WebKit::NetworkSessionCurl::NetworkSessionCurl):
2398         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
2399         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2400         * PlatformWin.cmake:
2401         * Shared/WebCoreArgumentCoders.h:
2402         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
2403         (IPC::ArgumentCoder<CurlProxySettings>::encode):
2404         (IPC::ArgumentCoder<CurlProxySettings>::decode):
2405         * UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.cpp:
2406           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2407         (WKWebsiteDataStoreEnableDefaultNetworkProxySettings):
2408         (WKWebsiteDataStoreEnableCustomNetworkProxySettings):
2409         (WKWebsiteDataStoreDisableNetworkProxySettings):
2410         * UIProcess/API/C/curl/WKWebsiteDataStoreRefCurl.h:
2411           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2412         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2413         (WebKit::WebsiteDataStore::parameters):
2414         * UIProcess/WebsiteData/WebsiteDataStore.h:
2415         (WebKit::WebsiteDataStore::networkProxySettings const):
2416         * UIProcess/WebsiteData/curl/WebsiteDataStoreCurl.cpp:
2417           Copied from Source/WebKit/NetworkProcess/curl/NetworkSessionCurl.cpp.
2418         (WebKit::WebsiteDataStore::platformSetParameters):
2419         (WebKit::WebsiteDataStore::setNetworkProxySettings):
2420
2421 2018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2422
2423         [Cocoa] Introduce WKWebView SPI to insert nested ordered and unordered lists
2424         https://bugs.webkit.org/show_bug.cgi?id=191410
2425         <rdar://problem/45898610>
2426
2427         Reviewed by Dean Jackson.
2428
2429         Prefixes a few iOS-only SPI methods declared on WKWebView in r236867 with underscores, and also exposes some
2430         more cross-platform Cocoa editing SPI. Once the unprefixed SPI methods are no longer used by internal clients,
2431         these will need to be removed (see followup bug: webkit.org/b/191450). See below for more details.
2432
2433         Covered by new and existing API tests in WKWebViewEditActions.
2434
2435         * UIProcess/API/Cocoa/WKWebView.mm:
2436
2437         Hoist the definition (and undefinition) of `FORWARD_ACTION_TO_WKCONTENTVIEW` to encompass both the WKWebView
2438         implementation and the WKWebView (WKPrivate) implementation. This allows us to use this macro when implementing
2439         SPI methods in the WKPrivate category, as well as methods that are part of the main WKWebView implementation.
2440
2441         (-[WKWebView canPerformAction:withSender:]):
2442         (-[WKWebView targetForAction:withSender:]):
2443
2444         Add forwarding for the new editing commands in -canPerformAction: and -targetForAction:.
2445
2446         (-[WKWebView _toggleStrikeThrough:]):
2447         (-[WKWebView _increaseListLevel:]):
2448         (-[WKWebView _decreaseListLevel:]):
2449         (-[WKWebView _changeListType:]):
2450         (-[WKWebView _setFont:sender:]):
2451         (-[WKWebView _setFontSize:sender:]):
2452         (-[WKWebView _setTextColor:sender:]):
2453
2454         Add definitions for the new editing methods on WKWebView, using macros (`WEBCORE_PRIVATE_COMMAND` on macOS and
2455         `FORWARD_ACTION_TO_WKCONTENTVIEW` on iOS) to help reduce the code duplication.
2456
2457         (-[WKWebView _pasteAsQuotation:]): Deleted.
2458
2459         Remove this method definition, which is now replaced by macros on iOS and macOS.
2460
2461         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2462
2463         Introduce the new SPI to WKWebView (WKPrivate), and add FIXMEs to remove old, unprefixed variants of the SPI.
2464
2465         * UIProcess/WebPageProxy.cpp:
2466         (WebKit::WebPageProxy::increaseListLevel):
2467         (WebKit::WebPageProxy::decreaseListLevel):
2468         (WebKit::WebPageProxy::changeListType):
2469
2470         Add plumbing for these list editing commands.
2471
2472         * UIProcess/WebPageProxy.h:
2473         * UIProcess/ios/WKContentViewInteraction.h:
2474         * UIProcess/ios/WKContentViewInteraction.mm:
2475         (-[WKContentView _increaseListLevelForWebView:]):
2476         (-[WKContentView _decreaseListLevelForWebView:]):
2477         (-[WKContentView _changeListTypeForWebView:]):
2478         (-[WKContentView _toggleStrikeThroughForWebView:]):
2479         (-[WKContentView _setFontForWebView:sender:]):
2480         (-[WKContentView _setFontSizeForWebView:sender:]):
2481         (-[WKContentView _setTextColorForWebView:sender:]):
2482         (-[WKContentView toggleStrikeThroughForWebView:]):
2483         (-[WKContentView setFontForWebView:sender:]):
2484         (-[WKContentView setFontSizeForWebView:sender:]):
2485         (-[WKContentView setTextColorForWebView:sender:]):
2486         (-[WKContentView canPerformActionForWebView:withSender:]):
2487
2488         Check for the new action selectors here, and additionally add validation for `_pasteAsQuotation:`. Let the
2489         unprefixed versions of these methods simply call the prefixed versions (these method implementations will be
2490         removed in a followup once doing so would not affect any clients of WebKit).
2491
2492         * WebKit.xcodeproj/project.pbxproj:
2493         * WebProcess/WebPage/WebPage.cpp:
2494         (WebKit::WebPage::increaseListLevel):
2495         (WebKit::WebPage::decreaseListLevel):
2496         (WebKit::WebPage::changeListType):
2497         * WebProcess/WebPage/WebPage.h:
2498         * WebProcess/WebPage/WebPage.messages.in:
2499
2500         Add stubs for several list editing commands that are yet to be hooked up to WebCore. These will be implemented
2501         in a future patch.
2502
2503 2018-11-09  Antti Koivisto  <antti@apple.com>
2504
2505         Use OptionSet for layout milestones
2506         https://bugs.webkit.org/show_bug.cgi?id=191470
2507
2508         Reviewed by Dean Jackson.
2509
2510         * Shared/API/Cocoa/_WKRenderingProgressEventsInternal.h:
2511         (renderingProgressEvents):
2512         * Shared/API/c/WKSharedAPICast.h:
2513         (WebKit::toWKLayoutMilestones):
2514         (WebKit::toLayoutMilestones):
2515         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2516         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const):
2517         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones):
2518         * Shared/WebPageCreationParameters.cpp:
2519         (WebKit::WebPageCreationParameters::encode const):
2520         (WebKit::WebPageCreationParameters::decode):
2521         * Shared/WebPageCreationParameters.h:
2522         * UIProcess/API/APILoaderClient.h:
2523         (API::LoaderClient::didReachLayoutMilestone):
2524         * UIProcess/API/APINavigationClient.h:
2525         (API::NavigationClient::renderingProgressDidChange):
2526         * UIProcess/API/C/WKPage.cpp:
2527         (WKPageSetPageLoaderClient):
2528         (WKPageSetPageNavigationClient):
2529         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
2530         (pageRenderingProgressEvents):
2531         * UIProcess/API/Cocoa/WKWebView.mm:
2532         (layoutMilestones):
2533         * UIProcess/Cocoa/NavigationState.h:
2534         * UIProcess/Cocoa/NavigationState.mm:
2535         (WebKit::NavigationState::NavigationClient::renderingProgressDidChange):
2536         * UIProcess/WebPageProxy.cpp:
2537         (WebKit::WebPageProxy::listenForLayoutMilestones):
2538         (WebKit::WebPageProxy::didLayoutForCustomContentProvider):
2539         (WebKit::WebPageProxy::didReachLayoutMilestone):
2540         * UIProcess/WebPageProxy.h:
2541         * UIProcess/WebPageProxy.messages.in:
2542         * UIProcess/ios/WebPageProxyIOS.mm:
2543         (WebKit::WebPageProxy::didCommitLayerTree):
2544         * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
2545         (API::InjectedBundle::PageLoaderClient::didReachLayoutMilestone):
2546         (API::InjectedBundle::PageLoaderClient::layoutMilestones const):
2547         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
2548         (WebKit::InjectedBundlePageLoaderClient::didReachLayoutMilestone):
2549         (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
2550         * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
2551         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2552         (WebKit::WebFrameLoaderClient::dispatchDidReachLayoutMilestone):
2553         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2554         * WebProcess/WebPage/DrawingArea.h:
2555         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone):
2556         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2557         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2558         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2559         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone):
2560         * WebProcess/WebPage/WebPage.cpp:
2561         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2562         (WebKit::WebPage::listenForLayoutMilestones):
2563         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2564         * WebProcess/WebPage/WebPage.h:
2565         * WebProcess/WebPage/WebPage.messages.in:
2566         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2567         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2568         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones):
2569         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone):
2570
2571 2018-11-09  Daniel Bates  <dabates@apple.com>
2572
2573         [iOS] Draw caps lock indicator in password fields
2574         https://bugs.webkit.org/show_bug.cgi?id=190565
2575         <rdar://problem/45262343>
2576
2577         Reviewed by Dean Jackson.
2578
2579         Notify the WebContent process with the current modifer state on window activation changes. Notify
2580         the WebContent process when hardware keyboard availability changes (e.g. a keyboard is attached).
2581
2582         * UIProcess/API/Cocoa/WKWebView.mm:
2583         (-[WKWebView _initializeWithConfiguration:]): Register for hardware keyboard availability changed notifications.
2584         (-[WKWebView dealloc]): Unregister from hardware availability changed notifications.
2585         (hardwareKeyboardAvailabilityChangedCallback): Added.
2586         * UIProcess/WebPageProxy.cpp:
2587         (WebKit::WebPageProxy::updateCurrentModifierState): Compile this code when building for iOS.
2588         * UIProcess/WebPageProxy.h:
2589         * UIProcess/ios/WKContentViewInteraction.mm:
2590         (-[WKContentView _handleKeyUIEvent:]): Update the current modifier state if this event is a hardware
2591         keyboard flags changed event.
2592         * UIProcess/ios/WebPageProxyIOS.mm:
2593         (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged): Added.
2594
2595         * WebProcess/WebPage/WebPage.h:
2596         * WebProcess/WebPage/WebPage.messages.in:
2597         * WebProcess/WebPage/ios/WebPageIOS.mm:
2598         (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
2599         Added new message HardwareKeyboardAvailabilityChanged. Notify the focused HTML input element (if we have
2600         one) that the caps lock state may have changed when we receive message HardwareKeyboardAvailabilityChanged
2601         so that we toggle visibility of the caps lock indicator.
2602
2603 2018-11-09  Tim Horton  <timothy_horton@apple.com>
2604
2605         Make use of _UIRemoteView instead of CALayerHost if possible for WKRemoteView
2606         https://bugs.webkit.org/show_bug.cgi?id=191449
2607         <rdar://problem/45884977>
2608
2609         Reviewed by Eric Carlson.
2610
2611         UIRemoteView has some nice process assertion management that it would
2612         be nice to not duplicate. So, we can just use it instead of CALayerHost!
2613
2614         * Platform/spi/ios/UIKitSPI.h:
2615         * UIProcess/DrawingAreaProxy.h:
2616         (WebKit::DrawingAreaProxy::page const):
2617         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2618         (-[WKUIRemoteView hitTest:withEvent:]):
2619         (-[WKUIRemoteView description]):
2620         (createRemoteView):
2621         (WebKit::RemoteLayerTreeHost::createLayer):
2622
2623 2018-11-09  Eric Carlson  <eric.carlson@apple.com>
2624
2625         [MediaStream] Make screen capture an experimental feature
2626         https://bugs.webkit.org/show_bug.cgi?id=191472
2627         <rdar://problem/45946499>
2628
2629         Reviewed by Jer Noble.
2630
2631         * Shared/WebPreferences.yaml: Make ScreenCaptureEnabled an experimental feature.
2632
2633 2018-11-09  Daniel Bates  <dabates@apple.com>
2634
2635         [iOS] Pressing forward delete key in text field does nothing and we should not invoke an editor
2636         action when forward delete is pressed outside a text field
2637         https://bugs.webkit.org/show_bug.cgi?id=190566
2638         <rdar://problem/45262367>
2639
2640         Reviewed by Wenson Hsieh.
2641
2642         Override -_deleteForwardAndNotify to perform a forward deletion and remove the dead code that
2643         expected UIKit to send us a character string with 0xF728 for the forward delete key. UIKit
2644         ceased doing this many years ago. We may revist this decision once <rdar://problem/45772078>
2645         is fixed.
2646
2647         * UIProcess/ios/WKContentViewInteraction.mm:
2648         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
2649         (-[WKContentView _deleteForwardAndNotify:]):
2650
2651 2018-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2652
2653         Unreviewed, try to fix the 32-bit macOS build
2654
2655         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2656         (WebKit::PDFPlugin::showDefinitionForAttributedString):
2657
2658 2018-11-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2659
2660         Add an SPI to allow WebView clients to add additional supported image formats
2661         https://bugs.webkit.org/show_bug.cgi?id=190454
2662
2663         Reviewed by Simon Fraser.
2664
2665         * Platform/mac/StringUtilities.h:
2666         * Platform/mac/StringUtilities.mm:
2667         (WebKit::webCoreStringVectorFromNSStringArray):
2668         A helper function which converts an NSArray of NSStrings to a Vector of
2669         WTFString.
2670
2671         * Shared/WebPageCreationParameters.cpp:
2672         (WebKit::WebPageCreationParameters::encode const):
2673         (WebKit::WebPageCreationParameters::decode):
2674         * Shared/WebPageCreationParameters.h:
2675         Handle encoding and decoding the AdditionalSupportedImageTypes which will
2676         allow transferring it from the UI process to the web process.
2677
2678         * UIProcess/API/APIPageConfiguration.h:
2679         (API::PageConfiguration::additionalSupportedImageTypes const):
2680         (API::PageConfiguration::setAdditionalSupportedImageTypes):
2681         Store the AdditionalSupportedImageTypes in the APIPageConfiguration
2682         which is used when creating the WebPageProxy in the UIPorcess.
2683
2684         * UIProcess/API/Cocoa/WKWebView.mm:
2685         (-[WKWebView _initializeWithConfiguration:]):
2686         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2687         (-[WKWebViewConfiguration copyWithZone:]):
2688         (-[WKWebViewConfiguration _additionalSupportedImageTypes]):
2689         (-[WKWebViewConfiguration _setAdditionalSupportedImageTypes:]):
2690         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2691         Setter/Getter for the AdditionalSupportedImageTypes.
2692
2693         * UIProcess/WebPageProxy.cpp:
2694         (WebKit::WebPageProxy::creationParameters):
2695         Copy the AdditionalSupportedImageTypes from APIPageConfiguration to 
2696         WebPageCreationParameters.
2697
2698         * UIProcess/WebPageProxy.h:
2699         Delete unimplemented function.
2700
2701         * WebProcess/WebPage/WebPage.cpp:
2702         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2703         Copy the AdditionalSupportedImageTypes from WebPageCreationParameters to
2704         WebCore.
2705
2706 2018-11-08  Megan Gardner  <megan_gardner@apple.com>
2707
2708         Adopt Reveal Framework to replace Lookup
2709         https://bugs.webkit.org/show_bug.cgi?id=191097
2710         <rdar://problem/45924508>
2711
2712         Reviewed by Tim Horton.
2713
2714         Pass in what it needed to clear the textIndicators. This is better than
2715         the current notification structure.
2716
2717         * UIProcess/Cocoa/WebViewImpl.mm:
2718         (-[WKWindowVisibilityObserver dealloc]):
2719         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
2720         * UIProcess/mac/PageClientImplMac.mm:
2721         (WebKit::PageClientImpl::didPerformDictionaryLookup):
2722         * UIProcess/mac/WKImmediateActionController.mm:
2723         (-[WKImmediateActionController _animationControllerForText]):
2724         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2725         (WebKit::PDFPlugin::showDefinitionForAttributedString):
2726
2727         Generate and pass in the text indicator information, as this is needed now.
2728
2729         * WebProcess/WebPage/mac/WebPageMac.mm:
2730         (WebKit::WebPage::dictionaryPopupInfoForSelectionInPDFPlugin):
2731
2732 2018-11-08  Keith Rollin  <krollin@apple.com>
2733
2734         Create .xcfilelist files
2735         https://bugs.webkit.org/show_bug.cgi?id=191324
2736         <rdar://problem/45852819>
2737
2738         Reviewed by Alex Christensen.
2739
2740         As part of preparing for enabling XCBuild, create and use .xcfilelist
2741         files. These files are using during Run Script build phases in an
2742         Xcode project. If a Run Script build phase produces new files that are
2743         used later as inputs to subsequent build phases, XCBuild needs to know
2744         about these files. These files can be either specified in an "output
2745         files" section of the Run Script phase editor, or in .xcfilelist files
2746         that are associated with the Run Script build phase.
2747
2748         This patch takes the second approach. It consists of three sets of changes:
2749
2750         - Modify the DerivedSources.make files to have a
2751           'print_all_generated_files" target that produces a list of the files
2752           they create.
2753
2754         - Create a shell script that produces .xcfilelist files from the
2755           output of the previous step, as well as for the files created in the
2756           Generate Unified Sources build steps.
2757
2758         - Add the new .xcfilelist files to the associated projects.
2759
2760         Note that, with these changes, the Xcode workspace and projects can no
2761         longer be fully loaded into Xcode 9. Xcode will attempt to load the
2762         projects that have .xcfilelist files associated with them, but will
2763         fail and display a placeholder for those projects instead. It's
2764         expected that all developers are using Xcode 10 by now and that not
2765         being able to load into Xcode 9 is not a practical issue. Keep in mind
2766         that this is strictly an IDE issue, and that the projects can still be
2767         built with `xcodebuild`.
2768
2769         Also note that the shell script that creates the .xcfilelist files can
2770         also be used to verify that the set of files that's currently checked
2771         in is up-to-date. This checking can be used as part of a check-in hook
2772         or part of check-webkit-style to sooner catch cases where the
2773         .xcfilelist files need to be regenerated.
2774
2775         * DerivedSources.make:
2776         * DerivedSources.xcfilelist: Added.
2777         * UnifiedSources.xcfilelist: Added.
2778         * WebKit.xcodeproj/project.pbxproj:
2779
2780 2018-11-08  Timothy Hatcher  <timothy@apple.com>
2781
2782         Add experimental support for a `supported-color-schemes` CSS property.
2783         https://bugs.webkit.org/show_bug.cgi?id=191319
2784         rdar://problem/45852261
2785
2786         Reviewed by Dean Jackson.
2787
2788         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
2789         (WebKit::InjectedBundleRangeHandle::renderedImage):
2790         * WebProcess/WebPage/WebPage.cpp:
2791         (WebKit::WebPage::drawRect):
2792
2793 2018-11-08  Eric Carlson  <eric.carlson@apple.com>
2794
2795         [MediaStream] Use DeviceIdHashSaltStorage to generate device ID hash salt
2796         https://bugs.webkit.org/show_bug.cgi?id=190825
2797         <rdar://problem/45486085>
2798
2799         Reviewed by Youenn Fablet.
2800
2801         * UIProcess/API/C/WKUserMediaPermissionCheck.cpp:
2802         (WKUserMediaPermissionCheckSetUserMediaAccessInfo):
2803         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp:
2804         (webkitDeviceInfoPermissionRequestAllow):
2805         (webkitDeviceInfoPermissionRequestDeny):
2806         * UIProcess/Cocoa/UIDelegate.mm:
2807         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
2808         * UIProcess/DeviceIdHashSaltStorage.cpp:
2809         (WebKit::DeviceIdHashSaltStorage::regenerateDeviceIdHashSaltForOrigin):
2810         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigin):
2811         * UIProcess/DeviceIdHashSaltStorage.h:
2812         * UIProcess/UserMediaPermissionCheckProxy.cpp:
2813         (WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
2814         * UIProcess/UserMediaPermissionCheckProxy.h:
2815         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2816         (WebKit::UserMediaPermissionRequestManagerProxy::createPermissionRequest):
2817         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
2818         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2819         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2820         (WebKit::UserMediaPermissionRequestManagerProxy::updateDeviceIDHashSalt):
2821         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
2822         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
2823         * UIProcess/UserMediaPermissionRequestProxy.cpp:
2824         (WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
2825         * UIProcess/UserMediaPermissionRequestProxy.h:
2826         (WebKit::UserMediaPermissionRequestProxy::create):
2827         (WebKit::UserMediaPermissionRequestProxy::deviceIdentifierHashSalt const): Deleted.
2828
2829 2018-11-08  Carlos Garcia Campos  <cgarcia@igalia.com>
2830
2831         [GTK] Crash when running with sandbox enabled
2832         https://bugs.webkit.org/show_bug.cgi?id=191353
2833
2834         Reviewed by Michael Catanzaro.
2835
2836         g_key_file_set_string_list() expects a null-terminated array as parameter.
2837
2838         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2839         (WebKit::createFlatpakInfo): Append nullptr to sharedPermissions array.
2840
2841 2018-11-07  Chris Dumez  <cdumez@apple.com>
2842
2843         Unreviewed, fix iOS build with recent SDKs.
2844
2845         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2846         (-[WKFullScreenWindowController _EVOrganizationName]):
2847
2848 2018-11-07  John Wilander  <wilander@apple.com>
2849
2850         Resource Load Statistics: Enable cap on partitioned cache max age
2851         https://bugs.webkit.org/show_bug.cgi?id=191395
2852         <rdar://problem/45885977>
2853
2854         Reviewed by Chris Dumez.
2855
2856         This change does not bump the network cache revision number.
2857         It's not needed since it was done just a week ago.
2858
2859         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2860         (WebKit::ResourceLoadStatisticsMemoryStore::setCacheMaxAgeCap):
2861         (WebKit::ResourceLoadStatisticsMemoryStore::updateCacheMaxAgeCap):
2862         * UIProcess/ResourceLoadStatisticsMemoryStore.h:
2863         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2864         (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
2865
2866 2018-11-07  Daniel Bates  <dabates@apple.com>
2867
2868         [iOS] Support deleting to the start of the line and to the end of the line
2869         https://bugs.webkit.org/show_bug.cgi?id=191389
2870         <rdar://problem/45883972>
2871
2872         Reviewed by Wenson Hsieh.
2873
2874         Add support for the key commands Command + Delete and Control + K to delete to the start
2875         of the line and to delete to the end of the line, respectively.
2876
2877         * UIProcess/ios/WKContentViewInteraction.mm:
2878         (-[WKContentView _deleteToStartOfLine]): Added.
2879         (-[WKContentView _deleteToEndOfLine]): Added.
2880
2881 2018-11-07  Daniel Bates  <dabates@apple.com>
2882
2883         [iOS] Option + Delete should delete previous word
2884         https://bugs.webkit.org/show_bug.cgi?id=191381
2885         <rdar://problem/23681351>
2886
2887         Reviewed by Wenson Hsieh.
2888
2889         Implement support for pressing Option + Delete to delete the previous word. This makes text editing
2890         in WebKit more closely match the platform conventions.
2891
2892         * UIProcess/ios/WKContentViewInteraction.mm:
2893         (-[WKContentView _deleteByWord]):
2894
2895 2018-11-07  Daniel Bates  <dabates@apple.com>
2896
2897         Override +[UIKeyboard isInHardwareKeyboardMode] in WebKitTestRunner and DumpRenderTree
2898         https://bugs.webkit.org/show_bug.cgi?id=190141
2899
2900         Reviewed by Darin Adler.
2901
2902         Directly use +[UIKeyboard isInHardwareKeyboardMode]. We will override this class method
2903         in DumpRenderTree and WebKitTestRunner to always return NO so as to make test runs
2904         deterministic regardless of whether a hardware keyboard is attached.
2905
2906         * Shared/NativeWebKeyboardEvent.h:
2907         * Shared/ios/NativeWebKeyboardEventIOS.mm:
2908         (WebKit::isInHardwareKeyboardMode): Deleted.
2909         * UIProcess/ios/WKContentViewInteraction.mm:
2910         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2911         * WebProcess/WebPage/ios/WebPageIOS.mm:
2912         (WebKit::WebPage::platformEditorState const):
2913
2914 2018-11-07  Zamiul Haque  <zhaque@apple.com>
2915
2916         Force a gregorian calendar to show for credit card expiration date inputs
2917         (autocomplete='cc-exp'*) regardless of default system settings.
2918         https://bugs.webkit.org/show_bug.cgi?id=191096
2919         rdar://problem/42640256
2920
2921         Reviewed by Tim Horton.
2922
2923         Added some plumbing code to expose the calendar identifier of the calendar used by a
2924         presented date picker. Added shouldPresentGregorianCalendar:, to be used for
2925         determining what property values a date input control must present a Gregorian
2926         calendar for.
2927
2928         * UIProcess/ios/WKContentViewInteraction.mm:
2929         (-[WKContentView formInputPeripheral]):
2930         * UIProcess/ios/forms/WKFormInputControl.mm:
2931
2932 2018-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2933
2934         Unreviewed. Fix GTK/WPE build when memfd is not available after r237922.
2935
2936         * Platform/unix/SharedMemoryUnix.cpp:
2937         (WebKit::createSharedMemory):
2938
2939 2018-11-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2940
2941         [Linux] Use memfd_create when available in SharedMemory implementation
2942         https://bugs.webkit.org/show_bug.cgi?id=189741
2943
2944         Reviewed by Michael Catanzaro.
2945
2946         If memfd is available, use it instead of shm_open.
2947
2948         * Platform/unix/SharedMemoryUnix.cpp:
2949         (WebKit::createSharedMemory): Helper to create the shared memory, trying first with memfd and falling back to
2950         shm if it's not available.
2951         (WebKit::SharedMemory::create): Use createSharedMemory() helper.
2952
2953 2018-11-06  Justin Fan  <justin_fan@apple.com>
2954
2955         [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
2956         https://bugs.webkit.org/show_bug.cgi?id=191291
2957
2958         Reviewed by Myles Maxfield.
2959
2960         Properly disable WEBGPU on all non-Metal platforms for now.
2961
2962         * Configurations/FeatureDefines.xcconfig:
2963
2964 2018-11-06  Youenn Fablet  <youenn@apple.com>
2965
2966         Make mDNS ICE Candidate an experimental flag again
2967         https://bugs.webkit.org/show_bug.cgi?id=191262
2968
2969         Reviewed by Dean Jackson.
2970
2971         * Shared/WebPreferences.yaml:
2972         * UIProcess/API/C/WKPreferences.cpp:
2973         (WKPreferencesSetWebRTCMDNSICECandidatesEnabled):
2974         (WKPreferencesGetWebRTCMDNSICECandidatesEnabled):
2975         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2976         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2977
2978 2018-11-06  Suresh Koppisetty  <skoppisetty@apple.com>
2979
2980         Don’t use the main queue to create an XPC connection.
2981         https://bugs.webkit.org/show_bug.cgi?id=191160
2982         <rdar://problem/45736262>
2983
2984         Reviewed by Geoffrey Garen.
2985
2986         Don't use the main queue to create an XPC connection. xpc_connection_set_bootstrap does
2987         dispatch_mach_send_barrier_f on this queue which delays the sending of the subsequent
2988         bootstrap message (sent to launchd for launching a new target process) when the main queue is busy.
2989
2990         Now that the XPC connection runs on the default concurrent queue, errorHandler could be invoked
2991         by any thread. The job of errorHandler is to dispatch errorHandlerImpl to the main thread,
2992         where errorHandlerImpl is responsible for the actual handling of errors if any.
2993
2994         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2995         (WebKit::ProcessLauncher::launchProcess):
2996
2997 2018-11-06  Brian Burg  <bburg@apple.com>
2998
2999         Add missing iOS availability macro to _WKAutomationSessionConfiguration
3000         https://bugs.webkit.org/show_bug.cgi?id=191320
3001
3002         Reviewed by Tim Horton.
3003
3004         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
3005
3006 2018-11-06  John Wilander  <wilander@apple.com>
3007
3008         Resource Load Statistics: Remove cap on partitioned cache max age if it matches a network reload (redirect-only)
3009         https://bugs.webkit.org/show_bug.cgi?id=189760
3010         <rdar://problem/44612242>
3011
3012         Reviewed by Youenn Fablet and Antti Koivisto.
3013
3014         When a redirect cache entry for a prevalent resource reaches its max
3015         age cap, it is loaded again from the network and the network response
3016         is compared with what's in the cache. If it's a match, the cache entry
3017         is fully accepted. If not, a new capped cache entry is created.
3018
3019         This feature is still off by default.
3020
3021         * NetworkProcess/NetworkResourceLoader.cpp:
3022         (WebKit::NetworkResourceLoader::canUseCachedRedirect const):
3023             Now checks the new member m_cacheEntryForMaxAgeCapValidation.
3024         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3025             New case handled for entry->hasReachedPrevalentResourceAgeCap().
3026         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
3027             This is where the new logic compares the incoming redirect with the
3028             cached one. If they match, an uncapped entry is allowed to be stored.
3029             If they don't match, a new capped entry will be stored.
3030         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3031             Now calls the new
3032             NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation()
3033             function.
3034         * NetworkProcess/NetworkResourceLoader.h:
3035             Added the m_cacheEntryForMaxAgeCapValidation member.
3036         * NetworkProcess/cache/NetworkCache.cpp:
3037         (WebKit::NetworkCache::makeUseDecision):
3038             Restored to previous behavior which means
3039             UseDecision::NoDueToPrevalentResourceAgeCap was removed.
3040         (WebKit::NetworkCache::Cache::retrieve):
3041             Restored to previous behavior.
3042         (WebKit::NetworkCache::Cache::storeRedirect):
3043             Now takes the optional maxAgeCap and caps the entry's max age if it's set.
3044         (WebKit::NetworkCache::hasReachedPrevalentResourceAgeCap): Deleted.
3045         * NetworkProcess/cache/NetworkCache.h:
3046         * NetworkProcess/cache/NetworkCacheEntry.cpp:
3047         (WebKit::NetworkCache::Entry::encodeAsStorageRecord const):
3048             Now encodes m_maxAgeCap.
3049         (WebKit::NetworkCache::Entry::decodeStorageRecord):
3050             Now decodes m_maxAgeCap.
3051         (WebKit::NetworkCache::Entry::hasReachedPrevalentResourceAgeCap const):
3052             Added.
3053         (WebKit::NetworkCache::Entry::capMaxAge):
3054             Added.
3055         * NetworkProcess/cache/NetworkCacheEntry.h:
3056             Added the optional m_maxAgeCap.
3057         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3058         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
3059             Now gets the optional max age cap from the NetworkStorageSession and sends it
3060             to Cache::storeRedirect().
3061         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
3062         (WebKit::NetworkCache::cachedEntryReuseFailureToDiagnosticKey):
3063             Removed handling of UseDecision::NoDueToPrevalentResourceAgeCap.
3064
3065 2018-11-06  Per Arne Vollan  <pvollan@apple.com>
3066
3067         REGRESSION (r230523): Caps lock indicator not shown in password field
3068         https://bugs.webkit.org/show_bug.cgi?id=190056
3069
3070         Reviewed by Ryosuke Niwa.
3071
3072         Update cached modifier state in the WebProcess when WebKit::WebPage::keyEvent is called, and
3073         when the window becomes active.
3074
3075         * UIProcess/WebPageProxy.cpp:
3076         (WebKit::WebPageProxy::dispatchActivityStateChange):
3077         (WebKit::WebPageProxy::updateCurrentModifierState):
3078         * UIProcess/WebPageProxy.h:
3079         * WebProcess/WebPage/WebPage.cpp:
3080         (WebKit::WebPage::keyEvent):
3081         (WebKit::WebPage::updateCurrentModifierState):
3082         * WebProcess/WebPage/WebPage.h:
3083         * WebProcess/WebPage/WebPage.messages.in:
3084
3085 2018-11-06  Alex Christensen  <achristensen@webkit.org>
3086
3087         Add ObjC SPI equivalent of WKContextHandlesSafeBrowsing
3088         https://bugs.webkit.org/show_bug.cgi?id=191329
3089
3090         Reviewed by Tim Horton.
3091
3092         Like WKContextHandlesSafeBrowsing, this is so I can make one change in WebKit and enable safe browsing
3093         in WKWebView and disable it in Safari at the same time without broken revisions between landing two changes
3094         in two repositories.
3095
3096         * UIProcess/API/Cocoa/WKWebView.mm:
3097         (+[WKWebView handlesSafeBrowsing]):
3098         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3099
3100 2018-11-06  Eric Carlson  <eric.carlson@apple.com>
3101
3102         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3103         https://bugs.webkit.org/show_bug.cgi?id=191227
3104         <rdar://problem/45784512>
3105
3106         Reviewed by Youenn Fablet.
3107
3108         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3109         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3110         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
3111         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3112         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3113
3114 2018-11-06  Fujii Hironori  <Hironori.Fujii@sony.com>
3115
3116         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3117         https://bugs.webkit.org/show_bug.cgi?id=191227
3118         <rdar://problem/45784512>
3119
3120         Unreviewed build fix of ports not ENABLE(MEDIA_STREAM).
3121
3122         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Define getRequestAction only if ENABLE(MEDIA_STREAM).
3123         * UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto.
3124
3125 2018-11-03  Alex Christensen  <achristensen@webkit.org>
3126
3127         [Mac] Implement safe browsing in WebKit
3128         https://bugs.webkit.org/show_bug.cgi?id=188871
3129
3130         Reviewed by Tim Horton.
3131
3132         * Platform/spi/Cocoa/SafeBrowsingSPI.h:
3133         * Resources/SafeBrowsing.xcassets: Added.
3134         * Resources/SafeBrowsing.xcassets/Contents.json: Added.
3135         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBackground.colorset: Added.
3136         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningBackground.colorset/Contents.json: Added.
3137         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningText.colorset: Added.
3138         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningText.colorset/Contents.json: Added.
3139         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningTitle.colorset: Added.
3140         * Resources/SafeBrowsing.xcassets/WKSafeBrowsingWarningTitle.colorset/Contents.json: Added.
3141         * Shared/WebPreferences.yaml:
3142         * Shared/WebPreferencesDefaultValues.h:
3143         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
3144         (WKContextHandlesSafeBrowsing):
3145         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm:
3146         (WebKit::malwareDetailsBase):
3147         (WebKit::learnMore):
3148         (WebKit::reportAnErrorBase):
3149         (WebKit::localizedProvider):
3150         (WebKit::SafeBrowsingResult::SafeBrowsingResult):
3151         * UIProcess/Cocoa/WKSafeBrowsingWarning.h: Added.
3152         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: Added.
3153         (confirmMalwareSentinel):
3154         (visitUnsafeWebsiteSentinel):
3155         (colorNamed):
3156         (replace):
3157         (addLinkAndReplace):
3158         (-[WKSafeBrowsingExclamationPoint drawRect:]):
3159         (-[WKSafeBrowsingExclamationPoint intrinsicContentSize]):
3160         (reportAnErrorURL):
3161         (malwareDetailsURL):
3162         (titleText):
3163         (warningText):
3164         (detailsText):
3165         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
3166         (-[WKSafeBrowsingWarning dealloc]):
3167         (-[WKSafeBrowsingWarning goBackClicked]):
3168         (-[WKSafeBrowsingWarning clickedOnLink:]):
3169         (-[WKSafeBrowsingWarning showDetailsClicked]):
3170         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]):
3171         (+[WKSafeBrowsingTextView viewWithString:]):
3172         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3173         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]):
3174         * UIProcess/Cocoa/WebViewImpl.h:
3175         * UIProcess/Cocoa/WebViewImpl.mm:
3176         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3177         (WebKit::WebViewImpl::clearSafeBrowsingWarning):
3178         (WebKit::WebViewImpl::setFrameSize):
3179         * UIProcess/PageClient.h:
3180         (WebKit::PageClient::showSafeBrowsingWarning):
3181         (WebKit::PageClient::clearSafeBrowsingWarning):
3182         * UIProcess/SafeBrowsingResult.h:
3183         (WebKit::SafeBrowsingResult::url const):
3184         (WebKit::SafeBrowsingResult::provider const):
3185         (WebKit::SafeBrowsingResult::localizedProviderName const):
3186         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const):
3187         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const):
3188         (WebKit::SafeBrowsingResult::learnMoreURL const):
3189         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const):
3190         (WebKit::SafeBrowsingResult::isKnownToBeUnsafe const): Deleted.
3191         * UIProcess/WebPageProxy.cpp:
3192         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3193         * UIProcess/ios/PageClientImplIOS.h:
3194         * UIProcess/ios/PageClientImplIOS.mm:
3195         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3196         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3197         * UIProcess/mac/PageClientImplMac.h:
3198         * UIProcess/mac/PageClientImplMac.mm:
3199         (WebKit::PageClientImpl::setImpl):
3200         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3201         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3202         * WebKit.xcodeproj/project.pbxproj:
3203
3204 2018-11-05  Zan Dobersek  <zdobersek@igalia.com>
3205
3206         [WPE] Remove BackingStore, BackingStoreCairo implementation files from build
3207         https://bugs.webkit.org/show_bug.cgi?id=191269
3208
3209         Reviewed by Michael Catanzaro.
3210
3211         * SourcesWPE.txt: Drop the BackingStore.cpp and BackingStoreCairo.cpp
3212         files from the WPE build. These are not used at all in WPE configuration
3213         as they are only used by the GTK+ port for non-AC functionality.
3214
3215 2018-11-05  Chris Dumez  <cdumez@apple.com>
3216
3217         Use same limit for page cache and suspended pages
3218         https://bugs.webkit.org/show_bug.cgi?id=191266
3219
3220         Reviewed by Geoffrey Garen.
3221
3222         Use same limit for page cache and suspended pages as they serve the same purpose.
3223
3224         * UIProcess/API/Cocoa/WKProcessPool.mm:
3225         (-[WKProcessPool _maximumSuspendedPageCount]):
3226         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3227         * UIProcess/WebProcessPool.cpp:
3228         (WebKit::WebProcessPool::updateMaxSuspendedPageCount):
3229         (WebKit::WebProcessPool::setCacheModel):
3230         (WebKit::WebProcessPool::addSuspendedPageProxy):
3231         * UIProcess/WebProcessPool.h:
3232
3233 2018-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3234
3235         [iOS] Allow WKWebView clients to customize bar button item groups in the accessory view when editing
3236         https://bugs.webkit.org/show_bug.cgi?id=191240
3237         <rdar://problem/44872806>
3238
3239         Reviewed by Tim Horton.
3240
3241         Allow WKWebView clients to override WKContentView's default input assistant item by plumbing the call to
3242         `-inputAssistantItem` through `-[WKWebView inputAssistantItem]`, such that if a client asks WKWebView for its
3243         input assistant item and changes its leading or trailing bar button groups, the changes will be reflected by
3244         WKContentView; additionally, this allows clients to achieve the same effect by overriding `-inputAssistantItem`
3245         on WKWebView.
3246
3247         Test:   KeyboardInputTests.ModifyInputAssistantItemBarButtonGroups
3248                 KeyboardInputTests.OverrideInputAssistantItemBarButtonGroups
3249
3250         * UIProcess/API/Cocoa/WKWebView.mm:
3251         (-[WKWebView inputAssistantItem]):
3252         * UIProcess/ios/WKContentViewInteraction.h:
3253         * UIProcess/ios/WKContentViewInteraction.mm:
3254         (-[WKContentView inputAssistantItem]):
3255
3256         Route the call to `[super inputAssistantItem]` through `-[WKWebView inputAssistantItem]`, so that the input
3257         assistant item may be overridden via WKWebView.
3258
3259         (-[WKContentView inputAssistantItemForWebView]):
3260
3261 2018-11-05  Ryan Haddad  <ryanhaddad@apple.com>
3262
3263         Unreviewed, rolling out r237785.
3264
3265         Introduced layout test and API test failures on macOS and iOS.
3266
3267         Reverted changeset:
3268
3269         "[iOS] Issue initial paint soon after the visuallyNonEmpty
3270         milestone is fired."
3271         https://bugs.webkit.org/show_bug.cgi?id=191078
3272         https://trac.webkit.org/changeset/237785
3273
3274 2018-11-05  Commit Queue  <commit-queue@webkit.org>
3275
3276         Unreviewed, rolling out r237784 and r237788.
3277         https://bugs.webkit.org/show_bug.cgi?id=191270
3278
3279         Caused mediastream layout test failures (Requested by
3280         ryanhaddad on #webkit).
3281
3282         Reverted changesets:
3283
3284         "[MediaStream] User should not be prompted again after denying
3285         getDisplayMedia request"
3286         https://bugs.webkit.org/show_bug.cgi?id=191227
3287         https://trac.webkit.org/changeset/237784
3288
3289         "[MediaStream] User should not be prompted again after denying
3290         getDisplayMedia request"
3291         https://bugs.webkit.org/show_bug.cgi?id=191227
3292         https://trac.webkit.org/changeset/237788
3293
3294 2018-11-04  Fujii Hironori  <Hironori.Fujii@sony.com>
3295
3296         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3297         https://bugs.webkit.org/show_bug.cgi?id=191227
3298         <rdar://problem/45784512>
3299
3300         Unreviewed build fix of ports not ENABLE(MEDIA_STREAM).
3301
3302         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: Define getRequestAction only if ENABLE(MEDIA_STREAM).
3303         * UIProcess/UserMediaPermissionRequestManagerProxy.h: Ditto.
3304
3305 2018-11-04  Zalan Bujtas  <zalan@apple.com>
3306
3307         [iOS] Issue initial paint soon after the visuallyNonEmpty milestone is fired.
3308         https://bugs.webkit.org/show_bug.cgi?id=191078
3309         <rdar://problem/45736178>
3310
3311         Reviewed by Antti Koivisto.
3312
3313         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3314         (WebKit::WebChromeClient::layerFlushThrottlingIsActive const):
3315         * WebProcess/WebCoreSupport/WebChromeClient.h:
3316         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3317         (WebKit::AcceleratedDrawingArea::scheduleInitialDeferredPaint):
3318         * WebProcess/WebPage/AcceleratedDrawingArea.h:
3319         * WebProcess/WebPage/DrawingArea.h:
3320         (WebKit::DrawingArea::layerFlushThrottlingIsActive const):
3321         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
3322         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3323         (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
3324         (WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen):
3325         (WebKit::RemoteLayerTreeDrawingArea::initialDeferredPaint):
3326         (WebKit::RemoteLayerTreeDrawingArea::scheduleInitialDeferredPaint):
3327         (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
3328         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3329         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3330         (WebKit::TiledCoreAnimationDrawingArea::scheduleInitialDeferredPaint):
3331
3332 2018-11-04  Eric Carlson  <eric.carlson@apple.com>
3333
3334         [MediaStream] User should not be prompted again after denying getDisplayMedia request
3335         https://bugs.webkit.org/show_bug.cgi?id=191227
3336         <rdar://problem/45784512>
3337
3338         Reviewed by Youenn Fablet.
3339
3340         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3341         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied):
3342         (WebKit::UserMediaPermissionRequestManagerProxy::wasRequestDenied):
3343         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
3344         * UIProcess/UserMediaPermissionRequestManagerProxy.h:
3345
3346 2018-11-03  Alex Christensen  <achristensen@webkit.org>
3347
3348         Mac production builds should sign the network process xpc service with entitlements
3349         https://bugs.webkit.org/show_bug.cgi?id=191209
3350         <rdar://problem/45377609>
3351
3352         Reviewed by Geoff Garen.
3353
3354         * Configurations/Network-OSX.entitlements: Copied from Configurations/Network-OSX-sandbox.entitlements.
3355         * Configurations/NetworkService.xcconfig:
3356         Set CODE_SIGN_ENTITLEMENTS_COCOA_TOUCH_NO like we do for the web process,
3357         except with the corresponoding network process entitlements file.
3358         * UIProcess/API/Cocoa/WKProcessPool.mm:
3359         (-[WKProcessPool _networkProcessHasEntitlementForTesting:]):
3360         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3361         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3362         (WebKit::WebProcessPool::networkProcessHasEntitlementForTesting):
3363         * UIProcess/WebProcessPool.h:
3364         * WebKit.xcodeproj/project.pbxproj:
3365         Add infrastructure to test that the network process actually has an entitlement.
3366
3367 2018-11-03  Philippe Normand  <pnormand@igalia.com>
3368
3369         [WPE] Add the WebKitVersion.h header
3370         https://bugs.webkit.org/show_bug.cgi?id=191015
3371         <rdar://problem/45647211>
3372
3373         Reviewed by Michael Catanzaro.
3374
3375         * PlatformWPE.cmake: Install the generated header as well.
3376
3377 2018-11-02  Alex Christensen  <achristensen@webkit.org>
3378
3379         Unreviewed, rolling out r237761.
3380
3381         Makes most API tests timeout and WK2 tests crash
3382
3383         Reverted changeset:
3384
3385         "Mac production builds should sign the network process xpc
3386         service with entitlements"
3387         https://bugs.webkit.org/show_bug.cgi?id=191209
3388         https://trac.webkit.org/changeset/237761
3389
3390 2018-11-02  Ryan Haddad  <ryanhaddad@apple.com>
3391
3392         Unreviewed, attempt to fix the build with recent SDKs.
3393
3394         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
3395         (WebKit::XPCServiceExit):
3396
3397 2018-11-02  Alex Christensen  <achristensen@webkit.org>
3398
3399         Mac production builds should sign the network process xpc service with entitlements
3400         https://bugs.webkit.org/show_bug.cgi?id=191209
3401         <rdar://problem/45377609>
3402
3403         Reviewed by Geoff Garen.