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