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