Clean up IndexedDB files between tests
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-23  Sihui Liu  <sihui_liu@apple.com>
2
3         Clean up IndexedDB files between tests
4         https://bugs.webkit.org/show_bug.cgi?id=192796
5         <rdar://problem/46824999>
6
7         Reviewed by Geoffrey Garen.
8
9         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
10         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
11         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
12
13 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
14
15         [iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
16         https://bugs.webkit.org/show_bug.cgi?id=193182
17         <rdar://problem/47452154>
18
19         Reviewed by Tim Horton.
20
21         Fix an existing bug where blurring an element doesn't always un-suppress text interactions.
22
23         * UIProcess/ios/WKContentViewInteraction.mm:
24         (-[WKContentView _elementDidBlur]):
25
26 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
27
28         Minor improvements to NetworkProcess
29         https://bugs.webkit.org/show_bug.cgi?id=193708
30
31         Reviewed by Alex Christensen.
32
33         * NetworkProcess/NetworkProcess.cpp:
34         (WebKit::NetworkProcess::switchToNewTestingSession): Fix a spelling error.
35         (WebKit::NetworkProcess::ensureSession): Add useful assertion.
36         (WebKit::NetworkProcess::defaultStorageSession const): Split into platform functions.
37         (WebKit::NetworkProcess::destroySession): Add useful assertion.
38         * NetworkProcess/NetworkProcess.h:
39         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
40         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
41         * NetworkProcess/curl/NetworkProcessCurl.cpp:
42         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
43         * NetworkProcess/soup/NetworkProcessSoup.cpp:
44         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
45
46 2019-01-23  Daniel Bates  <dabates@apple.com>
47
48         Fix the Apple Internal build. See <rdar://problem/47486758>.
49
50         * UIProcess/ios/WKContentViewInteraction.mm:
51         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
52
53 2019-01-23  Per Arne Vollan  <pvollan@apple.com>
54
55         [macOS] Sandbox fails to compile
56         https://bugs.webkit.org/show_bug.cgi?id=193727
57         <rdar://problem/47476903>
58
59         Reviewed by Brent Fulgham.
60
61         Use '(with send-signal SIGKILL)' instead of '(with termination)'.
62
63         * WebProcess/com.apple.WebProcess.sb.in:
64
65 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
66
67         REGRESSION (r240243): CrashTracer: WebKitTestRunnerApp at com.apple.WebKit: WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const + 32
68         https://bugs.webkit.org/show_bug.cgi?id=193723
69         <rdar://problem/47476802>
70
71         Reviewed by David Kilzer.
72
73         The new code added in r240243 could attempt to submit telemetry after the relevant
74         WebResourceLoadStatisticsStore was destroyed. We should guard against this possibility.
75
76         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
77         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
78
79 2019-01-23  Antti Koivisto  <antti@apple.com>
80
81         [PSON] Flash on back navigation on Mac
82         https://bugs.webkit.org/show_bug.cgi?id=193716
83         <rdar://problem/47148458>
84
85         Reviewed by Chris Dumez.
86
87         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
88
89         * UIProcess/SuspendedPageProxy.cpp:
90         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
91
92         Remove the suspended page (so closing it on web process side) if the suspension fails.
93         Skip this if we are using web process side compositing on Mac.
94
95         * UIProcess/WebPageProxy.cpp:
96         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
97
98         On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
99
100         * UIProcess/WebProcessPool.cpp:
101         (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
102         * UIProcess/WebProcessPool.h:
103         * WebProcess/WebPage/WebPage.cpp:
104         (WebKit::WebPage::suspendForProcessSwap):
105
106         Don't close the page on suspension failure.
107
108 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
109
110         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
111         https://bugs.webkit.org/show_bug.cgi?id=193706
112         <rdar://problem/44807048>
113
114         Reviewed by Ryosuke Niwa.
115
116         * UIProcess/Cocoa/WebViewImpl.mm:
117         (WebKit::WebViewImpl::registerEditCommand):
118         * UIProcess/WebEditCommandProxy.cpp:
119         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
120         * UIProcess/WebEditCommandProxy.h:
121
122         Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer.
123         Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy*
124         argument into a WebPageProxy&, since the WebPageProxy must exist when it creates a new WebEditCommandProxy.
125
126         (WebKit::WebEditCommandProxy::create):
127         (WebKit::WebEditCommandProxy::label const):
128         (WebKit::WebEditCommandProxy::invalidate):
129         (WebKit::WebEditCommandProxy::editAction const): Deleted.
130
131         Adjust UI-side logic to just handle the undo/redo label, rather than map the edit action to a localized string.
132
133         * UIProcess/WebPageProxy.cpp:
134         (WebKit::WebPageProxy::registerEditCommandForUndo):
135         (WebKit::WebPageProxy::resetState):
136
137         Tweak this to use std::exchange instead of copying all the WebEditCommandProxy RefPtrs into a separate Vector
138         and then iterating over the Vector.
139
140         * UIProcess/WebPageProxy.h:
141         * UIProcess/WebPageProxy.messages.in:
142
143         Adjust this so that we only send the undo/redo label over IPC, rather than the edit action type.
144
145         * UIProcess/ios/PageClientImplIOS.mm:
146         (WebKit::PageClientImpl::registerEditCommand):
147         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
148         (WebKit::WebEditorClient::registerUndoStep):
149
150 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
151
152         [SOUP] Remove libsoup cruft from WebProcess
153         https://bugs.webkit.org/show_bug.cgi?id=193710
154
155         Reviewed by Carlos Garcia Campos.
156
157         SoupNetworkSession is no longer accessible from the web process because it's owned
158         (indirectly) by NetworkProcess after r240292. It doesn't make sense to have any libsoup
159         code under WebProcess anymore. The current libsoup code consists of (a) unused stuff to be
160         removed, (b) stuff unrelated to libsoup, which should move to a WebProcessGLib.cpp, and (c)
161         WebKitSoupRequestInputStream, which is only used by NetworkProcess and should move there
162
163         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.cpp.
164         (AsyncReadData::AsyncReadData):
165         (webkitSoupRequestInputStreamReadAsyncResultComplete):
166         (webkitSoupRequestInputStreamPendingReadAsyncComplete):
167         (webkitSoupRequestInputStreamHasDataToRead):
168         (webkitSoupRequestInputStreamIsWaitingForData):
169         (webkitSoupRequestInputStreamReadAsync):
170         (webkitSoupRequestInputStreamReadFinish):
171         (webkitSoupRequestInputStreamFinalize):
172         (webkit_soup_request_input_stream_init):
173         (webkit_soup_request_input_stream_class_init):
174         (webkitSoupRequestInputStreamNew):
175         (webkitSoupRequestInputStreamAddData):
176         (webkitSoupRequestInputStreamDidFailWithError):
177         (webkitSoupRequestInputStreamFinished):
178         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.h.
179         * SourcesGTK.txt:
180         * SourcesWPE.txt:
181         * UIProcess/soup/WebProcessPoolSoup.cpp:
182         (WebKit::WebProcessPool::setNetworkProxySettings): Don't send message to web processes.
183         * WebProcess/WebProcess.h:
184         * WebProcess/WebProcess.messages.in:
185         * WebProcess/glib/WebProcessGLib.cpp: Renamed from Source/WebKit/WebProcess/soup/WebProcessSoup.cpp.
186         (WebKit::WebProcess::platformSetCacheModel):
187         (WebKit::WebProcess::platformInitializeWebProcess):
188         (WebKit::WebProcess::platformTerminate):
189
190 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
191
192         [SOUP] Clean up NetworkStorageSession
193         https://bugs.webkit.org/show_bug.cgi?id=193707
194
195         Reviewed by Carlos Garcia Campos.
196
197         Restore an important call to clearSoupNetworkSession that was removed in r240292. Also,
198         adapt to NetworkStorageSessions API changes.
199
200         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
201         (WebKit::LegacyCustomProtocolManager::registerScheme):
202         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
203         * NetworkProcess/soup/NetworkProcessSoup.cpp:
204         (WebKit::NetworkProcess::userPreferredLanguagesChanged):
205         (WebKit::NetworkProcess::setNetworkProxySettings):
206         * NetworkProcess/soup/NetworkSessionSoup.cpp:
207         (WebKit::NetworkSessionSoup::soupSession const):
208
209 2019-01-23  Philippe Normand  <pnormand@igalia.com>
210
211         [GTK] Crash when browsing inspector:// uri without port set
212         https://bugs.webkit.org/show_bug.cgi?id=193721
213
214         Reviewed by Michael Catanzaro.
215
216         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
217         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Return
218         back to caller after setting the error, if no port was provided
219         along with the inspector URL.
220
221 2019-01-23  David Kilzer  <ddkilzer@apple.com>
222
223         Switch remaining CoreMedia soft-linking in WebKit over to CoreMediaSoftLink.{cpp,h}
224         <https://webkit.org/b/193694>
225         <rdar://problem/47464025>
226
227         Reviewed by Tim Horton.
228
229         * Shared/ios/WebIconUtilities.mm:
230         - Switch to using CoreMediaSoftLink.{h,mm} in PAL.
231
232 2019-01-22  Chris Dumez  <cdumez@apple.com>
233
234         Regression(r240178) Some API tests are crashing
235         https://bugs.webkit.org/show_bug.cgi?id=193680
236
237         Reviewed by Alex Christensen.
238
239         r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always
240         properly populated in the WebPageCreationParameters. This was needed in case we need to
241         reconstruct the WebUserContentController on the WebProcess side. However, this caused a
242         regression in the case we reuse a process where the WebUserContentController still exists
243         (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate
244         entries to the existing WebUserContentController instance because its "add" methods did not
245         have duplicate checks. To address the issue, this patch adds duplicate checks to the
246         WebUserContentController "add" methods.
247
248         * WebProcess/UserContent/WebUserContentController.cpp:
249         (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal):
250         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
251         (WebKit::WebUserContentController::addUserScriptInternal):
252         (WebKit::WebUserContentController::removeUserScriptInternal):
253         (WebKit::WebUserContentController::addUserStyleSheetInternal):
254         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
255         (WebKit::WebUserContentController::forEachUserMessageHandler const):
256         * WebProcess/UserContent/WebUserContentController.h:
257
258 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
259
260         Unreviewed attempt to fix GTK/WPE bots
261         https://bugs.webkit.org/show_bug.cgi?id=193580
262         <rdar://problem/47457742>
263
264         Doesn't make sense to clear the storage session right after creating it. This should fix
265         network process crash on startup under G_DEBUG=fatal-criticals due to the storage session
266         not having a cookie jar.
267
268         * NetworkProcess/NetworkProcess.cpp:
269         (WebKit::NetworkProcess::NetworkProcess):
270
271 2019-01-22  Megan Gardner  <megan_gardner@apple.com>
272
273         Cancel Web Touches Properly so that long presses on YouTube links do not incorrectly trigger a load
274         https://bugs.webkit.org/show_bug.cgi?id=193687
275         <rdar://problem/47056717>
276
277         Reviewed by Tim Horton.
278
279         Cancel web gestures when a long press is recognized.
280
281         * Platform/spi/ios/UIKitSPI.h:
282         * UIProcess/ios/WKContentViewInteraction.mm:
283         (-[WKContentView _cancelWebGestureRecognizer]):
284         (-[WKContentView _longPressRecognized:]):
285
286 2019-01-22  Alex Christensen  <achristensen@webkit.org>
287
288         Fix an internal build failure after r240292
289         https://bugs.webkit.org/show_bug.cgi?id=193580
290
291         Rubber-stamped by Wenson Hsieh.
292
293         * SourcesCocoa.txt:
294         * UIProcess/mac/WebContextMenuProxyMac.mm:
295         (-[WKMenuTarget forwardContextMenuAction:]):
296         * WebKit.xcodeproj/project.pbxproj:
297         It was apparently unclear to the compiler sometimes which "state" selector to use, and this apparently mattered.
298         Tell the compiler to use the NSMenuItem selector, but at runtime it doesn't matter.
299
300 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
301
302         Unreviewed, fix -Wunused-but-set-variable warning
303         https://bugs.webkit.org/show_bug.cgi?id=193660
304         <rdar://problem/47433602>
305
306         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
307         (WebKit::WebsiteDataStore::removeData):
308
309 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
310
311         Unreviewed, further build fixes after r240292
312         https://bugs.webkit.org/show_bug.cgi?id=193580
313         <rdar://problem/47457742>
314
315         Oops.
316
317         * NetworkProcess/NetworkProcess.cpp:
318         (WebKit::NetworkProcess::defaultStorageSession const):
319
320 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
321
322         Unreviewed, further build fixes after r240292
323         https://bugs.webkit.org/show_bug.cgi?id=193580
324         <rdar://problem/47457742>
325
326         This builds for libsoup. Doesn't work, but at least builds.
327
328         Also, speculative fixes for curl.
329
330         * NetworkProcess/NetworkProcess.cpp:
331         (WebKit::NetworkProcess::defaultStorageSession const):
332
333 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
334
335         Unreviewed, further build fixes after r240292
336         https://bugs.webkit.org/show_bug.cgi?id=193580
337         <rdar://problem/47457742>
338
339         Still not working yet.
340
341         * NetworkProcess/NetworkProcess.cpp:
342         (WebKit::NetworkProcess::NetworkProcess):
343         * UIProcess/API/APIHTTPCookieStore.h:
344
345 2019-01-22  Antti Koivisto  <antti@apple.com>
346
347         [iOS] Flash when swiping back to Google search result page
348         https://bugs.webkit.org/show_bug.cgi?id=193668
349         <rdar://problem/47071684>
350
351         Reviewed by Simon Fraser.
352
353         If the google page is scrolled, there is sometimes a short flash.
354
355         When restoring the page state we also restore exposedContentRect which is used to determine
356         which part of the page to create layers for. Scroll position is restored by the UI process
357         later so we rely on this to get the right layers for the initial view update.
358
359         A viewport configuration update may sometimes trample over the restored exposedContentRect,
360         moving it to top left. In this case the initial layer tree unfreeze commit may not have
361         layers to cover the actual visible view position.
362
363         * WebProcess/WebPage/WebPage.cpp:
364         (WebKit::WebPage::didCommitLoad):
365         * WebProcess/WebPage/WebPage.h:
366         * WebProcess/WebPage/ios/WebPageIOS.mm:
367         (WebKit::WebPage::restorePageState):
368
369         Set a bit to indicate we have already restored the exposedContentRect.
370
371         (WebKit::WebPage::viewportConfigurationChanged):
372
373         Only reset exposedContentRect if wasn't already set by restorePageState.
374
375 2019-01-22  Alex Christensen  <achristensen@webkit.org>
376
377         Fix more builds.
378
379         * SourcesCocoa.txt:
380         * WebKit.xcodeproj/project.pbxproj:
381
382 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
383
384         Another build fix after r240292
385         https://bugs.webkit.org/show_bug.cgi?id=193580
386         <rdar://problem/47457742>
387
388         Unreviewed, still not enough to fix soup builds, but closer.
389
390         * UIProcess/API/APIHTTPCookieStore.h:
391
392 2019-01-22  Alex Christensen  <achristensen@webkit.org>
393
394         Fix some builds after r240292
395         https://bugs.webkit.org/show_bug.cgi?id=193580
396
397         * NetworkProcess/NetworkProcess.cpp:
398         (WebKit::NetworkProcess::switchToNewTestingSession):
399         * NetworkProcess/cache/NetworkCache.cpp:
400         (WebKit::NetworkCache::Cache::retrieve):
401
402 2019-01-22  Brian Burg  <bburg@apple.com>
403
404         Automation.computeElementLayout should return visual viewport-aware coordinates
405         https://bugs.webkit.org/show_bug.cgi?id=193598
406         <rdar://problem/35325644>
407
408         Unreviewed, restore a mistakenly-deleted line whose absence causes hangs.
409
410         * Shared/CoordinateSystem.h:
411
412 2019-01-22  Alex Christensen  <achristensen@webkit.org>
413
414         Move NetworkStorageSession ownership to NetworkProcess
415         https://bugs.webkit.org/show_bug.cgi?id=193580
416
417         Reviewed by Geoff Garen.
418
419         * NetworkProcess/Cookies/WebCookieManager.cpp:
420         (WebKit::WebCookieManager::WebCookieManager):
421         (WebKit::WebCookieManager::getHostnamesWithCookies):
422         (WebKit::WebCookieManager::deleteCookiesForHostname):
423         (WebKit::WebCookieManager::deleteAllCookies):
424         (WebKit::WebCookieManager::deleteCookie):
425         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
426         (WebKit::WebCookieManager::getAllCookies):
427         (WebKit::WebCookieManager::getCookies):
428         (WebKit::WebCookieManager::setCookie):
429         (WebKit::WebCookieManager::setCookies):
430         (WebKit::WebCookieManager::startObservingCookieChanges):
431         (WebKit::WebCookieManager::stopObservingCookieChanges):
432         * NetworkProcess/Cookies/WebCookieManager.h:
433         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
434         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
435         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
436         (WebKit::storageSession):
437         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
438         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
439         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
440         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
441         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
442         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
443         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
444         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
445         * NetworkProcess/NetworkProcess.cpp:
446         (WebKit::NetworkProcess::initializeNetworkProcess):
447         (WebKit::NetworkProcess::clearCachedCredentials):
448         (WebKit::NetworkProcess::switchToNewTestingSession):
449         (WebKit::NetworkProcess::ensureSession):
450         (WebKit::NetworkProcess::storageSession const):
451         (WebKit::NetworkProcess::defaultStorageSession const):
452         (WebKit::NetworkProcess::forEachNetworkStorageSession):
453         (WebKit::NetworkProcess::destroySession):
454         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
455         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
456         (WebKit::NetworkProcess::hasStorageAccessForFrame):
457         (WebKit::NetworkProcess::getAllStorageAccessEntries):
458         (WebKit::NetworkProcess::grantStorageAccess):
459         (WebKit::NetworkProcess::removeAllStorageAccess):
460         (WebKit::NetworkProcess::removePrevalentDomains):
461         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
462         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
463         (WebKit::NetworkProcess::fetchWebsiteData):
464         (WebKit::NetworkProcess::deleteWebsiteData):
465         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
466         * NetworkProcess/NetworkProcess.h:
467         * NetworkProcess/NetworkResourceLoader.cpp:
468         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
469         (WebKit::NetworkResourceLoader::logCookieInformation const):
470         * NetworkProcess/NetworkSession.cpp:
471         (WebKit::NetworkSession::networkStorageSession const):
472         * NetworkProcess/NetworkStorageSessionProvider.h:
473         * NetworkProcess/cache/NetworkCache.cpp:
474         (WebKit::NetworkCache::makeUseDecision):
475         (WebKit::NetworkCache::Cache::retrieve):
476         (WebKit::NetworkCache::Cache::makeEntry):
477         (WebKit::NetworkCache::Cache::makeRedirectEntry):
478         (WebKit::NetworkCache::Cache::update):
479         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
480         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
481         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
482         (WebKit::NetworkProcess::platformSyncAllCookies):
483         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
484         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
485         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
486         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
487         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
488         * NetworkProcess/mac/RemoteNetworkingContext.mm:
489         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
490         * SourcesCocoa.txt:
491         * UIProcess/API/APIHTTPCookieStore.cpp:
492         (API::HTTPCookieStore::~HTTPCookieStore):
493         (API::HTTPCookieStore::cookies):
494         (API::HTTPCookieStore::setCookie):
495         (API::HTTPCookieStore::deleteCookie):
496         (API::HTTPCookieStore::registerObserver):
497         (API::HTTPCookieStore::unregisterObserver):
498         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
499         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
500         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
501         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
502         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
503         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
504         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
505         * UIProcess/API/APIHTTPCookieStore.h:
506         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Added.
507         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
508         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
509         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
510         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
511         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
512         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
513         * UIProcess/WebProcessPool.cpp:
514         (WebKit::WebProcessPool::clearCachedCredentials):
515         * WebKit.xcodeproj/project.pbxproj:
516         * WebProcess/Plugins/PluginView.cpp:
517         (WebKit::PluginView::getAuthenticationInfo):
518         * WebProcess/WebProcess.cpp:
519         (WebKit::WebProcess::deleteWebsiteData):
520         (WebKit::WebProcess::clearCachedCredentials): Deleted.
521         * WebProcess/WebProcess.h:
522         * WebProcess/WebProcess.messages.in:
523
524 2019-01-22  Per Arne Vollan  <pvollan@apple.com>
525
526         [macOS] Adjust logging policy in WebKit's sandbox
527         https://bugs.webkit.org/show_bug.cgi?id=193454
528
529         Reviewed by Brent Fulgham.
530
531         Add a rule to initially deny all calls, since the default is to allow every call.
532         Later rules allow syscalls that we determined are needed for proper WebKit function.
533         This reduces the API surface available to attackers.
534
535         * WebProcess/com.apple.WebProcess.sb.in:
536
537 2019-01-22  Daniel Bates  <dabates@apple.com>
538
539         [iOS] WebKit should handle shift state changes when using the software keyboard
540         https://bugs.webkit.org/show_bug.cgi?id=191475
541         <rdar://problem/45949246>
542
543         Reviewed by Brent Fulgham.
544
545         Implement UIKit SPI to be notified of shift state changes to the software keyboard
546         and dispatch a synthetic keydown or keyup event for either the Shift key or Caps Lock
547         key.
548
549         A side benefit of this change is that we now show and hide the caps lock indicator
550         in a focused password field when caps lock is enabled or disabled using the software
551         keyboard, respectively.
552
553         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
554         * SourcesCocoa.txt:
555         * UIProcess/ios/WKContentViewInteraction.mm:
556         (-[WKContentView modifierFlagsDidChangeFrom:to:]): Create a synthetic flags changed
557         web event based on the state change and dispatch it.
558         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Early return if the event
559         was a synethic flags change event so that we do not notify UIKit about this event
560         as it does not know anything about such synthetic events.
561         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h: Added.
562         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm: Added.
563         (-[WKSyntheticFlagsChangedWebEvent initWithKeyCode:modifiers:keyDown:]):
564         (-[WKSyntheticFlagsChangedWebEvent initWithCapsLockState:]):
565         (-[WKSyntheticFlagsChangedWebEvent initWithShiftState:]):
566         * WebKit.xcodeproj/project.pbxproj:
567
568 2019-01-22  Daniel Bates  <dabates@apple.com>
569
570         [iOS] Interpret text key commands on keydown and app key commands on keypress
571         https://bugs.webkit.org/show_bug.cgi?id=192897
572         <rdar://problem/46857378>
573
574         Reviewed by Brent Fulgham.
575
576         Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
577         is false) and keypress (isCharEvent is true), respectively.
578
579         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
580         * UIProcess/ios/WKContentViewInteraction.mm:
581         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
582
583 2019-01-22  David Kilzer  <ddkilzer@apple.com>
584
585         C strings in ClientCertificateAuthenticationXPCConstants.h are duplicated
586         <https://webkit.org/b/193607>
587         <rdar://problem/47334613>
588
589         Reviewed by Alex Christensen.
590
591         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
592         (WebKit::AuthenticationManager::initializeConnection):
593         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
594         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
595         - Update name of constants.
596
597         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.cpp: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h.
598         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
599         - Put constant values in a namespace, and move values to
600           ClientCertificateAuthenticationXPCConstants.cpp.
601
602         * SourcesCocoa.txt:
603         * UnifiedSources-input.xcfilelist:
604         * WebKit.xcodeproj/project.pbxproj:
605         - Add ClientCertificateAuthenticationXPCConstants.cpp.
606
607 2019-01-22  David Kilzer  <ddkilzer@apple.com>
608
609         Switch remaining QuickLook soft-linking in WebCore, WebKit over to QuickLookSoftLink.{cpp,h}
610         <https://webkit.org/b/193654>
611         <rdar://problem/47430290>
612
613         Reviewed by Alex Christensen.
614
615         - Moves QuickLookSoftLink.{h,mm} to PAL.
616         - Adds soft-link to 3 classes to consolidate QuickLook.framework
617           soft-linking.
618         - Updates existing source to work with above changes.
619
620         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
621         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
622         (WebKit::SystemPreviewController::start):
623         * UIProcess/ios/WKSystemPreviewView.mm:
624         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
625         - Switch to using QuickLookSoftLink.{h,mm} in PAL.
626
627 2019-01-22  Oriol Brufau  <obrufau@igalia.com>
628
629         [css-logical] Implement flow-relative margin, padding and border shorthands
630         https://bugs.webkit.org/show_bug.cgi?id=188697
631
632         Reviewed by Simon Fraser and Antti Koivisto.
633
634         Add a CSSLogicalEnabled runtime flag.
635
636         * Shared/WebPreferences.yaml:
637
638 2019-01-22  Frederic Wang  <fwang@igalia.com>
639
640         Enable CSSOMViewScrollingAPI
641         https://bugs.webkit.org/show_bug.cgi?id=189472
642
643         Reviewed by Simon Fraser.
644
645         This patch enables the CSSOMViewScrollingAPI option by default. This feature has already been
646         enabled in tests since r235855. Basically, this change fixes an old compatibility issue
647         regarding which scrolling element correspond to the viewport in standard mode (WebKit uses
648         document.body while Gecko/Edge/Chromium use document.documentElement as described in the
649         CSSOM View specification). WebKit developers writing tests can use document.scrollingElement
650         for that purpose, so that they work independently of whether the option is enabled.
651
652         [1] https://lists.webkit.org/pipermail/webkit-dev/2018-January/029857.html
653
654         * Shared/WebPreferences.yaml: Enable by default and remove "experimental" category in
655         accordance with the new policy. Instead, keep an internal flag only for developers.
656
657 2019-01-21  Antti Koivisto  <antti@apple.com>
658
659         [iOS] Handle hit testing for subframes
660         https://bugs.webkit.org/show_bug.cgi?id=192303
661
662         Reviewed by Frédéric Wang.
663
664         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
665         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
666
667         Only set delegatesScrolling for the main frame.
668
669 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
670
671         Unreviewed test fix after r240243
672         Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
673         <rdar://problem/47433602>
674
675         The new ResourceLoadStatistics section of 'removeData' was incrementing the
676         pending callback count before deciding whether to send a message to delete
677         data. This left the count out-of-balance leading to the operation never
678         completing.
679
680         This patch also prevents sending a second message to the NetworkProcess
681         requesting data be deleted if the message was already sent in an earlier
682         section of the method (e.g., as typically happens when all website data
683         is being deleted).
684
685         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
686         (WebKit::WebsiteDataStore::removeData):
687
688 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
689
690         Implement message handlers for NetworkProcess-based ResourceLoadStatistics
691         https://bugs.webkit.org/show_bug.cgi?id=193556
692         <rdar://problem/47368501>
693
694         Reviewed by Alex Christensen.
695
696         This patch adds a number of sibling methods for tracking ResourceLoadStatistics when the
697         observations are being handled in the NetworkProcess, rather than the UIProcess. The
698         original versions of these methods will be removed as part of Bug 193303.
699
700         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
701         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
702         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
703         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
704         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
705         (WebKit::ResourceLoadStatisticsMemoryStore::store const):
706         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
707         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
708         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenTelemetryWasCaptured):
709         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
710         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
711         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
712         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
713         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
714         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
715         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
716         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
717         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
718         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
719         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
720         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
721         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
722         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
723         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
724         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
725         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
726         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
727         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
728         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
729         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
730         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
731         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
732         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
733         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
734         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
735         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
736         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
737         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
738         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
739         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
740         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
741         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
742         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
743         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
744         (WebKit::submitTopList):
745         (WebKit::submitTopLists):
746         (WebKit::notifyPages):
747         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
748         (WebKit::nonEphemeralWebPageProxy): Deleted.
749         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
750         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
751         * NetworkProcess/NetworkConnectionToWebProcess.h:
752         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
753         * NetworkProcess/NetworkProcess.cpp:
754         (WebKit::NetworkProcess::dumpResourceLoadStatistics):
755         (WebKit::NetworkProcess::isGrandfathered):
756         (WebKit::NetworkProcess::isPrevalentResource):
757         (WebKit::NetworkProcess::isVeryPrevalentResource):
758         (WebKit::NetworkProcess::setGrandfathered):
759         (WebKit::NetworkProcess::setPrevalentResource):
760         (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
761         (WebKit::NetworkProcess::setVeryPrevalentResource):
762         (WebKit::NetworkProcess::clearPrevalentResource):
763         (WebKit::NetworkProcess::submitTelemetry):
764         (WebKit::NetworkProcess::scheduleCookieBlockingUpdate):
765         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
766         (WebKit::NetworkProcess::resetParametersToDefaultValues):
767         (WebKit::NetworkProcess::scheduleStatisticsAndDataRecordsProcessing):
768         (WebKit::NetworkProcess::setNotifyPagesWhenDataRecordsWereScanned):
769         (WebKit::NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured):
770         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
771         (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
772         (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
773         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
774         (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
775         (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
776         (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
777         (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
778         (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
779         (WebKit::NetworkProcess::setLastSeen):
780         (WebKit::NetworkProcess::hasStorageAccess):
781         (WebKit::NetworkProcess::requestStorageAccess):
782         (WebKit::NetworkProcess::grantStorageAccess):
783         (WebKit::NetworkProcess::logUserInteraction):
784         (WebKit::NetworkProcess::hadUserInteraction):
785         (WebKit::NetworkProcess::clearUserInteraction):
786         (WebKit::NetworkProcess::setGrandfatheringTime):
787         (WebKit::NetworkProcess::setMaxStatisticsEntries):
788         (WebKit::NetworkProcess::setMinimumTimeBetweenDataRecordsRemoval):
789         (WebKit::NetworkProcess::setPruneEntriesDownTo):
790         (WebKit::NetworkProcess::setTimeToLiveUserInteraction):
791         (WebKit::NetworkProcess::setShouldClassifyResourcesBeforeDataRecordsRemoval):
792         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
793         (WebKit::NetworkProcess::setResourceLoadStatisticsDebugMode):
794         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
795         (WebKit::NetworkProcess::deleteWebsiteData):
796         (WebKit::filterForTopLevelDomains):
797         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
798         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
799         * NetworkProcess/NetworkProcess.h:
800         * NetworkProcess/NetworkProcess.messages.in:
801         * NetworkProcess/NetworkSession.cpp:
802         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
803         (WebKit::NetworkSession::notifyResourceLoadStatisticsProcessed):
804         (WebKit::NetworkSession::logDiagnosticMessageWithValue):
805         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
806         (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
807         (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData):
808         (WebKit::NetworkSession::enableResourceLoadStatistics): Deleted.
809         * NetworkProcess/NetworkSession.h:
810         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
811         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
812         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
813         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
814         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
815         (WKWebsiteDataStoreSetStatisticsLastSeen):
816         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
817         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
818         (WKWebsiteDataStoreDumpResourceLoadStatistics):
819         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
820         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
821         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
822         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
823         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
824         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
825         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
826         (WKWebsiteDataStoreSetStatisticsGrandfathered):
827         (WKWebsiteDataStoreIsStatisticsGrandfathered):
828         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
829         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
830         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
831         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
832         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
833         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
834         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
835         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
836         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
837         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
838         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
839         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
840         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
841         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
842         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
843         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
844         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
845         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
846         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
847         (WKWebsiteDataStoreStatisticsResetToConsistentState):
848         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
849         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
850         * UIProcess/Network/NetworkProcessProxy.cpp:
851         (WebKit::NetworkProcessProxy::clearCallbackStates):
852         (WebKit::NetworkProcessProxy::didClose):
853         (WebKit::nonEphemeralWebPageProxy):
854         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue):
855         (WebKit::NetworkProcessProxy::dumpResourceLoadStatistics):
856         (WebKit::NetworkProcessProxy::didDumpResourceLoadStatistics):
857         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
858         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
859         (WebKit::NetworkProcessProxy::isPrevalentResource):
860         (WebKit::NetworkProcessProxy::isPrevalentResourceResult):
861         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
862         (WebKit::NetworkProcessProxy::setPrevalentResource):
863         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
864         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
865         (WebKit::NetworkProcessProxy::didSetResourceLoadStatisticData):
866         (WebKit::NetworkProcessProxy::setLastSeen):
867         (WebKit::NetworkProcessProxy::clearPrevalentResource):
868         (WebKit::NetworkProcessProxy::scheduleCookieBlockingUpdate):
869         (WebKit::NetworkProcessProxy::didScheduleCookieBlockingUpdate):
870         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
871         (WebKit::NetworkProcessProxy::didScheduleStatisticsProcessing):
872         (WebKit::NetworkProcessProxy::scheduleStatisticsAndDataRecordsProcessing):
873         (WebKit::NetworkProcessProxy::logUserInteraction):
874         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
875         (WebKit::NetworkProcessProxy::didHaveUserInteraction):
876         (WebKit::NetworkProcessProxy::clearUserInteraction):
877         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
878         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
879         (WebKit::NetworkProcessProxy::setTimeToLiveUserInteraction):
880         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings):
881         (WebKit::NetworkProcessProxy::setNotifyPagesWhenTelemetryWasCaptured):
882         (WebKit::NetworkProcessProxy::setNotifyPagesWhenDataRecordsWereScanned):
883         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
884         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
885         (WebKit::NetworkProcessProxy::didIsRegisteredAsRedirectingTo):
886         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
887         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubFrameUnder):
888         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
889         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
890         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubresourceUnder):
891         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
892         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
893         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
894         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
895         (WebKit::NetworkProcessProxy::isGrandfathered):
896         (WebKit::NetworkProcessProxy::didIsGrandfathered):
897         (WebKit::NetworkProcessProxy::setGrandfathered):
898         (WebKit::NetworkProcessProxy::hasStorageAccess):
899         (WebKit::NetworkProcessProxy::requestStorageAccess):
900         (WebKit::NetworkProcessProxy::grantStorageAccess):
901         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
902         (WebKit::NetworkProcessProxy::storageAccessOperationResult):
903         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
904         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
905         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
906         (WebKit::NetworkProcessProxy::setGrandfatheringTime):
907         (WebKit::NetworkProcessProxy::setMaxStatisticsEntries):
908         (WebKit::NetworkProcessProxy::setMinimumTimeBetweenDataRecordsRemoval):
909         (WebKit::NetworkProcessProxy::setPruneEntriesDownTo):
910         (WebKit::NetworkProcessProxy::setShouldClassifyResourcesBeforeDataRecordsRemoval):
911         (WebKit::NetworkProcessProxy::setResourceLoadStatisticsDebugMode):
912         (WebKit::NetworkProcessProxy::resetParametersToDefaultValues):
913         (WebKit::NetworkProcessProxy::submitTelemetry):
914         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsProcessed):
915         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
916         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
917         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
918         (WebKit::NetworkProcessProxy::didLogUserInteraction): Deleted.
919         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources): Deleted.
920         * UIProcess/Network/NetworkProcessProxy.h:
921         * UIProcess/Network/NetworkProcessProxy.messages.in:
922         * UIProcess/WebPageProxy.cpp:
923         (WebKit::WebPageProxy::nonEphemeralWebPageProxy):
924         * UIProcess/WebPageProxy.h:
925         * UIProcess/WebProcessPool.cpp:
926         (WebKit::WebProcessPool::ensureNetworkProcess):
927         * UIProcess/WebProcessProxy.cpp:
928         (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
929         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
930         * UIProcess/WebProcessProxy.h:
931         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
932         (WebKit::WebsiteDataStore::parameters):
933         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
934         (WebKit::WebsiteDataStore::removeData):
935         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
936         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
937         (WebKit::WebsiteDataStore::setGrandfatheringTime):
938         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
939         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
940         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
941         (WebKit::WebsiteDataStore::isPrevalentResource):
942         (WebKit::WebsiteDataStore::setPrevalentResource):
943         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
944         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
945         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
946         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
947         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
948         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
949         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
950         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
951         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
952         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
953         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
954         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
955         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
956         (WebKit::WebsiteDataStore::clearPrevalentResource):
957         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
958         (WebKit::WebsiteDataStore::submitTelemetry):
959         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
960         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
961         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
962         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
963         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
964         (WebKit::WebsiteDataStore::setLastSeen):
965         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
966         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
967         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
968         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
969         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
970         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
971         (WebKit::WebsiteDataStore::removePrevalentDomains):
972         (WebKit::WebsiteDataStore::hasStorageAccess):
973         (WebKit::WebsiteDataStore::requestStorageAccess):
974         (WebKit::WebsiteDataStore::grantStorageAccess):
975         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
976         (WebKit::WebsiteDataStore::logUserInteraction):
977         (WebKit::WebsiteDataStore::hasHadUserInteraction):
978         (WebKit::WebsiteDataStore::clearUserInteraction):
979         (WebKit::WebsiteDataStore::isGrandfathered):
980         (WebKit::WebsiteDataStore::setGrandfathered):
981         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
982         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
983         (WebKit::WebsiteDataStore::webPageWasAdded):
984         (WebKit::WebsiteDataStore::webPageWasInvalidated):
985         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
986         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
987         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
988         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
989         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
990         (WebKit::WebsiteDataStore::processPools const):
991         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled const):
992         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
993         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
994         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
995         (WebKit::WebsiteDataStore::logTestingEvent):
996         * UIProcess/WebsiteData/WebsiteDataStore.h:
997         (WebKit::WebsiteDataStore::setStatisticsTestingCallback):
998         * WebProcess/WebProcess.cpp:
999         (WebKit::WebProcess::initializeWebProcess):
1000
1001 2019-01-15  Darin Adler  <darin@apple.com>
1002
1003         Use references rather than pointers for register/unregister functions, and more
1004         https://bugs.webkit.org/show_bug.cgi?id=175028
1005
1006         Reviewed by Daniel Bates.
1007
1008         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1009         (WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
1010         functions in Document; pass a reference.
1011         (WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
1012         (WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
1013         (WebKit::WebFullScreenManager::didExitFullScreen): Ditto.
1014
1015         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1016         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
1017         (WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
1018         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
1019         * WebProcess/Plugins/PluginView.cpp:
1020         (WebKit::PluginView::~PluginView): Ditto.
1021         (WebKit::PluginView::initializePlugin): Ditto.
1022
1023 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1024
1025         Unreviewed, fix -Wreturn-type warning
1026         https://bugs.webkit.org/show_bug.cgi?id=193333
1027         <rdar://problem/45649489>
1028
1029         * UIProcess/Automation/WebAutomationSession.cpp:
1030         (WebKit::toProtocol):
1031
1032 2019-01-20  chris fleizach  <cfleizach@apple.com>
1033
1034         AX: Support returning relative frames for accessibility
1035         https://bugs.webkit.org/show_bug.cgi?id=193414
1036         <rdar://problem/47268501>
1037
1038         Reviewed by Zalan Bujtas.
1039
1040         * UIProcess/API/Cocoa/WKWebView.mm:
1041         (-[WKWebView accessibilityAttributeValue:forParameter:]):
1042         (-[WKWebView IGNORE_WARNINGS_END]):
1043         * UIProcess/API/mac/WKView.mm:
1044         (-[WKView accessibilityAttributeValue:forParameter:]):
1045         (-[WKView IGNORE_WARNINGS_END]):
1046         * UIProcess/Cocoa/WebViewImpl.h:
1047         * UIProcess/Cocoa/WebViewImpl.mm:
1048         (WebKit::WebViewImpl::accessibilityAttributeValue):
1049         * UIProcess/ios/WKContentView.mm:
1050         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
1051
1052 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1053
1054         Unreviewed, rolling out r240209.
1055
1056         Broke GTK/WPE injected bundle
1057
1058         Reverted changeset:
1059
1060         "AX: Support returning relative frames for accessibility"
1061         https://bugs.webkit.org/show_bug.cgi?id=193414
1062         https://trac.webkit.org/changeset/240209
1063
1064 2019-01-12  Dan Bernstein  <mitz@apple.com>
1065
1066         [Cocoa] Avoid importing directly from subumbrella frameworks
1067         https://bugs.webkit.org/show_bug.cgi?id=186016
1068         <rdar://problem/40591038>
1069
1070         Reviewed by Sam Weinig.
1071
1072         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
1073           OTHER_CPLUSPLUSFLAGS.
1074         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
1075           HIToolbox header.
1076         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
1077         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
1078         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
1079           header.
1080         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
1081           PDFKit header.
1082         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
1083         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
1084         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
1085         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
1086         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
1087         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
1088         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
1089
1090 2019-01-20  chris fleizach  <cfleizach@apple.com>
1091
1092         AX: Support returning relative frames for accessibility
1093         https://bugs.webkit.org/show_bug.cgi?id=193414
1094         <rdar://problem/47268501>
1095
1096         Reviewed by Zalan Bujtas.
1097
1098         * UIProcess/API/Cocoa/WKWebView.mm:
1099         (-[WKWebView accessibilityAttributeValue:forParameter:]):
1100         (-[WKWebView IGNORE_WARNINGS_END]):
1101         * UIProcess/API/mac/WKView.mm:
1102         (-[WKView accessibilityAttributeValue:forParameter:]):
1103         (-[WKView IGNORE_WARNINGS_END]):
1104         * UIProcess/Cocoa/WebViewImpl.h:
1105         * UIProcess/Cocoa/WebViewImpl.mm:
1106         (WebKit::WebViewImpl::accessibilityAttributeValue):
1107         * UIProcess/ios/WKContentView.mm:
1108         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
1109
1110 2019-01-20  Antoine Quint  <graouts@apple.com>
1111
1112         Add a POINTER_EVENTS feature flag
1113         https://bugs.webkit.org/show_bug.cgi?id=193577
1114         <rdar://problem/47408511>
1115
1116         Unreviewed. Also enable Pointer Events for iosmac.
1117
1118         * Configurations/FeatureDefines.xcconfig:
1119
1120 2019-01-19  David Kilzer  <ddkilzer@apple.com>
1121
1122         Follow-up: iOS: Updating input mode should update the software keyboard
1123         <https://bugs.webkit.org/show_bug.cgi?id=193565>
1124         <rdar://problem/47376334>
1125
1126         * WebProcess/WebPage/WebPage.cpp:
1127         (WebKit::WebPage::focusedElementDidChangeInputMode): Fix iOS
1128         Debug builds after r240199 by downcasting `element` to
1129         `HTMLElement` before calling canonicalInputMode().
1130
1131 2019-01-19  David Kilzer  <ddkilzer@apple.com>
1132
1133         Sort WebKit Xcode project file
1134
1135         * WebKit.xcodeproj/project.pbxproj:
1136
1137 2019-01-19  Antoine Quint  <graouts@apple.com>
1138
1139         Add a POINTER_EVENTS feature flag
1140         https://bugs.webkit.org/show_bug.cgi?id=193577
1141
1142         Reviewed by Dean Jackson.
1143
1144         * Configurations/FeatureDefines.xcconfig:
1145
1146 2019-01-18  Ryosuke Niwa  <rniwa@webkit.org>
1147
1148         iOS: Updating input mode should update the software keyboard
1149         https://bugs.webkit.org/show_bug.cgi?id=193565
1150         <rdar://problem/47376334>
1151
1152         Reviewed by Wenson Hsieh.
1153
1154         Update the software keyboard when the inputmode content attribute on the focused element had been mutated.
1155
1156         * Scripts/webkit/messages.py:
1157         * Shared/WebCoreArgumentCoders.h:
1158         * UIProcess/PageClient.h:
1159         * UIProcess/WebPageProxy.h:
1160         * UIProcess/WebPageProxy.messages.in:
1161         * UIProcess/ios/PageClientImplIOS.h:
1162         * UIProcess/ios/PageClientImplIOS.mm:
1163         (WebKit::PageClientImpl::focusedElementDidChangeInputMode):
1164         * UIProcess/ios/WKContentViewInteraction.h:
1165         * UIProcess/ios/WKContentViewInteraction.mm:
1166         (-[WKContentView _didUpdateInputMode:]):
1167         * UIProcess/ios/WebPageProxyIOS.mm:
1168         (WebKit::WebPageProxy::focusedElementDidChangeInputMode):
1169         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1170         (WebKit::WebChromeClient::focusedElementDidChangeInputMode):
1171         * WebProcess/WebCoreSupport/WebChromeClient.h:
1172         * WebProcess/WebPage/WebPage.cpp:
1173         (WebKit::WebPage::focusedElementDidChangeInputMode):
1174         * WebProcess/WebPage/WebPage.h:
1175
1176 2019-01-18  Tim Horton  <timothy_horton@apple.com>
1177
1178         Adjust WKDrawingView protocol method name
1179         https://bugs.webkit.org/show_bug.cgi?id=193604
1180
1181         Reviewed by Wenson Hsieh.
1182
1183         * UIProcess/ios/WKDrawingView.mm:
1184         (-[WKDrawingView canvasViewDrawingDidChange:]):
1185         (-[WKDrawingView drawingDidChange:]): Deleted.
1186
1187 2019-01-18  David Kilzer  <ddkilzer@apple.com>
1188
1189         [WebKit] Change Xcode folders to map to folders on disk
1190
1191         * WebKit.xcodeproj/project.pbxproj: Update these folders:
1192         - Shared/Authentication
1193         - Shared/Authentication/cocoa
1194
1195 2019-01-18  Brian Burg  <bburg@apple.com>
1196
1197         Automation.computeElementLayout should return visual viewport-aware coordinates
1198         https://bugs.webkit.org/show_bug.cgi?id=193598
1199         <rdar://problem/35325644>
1200
1201         Reviewed by Simon Fraser.
1202
1203         Previously I added CoordinateSystem::VisualViewport to stub out this for iOS.
1204         But I think that it's a mistake for safaridriver to care about VisualViewport
1205         being enabled or not, because it is a runtime-switchable setting.
1206
1207         This patch removes CoordinateSystem::VisualViewport. Make the existing
1208         CoordinateSystem::LayoutViewport use visual viewport semantics if needed.
1209
1210         This is tested by WebDriver element clicking tests. There should not be any
1211         difference in behavior until it is possible to zoom with gestures via WebDriver.
1212
1213         * Shared/CoordinateSystem.h:
1214         * UIProcess/Automation/Automation.json:
1215         * UIProcess/Automation/WebAutomationSession.cpp:
1216         (WebKit::protocolStringToCoordinateSystem):
1217         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1218         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1219
1220 2019-01-18  Daniel Bates  <dabates@apple.com>
1221
1222         Fix some build issues.
1223
1224         Include missing header WKDrawingCoordinator.
1225
1226         * UIProcess/ios/WKInkPickerView.mm:
1227
1228 2019-01-18  Tim Horton  <timothy_horton@apple.com>
1229
1230         Get rid of ADVANCED_SPELL_CHECKING
1231         https://bugs.webkit.org/show_bug.cgi?id=193592
1232
1233         Reviewed by Wenson Hsieh.
1234
1235         * UIProcess/Cocoa/WebViewImpl.mm:
1236         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
1237         (WebKit::WebViewImpl::insertText):
1238         * UIProcess/mac/TextCheckerMac.mm:
1239         (WebKit::TextChecker::checkTextOfParagraph):
1240         (WebKit::TextChecker::getGuessesForWord):
1241
1242 2019-01-18  Chris Dumez  <cdumez@apple.com>
1243
1244         Regression(PSON) Content blockers are sometimes lost on back navigation cross-site
1245         https://bugs.webkit.org/show_bug.cgi?id=193588
1246         <rdar://problem/47131566>
1247
1248         Reviewed by Alex Christensen.
1249
1250         When the WebPageProxy needs to create initialization parameters for its WebPage in the
1251         WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy()
1252         which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to
1253         register the WebProcessProxy with the WebUserContentControllerProxy and adding the
1254         contentRuleLists to the WebPageCreationParameters. The issue is that if the
1255         WebUserContentControllerProxy already knows about this WebProcessProxy, it would return
1256         early and not populate the WebPageCreationParameters.
1257
1258         In PSON world, when navigating back to a page that failed to enter page cache, we reuse
1259         the process where we previously loaded the page but re-create a new WebPage on the
1260         WebContent process site. When this happens, WebUserContentControllerProxy would not
1261         add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the
1262         previously-suspended process would be missing them.
1263
1264         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1265         (WebKit::WebUserContentControllerProxy::addProcess):
1266
1267 2019-01-18  Jer Noble  <jer.noble@apple.com>
1268
1269         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
1270         https://bugs.webkit.org/show_bug.cgi?id=189553
1271
1272         Reviewed by Tim Horton.
1273
1274         * Configurations/Base.xcconfig:
1275         * Configurations/BaseTarget.xcconfig:
1276         * Configurations/SDKVariant.xcconfig: Added.
1277
1278 2019-01-18  Antti Koivisto  <antti@apple.com>
1279
1280         Implement asynchronous frame scrolling for iOS
1281         https://bugs.webkit.org/show_bug.cgi?id=193539
1282         <rdar://problem/47379873>
1283
1284         Reviewed by Simon Fraser.
1285
1286         Add a scrolling node type that can handle UIScrollView backed frames.
1287         It basically just instantiates and forwards to the existing ScrollingTreeScrollingNodeDelegateIOS.
1288
1289         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1290         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1291         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1292         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1293         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: Added.
1294         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: Added.
1295         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::create):
1296         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::ScrollingTreeFrameScrollingNodeRemoteIOS):
1297         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::~ScrollingTreeFrameScrollingNodeRemoteIOS):
1298         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
1299         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
1300         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
1301         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const):
1302         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition):
1303         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll):
1304         * WebKit.xcodeproj/project.pbxproj:
1305
1306 2019-01-18  Chris Dumez  <cdumez@apple.com>
1307
1308         Regression(PSON) Scroll position is not always restored properly when navigating back
1309         https://bugs.webkit.org/show_bug.cgi?id=193578
1310         <rdar://problem/47386331>
1311
1312         Reviewed by Tim Horton.
1313
1314         Fix issues causing the scroll position to not be restored at all (or incorrectly) when
1315         navigating back cross-site with PSON enabled. Also make sure that the swipe gesture
1316         snapshot really stays up until we've restored the scroll position.
1317
1318         Note that even after those changes, I can still sometimes reproduce a white flash when
1319         swiping back to Google search results (scroll position being correct now). This is
1320         tracked by <rdar://problem/47071684> and happens even if I disable PSON entirely.
1321
1322         * Shared/SessionState.cpp:
1323         (WebKit::FrameState::encode const):
1324         (WebKit::FrameState::decode):
1325         * Shared/SessionState.h:
1326         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1327         (WebKit::toFrameState):
1328         (WebKit::applyFrameState):
1329         obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to
1330         or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to
1331         properly restore the scrollPosition (position was 70px off on my iPad without this).
1332         With PSON enabled, if you swipe back cross-process and the previous page was not put
1333         into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is
1334         that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores
1335         the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost
1336         in the process since the UIProcess never knew about it.
1337
1338         * UIProcess/Cocoa/ViewGestureController.cpp:
1339         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
1340         Drop logic that was causing the ViewGestureController to not wait for the scroll position
1341         to be restored before taking down the snapshot, when UI-side compositing is enabled.
1342         If you look at the comment above the code, you'll see that the code in question was meant
1343         to impact only the non-UI side compositing code path. As a matter of fact, when the code
1344         was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a
1345         #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we
1346         would have often restored the scroll position by the time the load is finished so it would
1347         not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we
1348         do on process-swap, the first post-scroll restoration layer tree commit may now occur a
1349         little bit later and we would lose the race more often.
1350
1351         * UIProcess/WebProcessProxy.cpp:
1352         (WebKit::WebProcessProxy::updateBackForwardItem):
1353         * UIProcess/WebProcessProxy.h:
1354         When adding PageCache support to PSON, we used to navigate the "suspended" page to
1355         about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem()
1356         calls from the WebProcess which we wanted to ignore. We thus added logic to ignore
1357         updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this
1358         is that we sometimes miss/ignore legit updates to the HistoryItem from the old process,
1359         in particular with regards to the scroll position and the pageScaleFactor. So if you
1360         swiped and then quickly enough did a cross-site navigation, the UIProcess'
1361         WebBackForwardList would not get updated with the latest scroll position and we would
1362         thus fail to restore it later on. To address the issue, we now stop ignoring updates
1363         from the old WebProcess after a swap. This logic is no longer needed since we no longer
1364         navigate the old page to about:blank after a swap, we merely suspend it "in place".
1365
1366 2019-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1367
1368         Remove some last vestiges of assisted node terminology in WebKit
1369         https://bugs.webkit.org/show_bug.cgi?id=193572
1370
1371         Reviewed by Tim Horton.
1372
1373         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
1374         * UIProcess/ios/WKContentViewInteraction.mm:
1375         (-[WKContentView gestureRecognizerShouldBegin:]):
1376         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1377         (-[WKContentView _showKeyboard]):
1378         (-[WKContentView _hideKeyboard]):
1379
1380         Add a FIXME about invoking `-reloadInputViews` on watchOS when the focused element is blurred.
1381
1382         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1383         (-[WKContentView _elementDidBlur]):
1384         (-[WKContentView updateCurrentFocusedElementInformation:]):
1385         (-[WKContentView _startAssistingKeyboard]): Deleted.
1386         (-[WKContentView _stopAssistingKeyboard]): Deleted.
1387         * WebProcess/WebPage/ios/WebPageIOS.mm:
1388         (WebKit::WebPage::getFocusedElementInformation):
1389
1390 2019-01-18  Youenn Fablet  <youenn@apple.com>
1391
1392         Add a new SPI to request for cache storage quota increase
1393         https://bugs.webkit.org/show_bug.cgi?id=193323
1394
1395         Reviewed by Alex Christensen.
1396
1397         Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
1398         The current SPI is currently CacheStorage specific but future work should
1399         make it so that other storage like IDB use the same mechanism.
1400         By default, quota remains unchanged if delegate is not implemented.
1401
1402         * NetworkProcess/NetworkProcess.cpp:
1403         * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
1404         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1405         (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
1406         (-[WKWebsiteDataStore _quotaDelegate]):
1407         (-[WKWebsiteDataStore set_quotaDelegate:]):
1408         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
1409         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1410         * UIProcess/Network/NetworkProcessProxy.cpp:
1411         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
1412         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1413         (WebKit::WebsiteDataStore::WebsiteDataStore):
1414         * UIProcess/WebsiteData/WebsiteDataStore.h:
1415         (WebKit::WebsiteDataStore::quotaManager):
1416         (WebKit::WebsiteDataStore::setQuotaManager):
1417         * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
1418         (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
1419         (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
1420         * WebKit.xcodeproj/project.pbxproj:
1421
1422 2019-01-18  Philippe Normand  <pnormand@igalia.com>
1423
1424         [WPE] Add Qt extension
1425         https://bugs.webkit.org/show_bug.cgi?id=191464
1426
1427         Reviewed by Carlos Garcia Campos.
1428
1429         This new extension is a QML plugin embedding a WPE ViewBackend
1430         implementation. It provides a public API very similar to Qt's
1431         WebView module. It comes with a simple mini-browser implemented in
1432         QML.
1433
1434         QtWPE is known to work with the Wayland-EGL (in GNOME and Weston
1435         compositors) and EGLFS QPAs.
1436
1437         * PlatformWPE.cmake:
1438         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp: Added.
1439         (WPEQmlExtensionPlugin::registerTypes):
1440         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.h: Added.
1441         * UIProcess/API/wpe/qt/WPEQtView.cpp: Added.
1442         (WPEQtView::WPEQtView):
1443         (WPEQtView::~WPEQtView):
1444         (WPEQtView::geometryChanged):
1445         (WPEQtView::configureWindow):
1446         (WPEQtView::createOffscreen):
1447         (WPEQtView::backendCreated):
1448         (WPEQtView::notifyUrlChangedCallback):
1449         (WPEQtView::notifyTitleChangedCallback):
1450         (WPEQtView::notifyLoadProgressCallback):
1451         (WPEQtView::notifyLoadChangedCallback):
1452         (WPEQtView::notifyLoadFailedCallback):
1453         (WPEQtView::updatePaintNode):
1454         (WPEQtView::url const):
1455         (WPEQtView::setUrl):
1456         (WPEQtView::loadProgress const):
1457         (WPEQtView::title const):
1458         (WPEQtView::canGoBack const):
1459         (WPEQtView::isLoading const):
1460         (WPEQtView::canGoForward const):
1461         (WPEQtView::goBack):
1462         (WPEQtView::goForward):
1463         (WPEQtView::reload):
1464         (WPEQtView::stop):
1465         (WPEQtView::loadHtml):
1466         (WPEQtView::jsAsyncReadyCallback):
1467         (WPEQtView::handleJsResult):
1468         (WPEQtView::runJavaScript):
1469         (WPEQtView::mousePressEvent):
1470         (WPEQtView::mouseReleaseEvent):
1471         (WPEQtView::hoverEnterEvent):
1472         (WPEQtView::hoverLeaveEvent):
1473         (WPEQtView::hoverMoveEvent):
1474         (WPEQtView::wheelEvent):
1475         (WPEQtView::keyPressEvent):
1476         (WPEQtView::keyReleaseEvent):
1477         (WPEQtView::touchEvent):
1478         * UIProcess/API/wpe/qt/WPEQtView.h: Added.
1479         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: Added.
1480         (configureCallback):
1481         (WPEQtViewBackend::WPEQtViewBackend):
1482         (WPEQtViewBackend::~WPEQtViewBackend):
1483         (WPEQtViewBackend::configureGlibEglDisplay):
1484         (WPEQtViewBackend::configureEglDisplay):
1485         (WPEQtViewBackend::initialize):
1486         (WPEQtViewBackend::backend const):
1487         (WPEQtViewBackend::resize):
1488         (WPEQtViewBackend::getTexture):
1489         (WPEQtViewBackend::initSurface):
1490         (WPEQtViewBackend::displayImage):
1491         (WPEQtViewBackend::modifiers const):
1492         (WPEQtViewBackend::dispatchHoverEnterEvent):
1493         (WPEQtViewBackend::dispatchHoverLeaveEvent):
1494         (WPEQtViewBackend::dispatchHoverMoveEvent):
1495         (WPEQtViewBackend::dispatchMousePressEvent):
1496         (WPEQtViewBackend::dispatchMouseReleaseEvent):
1497         (WPEQtViewBackend::dispatchWheelEvent):
1498         (WPEQtViewBackend::dispatchKeyEvent):
1499         (WPEQtViewBackend::dispatchTouchEvent):
1500         * UIProcess/API/wpe/qt/WPEQtViewBackend.h: Added.
1501         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp: Added.
1502         (WPEQtViewLoadRequest::WPEQtViewLoadRequest):
1503         (WPEQtViewLoadRequest::~WPEQtViewLoadRequest):
1504         (WPEQtViewLoadRequest::url const):
1505         (WPEQtViewLoadRequest::status const):
1506         (WPEQtViewLoadRequest::errorString const):
1507         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Added.
1508         * UIProcess/API/wpe/qt/WPEQtViewLoadRequestPrivate.h: Added.
1509         (WPEQtViewLoadRequestPrivate::WPEQtViewLoadRequestPrivate):
1510         (WPEQtViewLoadRequestPrivate::~WPEQtViewLoadRequestPrivate):
1511         * UIProcess/API/wpe/qt/qmldir: Added.
1512
1513 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1514
1515         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
1516         https://bugs.webkit.org/show_bug.cgi?id=193494
1517         <rdar://problem/46859627>
1518
1519         Reviewed by Simon Fraser and Tim Horton.
1520
1521         Adds `contentInsets` to `VisibleContentRectUpdateInfo`. This keeps track of the visible content insets
1522         surrounding the unobscured content rect. See WebCore ChangeLog for more details.
1523
1524         * Shared/VisibleContentRectUpdateInfo.cpp:
1525         (WebKit::VisibleContentRectUpdateInfo::encode const):
1526         (WebKit::VisibleContentRectUpdateInfo::decode):
1527         (WebKit::operator<<):
1528         * Shared/VisibleContentRectUpdateInfo.h:
1529         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
1530         (WebKit::VisibleContentRectUpdateInfo::contentInsets const):
1531         (WebKit::operator==):
1532         * UIProcess/API/Cocoa/WKWebView.mm:
1533         (-[WKWebView _computedObscuredInset]):
1534         (-[WKWebView _computedContentInset]):
1535         (-[WKWebView _computedUnobscuredSafeAreaInset]):
1536
1537         We don't care about source compatibility with iOS 10 and below anymore, so we should change these >= iOS 11
1538         target checks to simply `PLATFORM(IOS)`.
1539
1540         (-[WKWebView _updateVisibleContentRects]):
1541
1542         Compute the visible content insets on all sides of the unobscured content rect. These insets are scaled to
1543         content coordinates.
1544
1545         * UIProcess/ios/WKContentView.h:
1546         * UIProcess/ios/WKContentView.mm:
1547         (floatBoxExtent):
1548
1549         Add a helper to convert `UIEdgeInsets` to `WebCore::FloatBoxExtent`, and use it in a few places below.
1550
1551         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
1552         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
1553         * WebProcess/WebPage/ios/WebPageIOS.mm:
1554         (WebKit::WebPage::updateVisibleContentRects):
1555
1556         Update the Page's content insets.
1557
1558 2019-01-17  Truitt Savell  <tsavell@apple.com>
1559
1560         Unreviewed, rolling out r240124.
1561
1562         This commit broke an internal build.
1563
1564         Reverted changeset:
1565
1566         "SDK_VARIANT build destinations should be separate from non-
1567         SDK_VARIANT builds"
1568         https://bugs.webkit.org/show_bug.cgi?id=189553
1569         https://trac.webkit.org/changeset/240124
1570
1571 2019-01-17  John Wilander  <wilander@apple.com>
1572
1573         Add infrastructure to enable/disable ITP Debug Mode through Preferences
1574         https://bugs.webkit.org/show_bug.cgi?id=193510
1575         <rdar://problem/47330969>
1576
1577         Reviewed by Dean Jackson.
1578
1579         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1580         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
1581         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
1582         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
1583             These functions are now suited for runtime switching of ITP Debug Mode.
1584         * Shared/WebPreferences.yaml:
1585             Changed name from ResourceLoadStatisticsDebugMode to ItpDebugModeEnabled.
1586         * UIProcess/API/Cocoa/WKPreferences.mm:
1587         (-[WKPreferences _setItpDebugModeEnabled:]):
1588         (-[WKPreferences _itpDebugModeEnabled]):
1589             New private preferences functions.
1590         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1591         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
1592         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
1593             Removed support for old experimental user default. Added a new one that's
1594             not connected to any UI, i.e. merely for command line debugging where
1595             ITP Debug Mode needs to be on all the time.
1596
1597 2019-01-17  Tim Horton  <timothy_horton@apple.com>
1598
1599         Adopt NSTextCheckingSuppressInitialCapitalizationKey
1600         https://bugs.webkit.org/show_bug.cgi?id=193545
1601
1602         Reviewed by Dean Jackson.
1603
1604         * UIProcess/mac/TextCheckerMac.mm:
1605         (WebKit::TextChecker::checkTextOfParagraph):
1606         (WebKit::TextChecker::getGuessesForWord):
1607
1608 2019-01-17  Jer Noble  <jer.noble@apple.com>
1609
1610         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
1611         https://bugs.webkit.org/show_bug.cgi?id=189553
1612
1613         Reviewed by Tim Horton.
1614
1615         * Configurations/Base.xcconfig:
1616         * Configurations/BaseTarget.xcconfig:
1617         * Configurations/SDKVariant.xcconfig: Added.
1618
1619 2019-01-16  Dean Jackson  <dino@apple.com>
1620
1621         (iPad) Link tapping is sluggish on many sites
1622         https://bugs.webkit.org/show_bug.cgi?id=193522
1623         <rdar://problem/47102987>
1624
1625         Reviewed by Wenson Hsieh.
1626
1627         Some WKWebView clients might set the initial zoom scale of the page to
1628         something other than 1, which disables the "fast tap" behaviour.
1629         The fix is very simple -- just check against the initial scale rather
1630         than 1.
1631
1632         The most likely regression from this would be pages designed for desktop,
1633         but provide a viewport tag saying width=device-width and initial-scale.
1634         They might stop allowing double-tap-to-zoom.
1635
1636         * UIProcess/API/Cocoa/WKWebView.mm:
1637         (-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.
1638
1639 2019-01-17  Alex Christensen  <achristensen@webkit.org>
1640
1641         Stop using NetworkStorageSession::storageSession in WebCore
1642         https://bugs.webkit.org/show_bug.cgi?id=193529
1643
1644         Reviewed by Tim Horton.
1645
1646         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1647         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
1648         * NetworkProcess/NetworkProcess.h:
1649         * NetworkProcess/NetworkSocketStream.cpp:
1650         (WebKit::NetworkSocketStream::create):
1651         (WebKit::NetworkSocketStream::NetworkSocketStream):
1652         * NetworkProcess/NetworkSocketStream.h:
1653         * NetworkProcess/NetworkStorageSessionProvider.h: Added.
1654         * WebKit.xcodeproj/project.pbxproj:
1655         * WebProcess/Network/WebSocketProvider.cpp:
1656         (WebKit::WebSocketProvider::createSocketStreamHandle):
1657         * WebProcess/Network/WebSocketProvider.h:
1658         * WebProcess/WebPage/WebCookieJar.cpp:
1659         (WebKit::WebCookieJar::WebCookieJar):
1660         * WebProcess/WebPage/WebCookieJar.h:
1661
1662 2019-01-16  Youenn Fablet  <youenn@apple.com>
1663
1664         Add a new SPI for controlling getUserMedia
1665         https://bugs.webkit.org/show_bug.cgi?id=192793
1666
1667         Reviewed by Eric Carlson.
1668
1669         Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
1670         In particular:
1671         - The hash salt should be handled by WebKit not by apps using WebKit.
1672         - No need to expose the frame URL, only the top level origin is needed.
1673         - The names of the callback are changed to improve the intent of these callbacks.
1674         Addressed these by creating a new SPI which will replace the current one.
1675         The current SPI will be removed later on.
1676
1677         Did some refactoring by making the callbacks not return false.
1678         Instead, implement the default behavior inside the request objects as deny methods.
1679         Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.
1680
1681         * UIProcess/API/APIUIClient.h:
1682         (API::UIClient::decidePolicyForUserMediaPermissionRequest):
1683         (API::UIClient::checkUserMediaPermissionForOrigin):
1684         * UIProcess/API/C/WKPage.cpp:
1685         (WKPageSetPageUIClient):
1686         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1687         * UIProcess/API/Cocoa/WKWebView.mm:
1688         (-[WKWebView _mediaCaptureState]):
1689         (-[WKWebView _setMediaCaptureMuted:]):
1690         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1691         * UIProcess/API/glib/WebKitUIClient.cpp:
1692         * UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
1693         * UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
1694         * UIProcess/Cocoa/UIDelegate.h:
1695         * UIProcess/Cocoa/UIDelegate.mm:
1696         (WebKit::UIDelegate::setDelegate):
1697         (WebKit::requestUserMediaAuthorizationForFrame):
1698         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1699         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
1700         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
1701         * UIProcess/UserMediaPermissionCheckProxy.h:
1702         (WebKit::UserMediaPermissionCheckProxy::deny):
1703         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1704         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1705         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
1706         * UIProcess/UserMediaPermissionRequestProxy.h:
1707
1708 2019-01-16  Youenn Fablet  <youenn@apple.com>
1709
1710         Pipe cache quota request from Network Process to UIProcess
1711         https://bugs.webkit.org/show_bug.cgi?id=193296
1712
1713         Reviewed by Alex Christensen.
1714
1715         When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
1716         No record will be put until the quota request is answered.
1717         The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
1718         NetworkProcess then sends it to NetworkProcessProxy.
1719         Currently NetworkProcessProxy just answers by keeping the quota as it is.
1720         In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
1721         make a decision on the quota. This will allow prompting user to bump it as done for other data.
1722
1723         * NetworkProcess/NetworkProcess.cpp:
1724         (WebKit::NetworkProcess::requestCacheStorageSpace):
1725         * NetworkProcess/NetworkProcess.h:
1726         * NetworkProcess/cache/CacheStorageEngine.cpp:
1727         (WebKit::CacheStorage::Engine::~Engine):
1728         (WebKit::CacheStorage::Engine::from):
1729         (WebKit::CacheStorage::Engine::Engine):
1730         (WebKit::CacheStorage::Engine::requestSpace):
1731         (WebKit::CacheStorage::Engine::requestSpaceCompleted):
1732         * NetworkProcess/cache/CacheStorageEngine.h:
1733         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1734         (WebKit::CacheStorage::Cache::put):
1735         (WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
1736         * NetworkProcess/cache/CacheStorageEngineCache.h:
1737         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1738         (WebKit::CacheStorage::Caches::requestSpace):
1739         (WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
1740         * NetworkProcess/cache/CacheStorageEngineCaches.h:
1741         (WebKit::CacheStorage::Caches::isRequestingSpace const):
1742         * UIProcess/Network/NetworkProcessProxy.cpp:
1743         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
1744         * UIProcess/Network/NetworkProcessProxy.h:
1745         * UIProcess/Network/NetworkProcessProxy.messages.in:
1746
1747 2019-01-16  Alex Christensen  <achristensen@webkit.org>
1748
1749         sendBeacon to previously-unvisited https domain always fails
1750         https://bugs.webkit.org/show_bug.cgi?id=193508
1751
1752         Reviewed by Geoffrey Garen.
1753
1754         * NetworkProcess/PingLoad.cpp:
1755         (WebKit::PingLoad::didReceiveChallenge):
1756         If a ping load is doing a TLS handshake, continue if the server has good certificates.
1757
1758 2019-01-16  Youenn Fablet  <youenn@apple.com>
1759
1760         ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
1761         https://bugs.webkit.org/show_bug.cgi?id=189097
1762         <rdar://problem/43856423>
1763
1764         Reviewed by Alex Christensen.
1765
1766         In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
1767         If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
1768         To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
1769
1770         To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
1771
1772         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1773         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
1774         * NetworkProcess/NetworkConnectionToWebProcess.h:
1775         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
1776         * NetworkProcess/NetworkResourceLoader.cpp:
1777         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
1778         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
1779         * NetworkProcess/NetworkResourceLoader.h:
1780
1781 2019-01-16  Alex Christensen  <achristensen@webkit.org>
1782
1783         Revert r239938
1784         https://bugs.webkit.org/show_bug.cgi?id=193267
1785         <rdar://problem/47297304>
1786
1787         * Configurations/WebContent-iOS.entitlements:
1788
1789 2019-01-16  Chris Dumez  <cdumez@apple.com>
1790
1791         Regression(r240046) Several API tests are crashing
1792         https://bugs.webkit.org/show_bug.cgi?id=193509
1793
1794         Reviewed by Geoffrey Garen.
1795
1796         The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
1797         then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
1798         our process reference.
1799
1800         To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
1801         loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
1802         of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
1803         our process stays alive.
1804
1805         * UIProcess/ProvisionalPageProxy.cpp:
1806         (WebKit::ProvisionalPageProxy::loadData):
1807         (WebKit::ProvisionalPageProxy::loadRequest):
1808         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
1809         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
1810         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
1811         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1812         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
1813         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
1814         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1815         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
1816         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
1817         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
1818         * UIProcess/WebPageProxy.cpp:
1819         (WebKit::WebPageProxy::loadRequest):
1820         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
1821         (WebKit::WebPageProxy::loadData):
1822         (WebKit::WebPageProxy::loadDataWithNavigationShared):
1823         (WebKit::WebPageProxy::didPerformDragControllerAction):
1824         (WebKit::WebPageProxy::findPlugin):
1825         (WebKit::WebPageProxy::didCreateMainFrame):
1826         (WebKit::WebPageProxy::didCreateSubframe):
1827         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1828         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
1829         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1830         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
1831         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1832         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1833         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
1834         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
1835         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1836         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1837         (WebKit::WebPageProxy::didCommitLoadForFrame):
1838         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1839         (WebKit::WebPageProxy::didFinishLoadForFrame):
1840         (WebKit::WebPageProxy::didFailLoadForFrame):
1841         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1842         (WebKit::WebPageProxy::didReceiveTitleForFrame):
1843         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1844         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
1845         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
1846         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
1847         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
1848         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
1849         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1850         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1851         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
1852         (WebKit::WebPageProxy::decidePolicyForResponse):
1853         (WebKit::WebPageProxy::decidePolicyForResponseShared):
1854         (WebKit::WebPageProxy::unableToImplementPolicy):
1855         (WebKit::WebPageProxy::willSubmitForm):
1856         (WebKit::WebPageProxy::didNavigateWithNavigationData):
1857         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
1858         (WebKit::WebPageProxy::didPerformClientRedirect):
1859         (WebKit::WebPageProxy::didPerformClientRedirectShared):
1860         (WebKit::WebPageProxy::didPerformServerRedirect):
1861         (WebKit::WebPageProxy::didUpdateHistoryTitle):
1862         (WebKit::WebPageProxy::createNewPage):
1863         (WebKit::WebPageProxy::runJavaScriptAlert):
1864         (WebKit::WebPageProxy::runJavaScriptConfirm):
1865         (WebKit::WebPageProxy::runJavaScriptPrompt):
1866         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
1867         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1868         (WebKit::WebPageProxy::runOpenPanel):
1869         (WebKit::WebPageProxy::printFrame):
1870         (WebKit::WebPageProxy::backForwardGoToItem):
1871         (WebKit::WebPageProxy::backForwardGoToItemShared):
1872         (WebKit::WebPageProxy::learnWord):
1873         (WebKit::WebPageProxy::ignoreWord):
1874         (WebKit::WebPageProxy::didReceiveEvent):
1875         (WebKit::WebPageProxy::editingRangeCallback):
1876         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
1877         (WebKit::WebPageProxy::focusedFrameChanged):
1878         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
1879         (WebKit::WebPageProxy::exceededDatabaseQuota):
1880         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
1881         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
1882         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
1883         (WebKit::WebPageProxy::startURLSchemeTask):
1884         (WebKit::WebPageProxy::startURLSchemeTaskShared):
1885         (WebKit::WebPageProxy::stopURLSchemeTask):
1886         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
1887         * UIProcess/WebPageProxy.h:
1888
1889 2019-01-16  Chris Dumez  <cdumez@apple.com>
1890
1891         Regression(PSON) View becomes blank after click a cross-site download link
1892         https://bugs.webkit.org/show_bug.cgi?id=193361
1893         <rdar://problem/47099573>
1894
1895         Reviewed by Geoffrey Garen.
1896
1897         The issue tracked by rdar://problem/47099573 is that a provisional load may get
1898         canceled (or converted into a download) *after* we've decided to process-swap.
1899         In such cases, the view should keep displaying the current site and it should
1900         still be interactive. However, with the previous PSON model, the view (pageProxy)
1901         would have already swapped to the new process and would end up displaying the
1902         initially empty document.
1903
1904         To address the issue, this patch introduces the concept of a provisional load
1905         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
1906         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
1907         provisional page until after the load was committed in the new process. This means
1908         that the view / WebPageProxy keeps using the old process and displays the current
1909         content until a load has committed in the provisional page. If no load commits
1910         in the provisional process (e.g. because the load is cancelled or converted into
1911         a download), then we merely destroy the ProvisionalPageProxy and terminate its
1912         process, without impacting the WebPageProxy.
1913
1914         * Shared/WebPageCreationParameters.cpp:
1915         (WebKit::WebPageCreationParameters::encode const):
1916         (WebKit::WebPageCreationParameters::decode):
1917         * Shared/WebPageCreationParameters.h:
1918         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
1919         delay attaching the drawing area in case of a process-swap, no matter what
1920         now that the previous process is kept alive until the provisional load is
1921         committed in the new process.
1922
1923         * Shared/WebPolicyAction.h:
1924         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
1925         process-swap, we now tell the previous process to simply ignore the load, while
1926         we create a ProvisionalPageProxy to do the new load in a new process.
1927         Suspension of the previous page in the old process, happens later, when a load
1928         is actually committed in the new process.
1929
1930         * Sources.txt:
1931         Add new ProvisionalPageProxy file.
1932
1933         * UIProcess/API/Cocoa/WKWebView.mm:
1934         (-[WKWebView _killWebContentProcessAndResetState]):
1935         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
1936         process and the provisional one, to maintain previous behavior in our API tests.
1937
1938         * UIProcess/API/gtk/PageClientImpl.cpp:
1939         (WebKit::PageClientImpl::createDrawingAreaProxy):
1940         * UIProcess/API/gtk/PageClientImpl.h:
1941         * UIProcess/API/wpe/PageClientImpl.cpp:
1942         (WebKit::PageClientImpl::createDrawingAreaProxy):
1943         * UIProcess/API/wpe/PageClientImpl.h:
1944         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
1945         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
1946         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
1947         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
1948         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
1949         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
1950         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
1951         * UIProcess/AcceleratedDrawingAreaProxy.h:
1952         * UIProcess/Cocoa/WebViewImpl.h:
1953         * UIProcess/Cocoa/WebViewImpl.mm:
1954         (WebKit::WebViewImpl::createDrawingAreaProxy):
1955         * UIProcess/DrawingAreaProxy.cpp:
1956         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
1957         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
1958         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
1959         * UIProcess/DrawingAreaProxy.h:
1960         (WebKit::DrawingAreaProxy::process):
1961         * UIProcess/DrawingAreaProxyImpl.cpp:
1962         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
1963         (WebKit::DrawingAreaProxyImpl::update):
1964         * UIProcess/DrawingAreaProxyImpl.h:
1965         * UIProcess/PageClient.h:
1966         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1967         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1968         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
1969         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
1970         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
1971         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
1972         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
1973         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
1974         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
1975         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
1976         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1977         * UIProcess/ios/PageClientImplIOS.h:
1978         * UIProcess/ios/PageClientImplIOS.mm:
1979         (WebKit::PageClientImpl::createDrawingAreaProxy):
1980         * UIProcess/ios/WKContentView.h:
1981         * UIProcess/ios/WKContentView.mm:
1982         (-[WKContentView _createDrawingAreaProxy:]):
1983         * UIProcess/mac/PageClientImplMac.h:
1984         * UIProcess/mac/PageClientImplMac.mm:
1985         (WebKit::PageClientImpl::createDrawingAreaProxy):
1986         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1987         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1988         (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
1989         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
1990         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
1991         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
1992         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1993         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
1994         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
1995         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
1996         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
1997         * UIProcess/mac/WebPageProxyMac.mm:
1998         * UIProcess/win/PageClientImpl.cpp:
1999         (WebKit::PageClientImpl::createDrawingAreaProxy):
2000         * UIProcess/win/PageClientImpl.h:
2001         * UIProcess/win/PageClientImpl.cpp:
2002         (WebKit::PageClientImpl::createDrawingAreaProxy):
2003         * UIProcess/win/PageClientImpl.h:
2004         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2005         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2006         Pass the drawing area's associated process when constructing it and store it as a member
2007         in addition to the page. This is necessary now that a page can be associated with 2
2008         WebProcesses at a time, each having its own drawing area.
2009
2010         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2011         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
2012         Pass the process.
2013
2014         * UIProcess/ProvisionalPageProxy.cpp: Added.
2015         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2016         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2017         (WebKit::ProvisionalPageProxy::processDidTerminate):
2018         (WebKit::ProvisionalPageProxy::takeDrawingArea):
2019         (WebKit::ProvisionalPageProxy::cancel):
2020         (WebKit::ProvisionalPageProxy::processDidFinishLaunching):
2021         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
2022         (WebKit::ProvisionalPageProxy::initializeWebPage):
2023         (WebKit::ProvisionalPageProxy::loadData):
2024         (WebKit::ProvisionalPageProxy::loadRequest):
2025         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
2026         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
2027         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
2028         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2029         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2030         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2031         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
2032         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
2033         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
2034         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
2035         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
2036         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
2037         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2038         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
2039         * UIProcess/ProvisionalPageProxy.h: Added.
2040         (WebKit::ProvisionalPageProxy::page):
2041         (WebKit::ProvisionalPageProxy::mainFrame const):
2042         (WebKit::ProvisionalPageProxy::process):
2043         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
2044         (WebKit::ProvisionalPageProxy::navigationID const):
2045         (WebKit::ProvisionalPageProxy::drawingArea const):
2046         New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
2047         the provisional process.
2048
2049         * UIProcess/SuspendedPageProxy.cpp:
2050         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2051         (WebKit::SuspendedPageProxy::unsuspend):
2052         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2053         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
2054         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
2055         which tries to register itself as an IPC message receiver for the same pageID when
2056         a process-swap occurs and we're switching to a suspended page.
2057
2058         * UIProcess/WebFrameProxy.cpp:
2059         (WebKit::WebFrameProxy::isMainFrame const):
2060         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
2061         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
2062         m_mainFrame to maintain previous behavior.
2063
2064         * UIProcess/WebPageProxy.cpp:
2065         (WebKit::WebPageProxy::provisionalDrawingArea const):
2066         Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
2067         the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.
2068
2069         (WebKit::WebPageProxy::swapToWebProcess):
2070         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
2071         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
2072         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
2073         the ProvisionalPageProxy which started the provisional load.
2074
2075         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2076         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2077         committed in the provisional process.
2078
2079         (WebKit::WebPageProxy::setDrawingArea):
2080         (WebKit::WebPageProxy::initializeWebPage):
2081         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2082           committed in the provisional process.
2083         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
2084
2085         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
2086         (WebKit::WebPageProxy::loadRequest):
2087         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
2088         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
2089         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
2090
2091         (WebKit::WebPageProxy::loadData):
2092         (WebKit::WebPageProxy::loadDataWithNavigationShared):
2093         (WebKit::WebPageProxy::stopLoading):
2094         (WebKit::WebPageProxy::reload):
2095         (WebKit::WebPageProxy::didPerformDragControllerAction):
2096         (WebKit::WebPageProxy::findPlugin):
2097         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2098         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
2099         Suspension now happens later, only if we end up committing the provisional load in the new process.
2100         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
2101         to happen a bit later but it is clearer if we do this as early as possible I think.
2102
2103         (WebKit::WebPageProxy::commitProvisionalPage):
2104         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
2105         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
2106         - Suspending the current page.
2107         - Letting the client know the load is comitted
2108         - Destroy the ProvisionalPageProxy.
2109         This work used to happen earlier in continueNavigationInNewProcess().
2110
2111         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2112         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
2113         without actually having the WebPageProxy switch to the new process yet.
2114
2115         (WebKit::WebPageProxy::didCreateMainFrame):
2116         (WebKit::WebPageProxy::didCreateSubframe):
2117         (WebKit::WebPageProxy::didCreateWindow):
2118         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
2119
2120         (WebKit::WebPageProxy::didDestroyNavigation):
2121         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
2122         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
2123         the call since the navigation is merely taken over by the ProvisionalPageProxy.
2124
2125         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2126         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
2127         Moved some PSON logic to the ProvisionalPageProxy instead.
2128
2129         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2130         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
2131         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
2132         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
2133         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
2134         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
2135
2136         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2137         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
2138         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
2139
2140         (WebKit::WebPageProxy::didCommitLoadForFrame):
2141         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
2142         (WebKit::WebPageProxy::didFinishLoadForFrame):
2143         (WebKit::WebPageProxy::didFailLoadForFrame):
2144         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
2145         (WebKit::WebPageProxy::didReceiveTitleForFrame):
2146         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
2147         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
2148         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
2149         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
2150         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2151         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
2152         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2153         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2154         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2155         (WebKit::WebPageProxy::decidePolicyForResponse):
2156         (WebKit::WebPageProxy::decidePolicyForResponseShared):
2157         (WebKit::WebPageProxy::unableToImplementPolicy):
2158         (WebKit::WebPageProxy::willSubmitForm):
2159         (WebKit::WebPageProxy::didNavigateWithNavigationData):
2160         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
2161         (WebKit::WebPageProxy::didPerformClientRedirect):
2162         (WebKit::WebPageProxy::didPerformClientRedirectShared):
2163         (WebKit::WebPageProxy::didPerformServerRedirect):
2164         (WebKit::WebPageProxy::didUpdateHistoryTitle):
2165         (WebKit::WebPageProxy::createNewPage):
2166         (WebKit::WebPageProxy::runJavaScriptAlert):
2167         (WebKit::WebPageProxy::runJavaScriptConfirm):
2168         (WebKit::WebPageProxy::runJavaScriptPrompt):
2169         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
2170         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2171         (WebKit::WebPageProxy::runOpenPanel):
2172         (WebKit::WebPageProxy::printFrame):
2173         (WebKit::WebPageProxy::backForwardGoToItem):
2174         (WebKit::WebPageProxy::backForwardGoToItemShared):
2175         (WebKit::WebPageProxy::learnWord):
2176         (WebKit::WebPageProxy::ignoreWord):
2177         (WebKit::WebPageProxy::didReceiveEvent):
2178         (WebKit::WebPageProxy::editingRangeCallback):
2179         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
2180         (WebKit::WebPageProxy::focusedFrameChanged):
2181         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
2182
2183         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
2184         Cancel the provisiona load and destroy the ProvisionalPageProxy if
2185         the provisional process crashes.
2186
2187         (WebKit::WebPageProxy::resetState):
2188         Drop some code that is no longer needed.
2189
2190         (WebKit::WebPageProxy::creationParameters):
2191         - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
2192         more than one call site. This was just some bad factoring.
2193         - Take the process in parameter now that we page can be associated with several processes at a time.
2194
2195         (WebKit::WebPageProxy::exceededDatabaseQuota):
2196         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
2197         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
2198         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
2199         (WebKit::WebPageProxy::startURLSchemeTask):
2200         (WebKit::WebPageProxy::startURLSchemeTaskShared):
2201         (WebKit::WebPageProxy::stopURLSchemeTask):
2202         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
2203         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
2204         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
2205         * UIProcess/WebPageProxy.h:
2206         (WebKit::WebPageProxy::visitedLinkStore):
2207         (WebKit::WebPageProxy::provisionalPageProxy const):
2208
2209         * UIProcess/WebProcessProxy.cpp:
2210         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
2211         (WebKit::WebProcessProxy::updateBackForwardItem):
2212         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
2213         (WebKit::WebProcessProxy::didFinishLaunching):
2214         (WebKit::WebProcessProxy::canTerminateChildProcess):
2215         * UIProcess/WebProcessProxy.h:
2216         (WebKit::WebProcessProxy::addProvisionalPageProxy):
2217         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
2218         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
2219         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
2220         associated with this process yet, because it is still a ProvisionalPageProxy.        
2221
2222         * UIProcess/WebURLSchemeHandler.cpp:
2223         (WebKit::WebURLSchemeHandler::startTask):
2224         * UIProcess/WebURLSchemeHandler.h:
2225         * UIProcess/WebURLSchemeTask.cpp:
2226         (WebKit::WebURLSchemeTask::create):
2227         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
2228         (WebKit::WebURLSchemeTask::didPerformRedirection):
2229         (WebKit::WebURLSchemeTask::didReceiveResponse):
2230         (WebKit::WebURLSchemeTask::didReceiveData):
2231         (WebKit::WebURLSchemeTask::didComplete):
2232         (WebKit::WebURLSchemeTask::pageDestroyed):
2233         * UIProcess/WebURLSchemeTask.h:
2234         Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
2235         the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.
2236
2237         * UIProcess/ios/ViewGestureControllerIOS.mm:
2238         (WebKit::ViewGestureController::endSwipeGesture):
2239         Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
2240         associated with the page in case of process swap.
2241
2242         * WebKit.xcodeproj/project.pbxproj:
2243         Add ProvisionalPageProxy class.
2244
2245         * WebProcess/WebPage/WebFrame.cpp:
2246         (WebKit::toPolicyAction):
2247         (WebKit::WebFrame::didReceivePolicyDecision):
2248         * WebProcess/WebPage/WebPage.cpp:
2249         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2250         (WebKit::WebPage::reinitializeWebPage):
2251         (WebKit::WebPage::didReceivePolicyDecision):
2252         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
2253
2254         (WebKit::WebPage::didCompletePageTransition):
2255
2256         (WebKit::WebPage::setIsSuspended):
2257         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
2258         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
2259
2260         * WebProcess/WebPage/WebPage.h:
2261
2262 2019-01-16  Tim Horton  <timothy_horton@apple.com>
2263
2264         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
2265         https://bugs.webkit.org/show_bug.cgi?id=193468
2266         <rdar://problem/38645869>
2267
2268         Reviewed by Zalan Bujtas.
2269
2270         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2271         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
2272         Adjust the null-check a bit; Zalan pointed out that the layout could
2273         be responsible for the Frame/RenderView going away, so we should bail
2274         *after* layout, not before.
2275
2276 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
2277
2278         Unreviewed WinCairo build fix.
2279
2280         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2281         (WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
2282         (WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
2283         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.
2284
2285 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2286
2287         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
2288         https://bugs.webkit.org/show_bug.cgi?id=193368
2289
2290         Reviewed by Geoff Garen.
2291
2292         * WebProcess/Plugins/PluginView.cpp:
2293         (WebKit::PluginView::getAuthenticationInfo):
2294
2295 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2296
2297         Remove more NetworkProcess::singleton use
2298         https://bugs.webkit.org/show_bug.cgi?id=193484
2299
2300         Reviewed by Geoffrey Garen.
2301
2302         This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
2303         This is the kind of awful duct tape code that keeps me awake at night, but it's necessary
2304         because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than
2305         one NetworkProcess object.  To make it work well enough until we remove LegacyCustomProtocolManager,
2306         use the last NetworkProcess object that has been created.
2307
2308         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
2309         (newestNetworkProcess):
2310         (LegacyCustomProtocolManager::networkProcessCreated):
2311         (+[WKCustomProtocol canInitWithRequest:]):
2312         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
2313         (-[WKCustomProtocol startLoading]):
2314         (-[WKCustomProtocol stopLoading]):
2315         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
2316         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
2317         (WebKit::LegacyCustomProtocolManager::startLoading):
2318         (WebKit::LegacyCustomProtocolManager::stopLoading):
2319         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
2320         * NetworkProcess/NetworkProcess.cpp:
2321         (WebKit::NetworkProcess::NetworkProcess):
2322
2323 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2324
2325         Fix WinCairo build after r240014
2326         https://bugs.webkit.org/show_bug.cgi?id=161106
2327
2328         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2329
2330 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
2331
2332         VisualViewport API should be updated upon opening of keyboard
2333         https://bugs.webkit.org/show_bug.cgi?id=193475
2334
2335         Reviewed by Simon Fraser.
2336
2337         The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport
2338         unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects.
2339
2340         Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in
2341         unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated
2342         while the keyboard is getting brought up.
2343
2344         * Shared/VisibleContentRectUpdateInfo.h:
2345         (WebKit::operator==):
2346         * WebProcess/WebPage/ios/WebPageIOS.mm:
2347         (WebKit::WebPage::updateVisibleContentRects):
2348
2349 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
2350
2351         Add Reveal support in iOSMac
2352         https://bugs.webkit.org/show_bug.cgi?id=193408
2353         <rdar://problem/47300699>
2354
2355         Reviewed by Tim Horton.
2356
2357         Add calls to DictionaryLookup from the appropriate places.
2358
2359         * UIProcess/PageClient.h:
2360         * UIProcess/ios/PageClientImplIOS.h:
2361         * UIProcess/ios/PageClientImplIOS.mm:
2362         (WebKit::PageClientImpl::didPerformDictionaryLookup):
2363         * UIProcess/ios/WebPageProxyIOS.mm:
2364         (WebKit::WebPageProxy::didPerformDictionaryLookup):
2365         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
2366         (WebKit::WebPage::dictionaryPopupInfoForRange):
2367
2368 2019-01-15  Claudio Saavedra  <csaavedra@igalia.com>
2369
2370         [SOUP] Remove usage of NetworkProcess::singleton()
2371         https://bugs.webkit.org/show_bug.cgi?id=193444
2372
2373         Reviewed by Michael Catanzaro.
2374
2375         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2376         (WebKit::NetworkDataTaskSoup::download):
2377         (WebKit::NetworkDataTaskSoup::didWriteDownload):
2378         (WebKit::NetworkDataTaskSoup::didFinishDownload):
2379         (WebKit::NetworkDataTaskSoup::didFailDownload):
2380         * NetworkProcess/soup/NetworkSessionSoup.cpp:
2381         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
2382
2383 2019-01-15  Eric Carlson  <eric.carlson@apple.com>
2384
2385         Fix incorrect ASSERT added in r239840
2386         https://bugs.webkit.org/show_bug.cgi?id=193466
2387         <rdar://problem/47095142>
2388
2389         Reviewed by Youenn Fablet.
2390
2391         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2392         (WebKit::UserMediaCaptureManager::Source::Source):
2393
2394 2019-01-15  Tim Horton  <timothy_horton@apple.com>
2395
2396         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
2397         https://bugs.webkit.org/show_bug.cgi?id=193468
2398         <rdar://problem/38645869>
2399
2400         Reviewed by Beth Dakin.
2401
2402         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2403         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
2404         I'm not sure why this got *worse*, but we should null-check RenderView.
2405         It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it
2406         the next time we paint (which will surely happen if we gain a RenderView).
2407
2408 2019-01-15  Chris Dumez  <cdumez@apple.com>
2409
2410         Unreviewed, rolling out r239993, r239995, r239997, and
2411         r239999.
2412
2413         Caused assertions under
2414         ViewGestureController::disconnectFromProcess()
2415
2416         Reverted changesets:
2417
2418         "Regression(PSON) View becomes blank after click a cross-site
2419         download link"
2420         https://bugs.webkit.org/show_bug.cgi?id=193361
2421         https://trac.webkit.org/changeset/239993
2422
2423         "Unreviewed iOS build fix after r239993."
2424         https://trac.webkit.org/changeset/239995
2425
2426         "Fix iOS build after r239993"
2427         https://bugs.webkit.org/show_bug.cgi?id=193361
2428         https://trac.webkit.org/changeset/239997
2429
2430         "Unreviewed, revert part of r239997 as it is not needed to fix
2431         the build."
2432         https://trac.webkit.org/changeset/239999
2433
2434 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2435
2436         Stop using CookiesStrategy
2437         https://bugs.webkit.org/show_bug.cgi?id=161106
2438
2439         Reviewed by Don Olmstead and Antti Koivisto.
2440
2441         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
2442         (WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted.
2443         * NetworkProcess/NetworkProcessPlatformStrategies.h:
2444         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2445         * Scripts/webkit/messages.py:
2446         * Sources.txt:
2447         * WebKit.xcodeproj/project.pbxproj:
2448         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2449         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
2450         (WebKit::WebAutomationSessionProxy::deleteCookie):
2451         * WebProcess/Plugins/PluginView.cpp:
2452         (WebKit::PluginView::cookiesForURL):
2453         (WebKit::PluginView::setCookiesForURL):
2454         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
2455         (WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted.
2456         (WebKit::WebPlatformStrategies::cookiesForDOM): Deleted.
2457         (WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted.
2458         (WebKit::WebPlatformStrategies::cookiesEnabled): Deleted.
2459         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
2460         (WebKit::WebPlatformStrategies::getRawCookies): Deleted.
2461         (WebKit::WebPlatformStrategies::deleteCookie): Deleted.
2462         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
2463         * WebProcess/WebPage/WebCookieJar.cpp: Added.
2464         (WebKit::WebCookieJar::cookies const):
2465         (WebKit::WebCookieJar::setCookies):
2466         (WebKit::WebCookieJar::cookiesEnabled const):
2467         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
2468         (WebKit::WebCookieJar::getRawCookies const):
2469         (WebKit::WebCookieJar::deleteCookie):
2470         * WebProcess/WebPage/WebCookieJar.h: Added.
2471         * WebProcess/WebPage/WebPage.cpp:
2472         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2473
2474 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
2475
2476         Remove reporting for iOS mach lookups confirmed in-use
2477         https://bugs.webkit.org/show_bug.cgi?id=193455
2478         <rdar://problem/47259551>
2479
2480         Reviewed by Brent Fulgham.
2481
2482         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2483
2484 2019-01-15  Tim Horton  <timothy_horton@apple.com>
2485
2486         Cannot tab out of WKWebView on macOS
2487         https://bugs.webkit.org/show_bug.cgi?id=161448
2488         <rdar://problem/28100085>
2489
2490         Reviewed by Dean Jackson.
2491
2492         * UIProcess/WebPageProxy.cpp:
2493         (WebKit::WebPageProxy::takeFocus):
2494         If the UIDelegate doesn't implement takeFocus, provide a simple default
2495         implementation that just uses AppKit's key view loop to move the focus.
2496
2497         * UIProcess/API/APIUIClient.h:
2498         (API::UIClient::takeFocus):
2499         * UIProcess/API/C/WKPage.cpp:
2500         (WKPageSetPageUIClient):
2501         * UIProcess/Cocoa/UIDelegate.h:
2502         * UIProcess/Cocoa/UIDelegate.mm:
2503         (WebKit::UIDelegate::UIClient::takeFocus):
2504         Make API::UIClient's takeFocus return a bool indicating whether the
2505         client implements it or not.
2506
2507         * UIProcess/PageClient.h:
2508         * UIProcess/mac/PageClientImplMac.h:
2509         * UIProcess/mac/PageClientImplMac.mm:
2510         (WebKit::PageClientImpl::takeFocus):
2511         Plumb takeFocus to WebViewImpl.
2512
2513         * UIProcess/Cocoa/WebViewImpl.h:
2514         * UIProcess/Cocoa/WebViewImpl.mm:
2515         (WebKit::WebViewImpl::takeFocus):
2516         Borrow the relevant portion of WebKitLegacy's implementation of takeFocus,
2517         shifting focus to the next/previous key view in the window.
2518
2519 2019-01-15  Youenn Fablet  <youenn@apple.com>
2520
2521         Remove the specific handling of ephemeral sessions from CacheStorage::Engine::from
2522         https://bugs.webkit.org/show_bug.cgi?id=193400
2523
2524         Reviewed by Alex Christensen.
2525
2526         It is no longer needed as we correctly handle ephemeral sessions removal.
2527
2528         * NetworkProcess/cache/CacheStorageEngine.cpp:
2529         (WebKit::CacheStorage::Engine::from):
2530
2531 2019-01-15  Alex Christensen  <achristensen@webkit.org>
2532
2533         Fix iOS build after r239993
2534         https://bugs.webkit.org/show_bug.cgi?id=193361
2535
2536         * UIProcess/ProvisionalPageProxy.h:
2537         * UIProcess/SuspendedPageProxy.h:
2538
2539 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
2540
2541         [macOS] Adjust logging policy in WebKit's sandbox
2542         https://bugs.webkit.org/show_bug.cgi?id=193454
2543         <rdar://problem/47256325>
2544
2545         Reviewed by Brent Fulgham.
2546
2547         * WebProcess/com.apple.WebProcess.sb.in:
2548
2549 2019-01-15  Chris Dumez  <cdumez@apple.com>
2550
2551         Unreviewed iOS build fix after r239993.
2552
2553         * UIProcess/SuspendedPageProxy.h:
2554
2555 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
2556
2557         Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
2558         https://bugs.webkit.org/show_bug.cgi?id=193453
2559         <rdar://problem/47268166>
2560
2561         Reviewed by Brent Fulgham.
2562
2563         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
2564         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2565         * WebProcess/com.apple.WebProcess.sb.in:
2566
2567 2019-01-15  Chris Dumez  <cdumez@apple.com>
2568
2569         Regression(PSON) View becomes blank after click a cross-site download link
2570         https://bugs.webkit.org/show_bug.cgi?id=193361
2571         <rdar://problem/47099573>
2572
2573         Reviewed by Geoff Garen.
2574
2575         The issue tracked by rdar://problem/47099573 is that a provisional load may get
2576         canceled (or converted into a download) *after* we've decided to process-swap.
2577         In such cases, the view should keep displaying the current site and it should
2578         still be interactive. However, with the previous PSON model, the view (pageProxy)
2579         would have already swapped to the new process and would end up displaying the
2580         initially empty document.
2581
2582         To address the issue, this patch introduces the concept of a provisional load
2583         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
2584         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
2585         provisional page until after the load was committed in the new process. This means
2586         that the view / WebPageProxy keeps using the old process and displays the current
2587         content until a load has committed in the provisional page. If no load commits
2588         in the provisional process (e.g. because the load is cancelled or converted into
2589         a download), then we merely destroy the ProvisionalPageProxy and terminate its
2590         process, without impacting the WebPageProxy.
2591
2592         * Shared/WebPageCreationParameters.cpp:
2593         (WebKit::WebPageCreationParameters::encode const):
2594         (WebKit::WebPageCreationParameters::decode):
2595         * Shared/WebPageCreationParameters.h:
2596         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
2597         delay attaching the drawing area in case of a process-swap, no matter what
2598         now that the previous process is kept alive until the provisional load is
2599         committed in the new process.
2600
2601         * Shared/WebPolicyAction.h:
2602         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
2603         process-swap, we now tell the previous process to simply ignore the load, while
2604         we create a ProvisionalPageProxy to do the new load in a new process.
2605         Suspension of the previous page in the old process, happens later, when a load
2606         is actually committed in the new process.
2607
2608         * Sources.txt:
2609         Add new ProvisionalPageProxy file.
2610
2611         * UIProcess/API/Cocoa/WKWebView.mm:
2612         (-[WKWebView _killWebContentProcessAndResetState]):
2613         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
2614         process and the provisional one, to maintain previous behavior in our API tests.
2615
2616         * UIProcess/PageClient.h:
2617         Tiny build fix.
2618
2619         * UIProcess/ProvisionalPageProxy.cpp: Added.
2620         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
2621         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
2622         (WebKit::ProvisionalPageProxy::takeDrawingArea):
2623         (WebKit::ProvisionalPageProxy::cancel):
2624         (WebKit::ProvisionalPageProxy::initializeWebPage):
2625         (WebKit::ProvisionalPageProxy::loadDataWithNavigation):
2626         (WebKit::ProvisionalPageProxy::loadRequestWithNavigation):
2627         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
2628         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
2629         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
2630         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
2631         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
2632         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2633         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
2634         * UIProcess/ProvisionalPageProxy.h: Added.
2635         (WebKit::ProvisionalPageProxy::page):
2636         (WebKit::ProvisionalPageProxy::mainFrame const):
2637         (WebKit::ProvisionalPageProxy::process):
2638         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
2639         (WebKit::ProvisionalPageProxy::navigationID const):
2640         Add new ProvisionalPageProxy class to wrap the provisional load in the new process
2641         after a swap. The provisional page is owned by the WebPageProxy and we only commit
2642         the provisional page when the load is committed. Until then, the WebPageProxy keeps
2643         using the old process and displaying the current content.
2644
2645         * UIProcess/SuspendedPageProxy.cpp:
2646         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2647         (WebKit::SuspendedPageProxy::unsuspend):
2648         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
2649         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
2650         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
2651         which tries to register itself as an IPC message receiver for the same pageID when
2652         a process-swap occurs and we're switching to a suspended page.
2653
2654         * UIProcess/WebFrameProxy.cpp:
2655         (WebKit::WebFrameProxy::isMainFrame const):
2656         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
2657         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
2658         m_mainFrame to maintain previous behavior.
2659
2660         * UIProcess/WebPageProxy.cpp:
2661         (WebKit::WebPageProxy::swapToWebProcess):
2662         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
2663         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
2664         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
2665         the ProvisionalPageProxy which started the provisional load.
2666
2667         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2668         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2669         committed in the provisional process.
2670
2671         (WebKit::WebPageProxy::initializeWebPage):
2672         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
2673           committed in the provisional process.
2674         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
2675
2676         (WebKit::WebPageProxy::loadRequestWithNavigation):
2677         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
2678         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
2679
2680         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2681         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
2682         Suspension now happens later, only if we end up committing the provisional load in the new process.
2683         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
2684         to happen a bit later but it is clearer if we do this as early as possible I think.
2685
2686         (WebKit::WebPageProxy::commitProvisionalPage):
2687         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
2688         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
2689         - Suspending the current page.
2690         - Letting the client know the load is comitted
2691         - Destroy the ProvisionalPageProxy.
2692         This work used to happen earlier in continueNavigationInNewProcess().
2693
2694         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2695         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
2696         without actually having the WebPageProxy switch to the new process yet.
2697
2698         (WebKit::WebPageProxy::didCreateMainFrame):
2699         (WebKit::WebPageProxy::didCreateWindow):
2700         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
2701
2702         (WebKit::WebPageProxy::didDestroyNavigation):
2703         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
2704         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
2705         the call since the navigation is merely taken over by the ProvisionalPageProxy.
2706
2707         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
2708         Moved some PSON logic to the ProvisionalPageProxy instead.
2709
2710         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
2711         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
2712
2713         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2714         (WebKit::WebPageProxy::decidePolicyForResponse):
2715         Capture the process in the lambda, to make sure we send the policy decision to the same process that
2716         asked for it, so as to not get confused by process swaps.
2717
2718         (WebKit::WebPageProxy::resetState):
2719         Drop some code that is no longer needed.
2720
2721         (WebKit::WebPageProxy::creationParameters):
2722         Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
2723         more than one call site. This was just some bad factoring.
2724
2725         (WebKit::WebPageProxy::PageProcessOverride::PageProcessOverride):
2726         (WebKit::WebPageProxy::PageProcessOverride::~PageProcessOverride):
2727         * UIProcess/WebPageProxy.h:
2728         (WebKit::WebPageProxy::temporarilyOverrideProcess):
2729         Add utility class to temporarily override the WebPageProxy's m_process with the provisional one when
2730         the ProvisionalPageProxy interacts with the WebPageProxy.
2731
2732         * UIProcess/WebProcessProxy.cpp:
2733         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
2734         (WebKit::WebProcessProxy::updateBackForwardItem):
2735         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
2736         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
2737         associated with this process yet, because it is still a ProvisionalPageProxy.
2738
2739         (WebKit::WebProcessProxy::canTerminateChildProcess):
2740         Do not terminate the WebProcess if there are ProvisionalPageProxy objects using it.
2741
2742         * UIProcess/WebProcessProxy.h:
2743         (WebKit::WebProcessProxy::addProvisionalPageProxy):
2744         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
2745
2746         * WebKit.xcodeproj/project.pbxproj:
2747
2748         * WebProcess/WebPage/WebFrame.cpp:
2749         (WebKit::toPolicyAction):
2750         (WebKit::WebFrame::didReceivePolicyDecision):
2751         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
2752
2753         * WebProcess/WebPage/WebPage.cpp:
2754         (WebKit::WebPage::reinitializeWebPage):
2755         (WebKit::WebPage::didReceivePolicyDecision):
2756
2757         (WebKit::WebPage::setIsSuspended):
2758         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
2759         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
2760
2761         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2762         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2763
2764 2019-01-15  Brian Burg  <bburg@apple.com>
2765
2766         WebDriver: update Create Window implementation to support newest specification
2767         https://bugs.webkit.org/show_bug.cgi?id=193333
2768         <rdar://problem/45649489>
2769
2770         Reviewed by Carlos Garcia Campos.
2771
2772         Spec link: https://w3c.github.io/webdriver/#create-window
2773
2774         The command as specified returns a value indicating whether the new browsing context
2775         was presented as a new tab or new window. Add a new delegate method to query the current
2776         'presentation' of the browsing context. The presentation can change over time due to
2777         things such as screen orientation, so the value that is returned by the command only
2778         reflects how the browsing context was initially presented to the user.
2779
2780         This is covered by existing WPT and internal tests. More will be added when Selenium
2781         exposes this command in its various bindings.
2782
2783         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
2784         Add new SPI delegate method to query the 'presentation' (tab or window) for an automated WKWebView.
2785
2786         * UIProcess/API/APIAutomationSessionClient.h:
2787         (API::AutomationSessionClient::currentPresentationOfPage):
2788         * UIProcess/Cocoa/AutomationSessionClient.h:
2789         * UIProcess/Cocoa/AutomationSessionClient.mm:
2790         (WebKit::AutomationSessionClient::AutomationSessionClient):
2791         (WebKit::toImpl):
2792         (WebKit::AutomationSessionClient::currentPresentationOfPage):
2793         * UIProcess/Automation/WebAutomationSession.cpp:
2794         (WebKit::toProtocol):
2795         (WebKit::WebAutomationSession::createBrowsingContext):
2796         Add plumbing between ObjC delegate and C++.
2797
2798         * UIProcess/Automation/Automation.json:
2799         Include the initial presentation in the createBrowsingContext command result.
2800
2801 2019-01-14  Alex Christensen  <achristensen@webkit.org>
2802
2803         Split headerValueForVary into specialized functions for NetworkProcess and WebProcess/WebKitLegacy
2804         https://bugs.webkit.org/show_bug.cgi?id=193429
2805
2806         Reviewed by Joseph Pecoraro.
2807
2808         * NetworkProcess/cache/NetworkCache.cpp:
2809         (WebKit::NetworkCache::makeUseDecision):
2810         (WebKit::NetworkCache::Cache::retrieve):
2811         (WebKit::NetworkCache::Cache::makeEntry):
2812         (WebKit::NetworkCache::Cache::makeRedirectEntry):
2813         (WebKit::NetworkCache::Cache::update):
2814
2815 2019-01-14  Tim Horton  <timothy_horton@apple.com>
2816
2817         Fix a style mistake in PageClientImplMac
2818
2819         * UIProcess/mac/PageClientImplMac.h:
2820         Somehow these methods ended up above the members.
2821
2822 2019-01-14  Per Arne Vollan  <pvollan@apple.com>
2823
2824         [macOS] Remove reporting for mach lookups confirmed in-use
2825         https://bugs.webkit.org/show_bug.cgi?id=193415
2826         <rdar://problem/47266542>
2827
2828         Reviewed by Brent Fulgham.
2829
2830         Also, start denying the services which have not been confirmed to be in use.
2831
2832         * WebProcess/com.apple.WebProcess.sb.in:
2833
2834 2019-01-14  Commit Queue  <commit-queue@webkit.org>
2835
2836         Unreviewed, rolling out r239901, r239909, r239910, r239912,
2837         r239913, and r239914.
2838         https://bugs.webkit.org/show_bug.cgi?id=193407
2839
2840         These revisions caused an internal failure (Requested by
2841         Truitt on #webkit).
2842
2843         Reverted changesets:
2844
2845         "[Cocoa] Avoid importing directly from subumbrella frameworks"
2846         https://bugs.webkit.org/show_bug.cgi?id=186016
2847         https://trac.webkit.org/changeset/239901
2848
2849         "Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901."
2850         https://trac.webkit.org/changeset/239909
2851
2852         "Tried to fix the build."
2853         https://trac.webkit.org/changeset/239910
2854
2855         "Fixed iOS builds after r239910."
2856         https://trac.webkit.org/changeset/239912
2857
2858         "More build fixing."
2859         https://trac.webkit.org/changeset/239913
2860
2861         "Tried to fix USE(APPLE_INTERNAL_SDK) 32-bit builds."
2862         https://trac.webkit.org/changeset/239914
2863
2864 2019-01-14  Mark Lam  <mark.lam@apple.com>
2865
2866         Re-enable ability to build --cloop builds.
2867         https://bugs.webkit.org/show_bug.cgi?id=192955
2868         <rdar://problem/46882363>
2869
2870         Reviewed by Saam barati and Keith Miller.
2871
2872         * Configurations/FeatureDefines.xcconfig:
2873
2874 2019-01-14  Alex Christensen  <achristensen@webkit.org>
2875
2876         Remove unused networking entitlement from iOS WebProcess entitlements
2877         https://bugs.webkit.org/show_bug.cgi?id=193267
2878
2879         Reviewed by Dean Jackson.
2880
2881         * Configurations/WebContent-iOS.entitlements:
2882         This gave access to VPN stuff.  It's not needed any more.
2883
2884 2019-01-14  Youenn Fablet  <youenn@apple.com>
2885
2886         Enable MDNS ICE candidate support by default
2887         https://bugs.webkit.org/show_bug.cgi?id=193358
2888
2889         Reviewed by Geoffrey Garen.
2890
2891         * Shared/WebPreferences.yaml:
2892
2893 2019-01-11  Matt Rajca  <mrajca@apple.com>
2894
2895         Expose preference for site-specific quirks on iOS
2896         https://bugs.webkit.org/show_bug.cgi?id=193353
2897
2898         Reviewed by Dean Jackson.
2899
2900         * UIProcess/API/Cocoa/WKPreferences.mm:
2901         (-[WKPreferences _setNeedsSiteSpecificQuirks:]):
2902         (-[WKPreferences _needsSiteSpecificQuirks]):
2903         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2904
2905 2019-01-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2906
2907         [iOS] Expose SPI to access the current sentence boundary and selection state
2908         https://bugs.webkit.org/show_bug.cgi?id=193398
2909         <rdar://problem/45893108>
2910
2911         Reviewed by Dean Jackson.
2912
2913         Expose SPI on WKWebView for internal clients to grab information about attributes at the current selection; so
2914         far, this only includes whether the selection is a caret or a range, and whether or not the start of the
2915         selection is at the start of a new sentence.
2916
2917         Test: EditorStateTests.ObserveSelectionAttributeChanges
2918
2919         * Shared/EditorState.cpp:
2920         (WebKit::EditorState::PostLayoutData::encode const):
2921         (WebKit::EditorState::PostLayoutData::decode):
2922         * Shared/EditorState.h:
2923
2924         Add a new bit in EditorState on iOS to compute whether or not the start of the selection is at the start of a
2925         new sentence. This is computed and set when sending post-layout data in `WebPageIOS.mm`.
2926
2927         * UIProcess/API/Cocoa/WKWebView.mm:
2928         (selectionAttributes):
2929         (-[WKWebView _didChangeEditorState]):
2930         (-[WKWebView _selectionAttributes]):
2931
2932         Make the new SPI property support KVO by invoking `-willChangeValueForKey:` and `-didChangeValueForKey:`
2933         whenever the selection attributes change.
2934
2935         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2936         * WebProcess/WebPage/ios/WebPageIOS.mm:
2937         (WebKit::WebPage::platformEditorState const):
2938
2939 2019-01-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2940
2941         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.3 release
2942
2943         * gtk/NEWS: Add release notes for 2.23.3.
2944
2945 2019-01-13  Dan Bernstein  <mitz@apple.com>
2946
2947         Fixed iOS builds after r239910.
2948
2949         * Platform/spi/ios/PDFKitSPI.h:
2950
2951 2019-01-13  Dan Bernstein  <mitz@apple.com>
2952
2953         Tried to fix the build.
2954
2955         * Platform/spi/ios/PDFKitSPI.h:
2956
2957 2019-01-13  Dan Bernstein  <mitz@apple.com>
2958
2959         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901.
2960
2961         Patch by Keith Rollin.
2962
2963         * Platform/IPC/mac/ConnectionMac.mm:
2964         * Shared/mac/ChildProcessMac.mm:
2965         (WebKit::ChildProcess::launchServicesCheckIn):
2966
2967 2019-01-12  Timothy Hatcher  <timothy@apple.com>
2968
2969         Have prefers-color-scheme: light always match on macOS versions before Mojave.
2970         https://bugs.webkit.org/show_bug.cgi?id=191655
2971         rdar://problem/46074680
2972
2973         Reviewed by Megan Gardner.
2974
2975         * Configurations/FeatureDefines.xcconfig: ENABLE_DARK_MODE_CSS_macosx for all OS versions.
2976         * UIProcess/Cocoa/WebViewImpl.mm:
2977         (WebKit::WebViewImpl::effectiveAppearanceIsDark):
2978         * UIProcess/RemoteLayerTree/mac/ScrollerMac.mm:
2979
2980 2019-01-12  Dan Bernstein  <mitz@apple.com>
2981
2982         [Cocoa] Avoid importing directly from subumbrella frameworks
2983         https://bugs.webkit.org/show_bug.cgi?id=186016
2984         <rdar://problem/40591038>
2985
2986         Reviewed by Sam Weinig.
2987
2988         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
2989           OTHER_CPLUSPLUSFLAGS.
2990         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
2991           HIToolbox header.
2992         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
2993         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
2994         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
2995           header.
2996         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
2997           PDFKit header.
2998         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
2999         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
3000         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
3001         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
3002         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
3003         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
3004         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
3005
3006 2019-01-11  Ryosuke Niwa  <rniwa@webkit.org>
3007
3008         Enable visual viewport API by default
3009         https://bugs.webkit.org/show_bug.cgi?id=193376
3010
3011         Reviewed by Simon Fraser.
3012
3013         Enable this feature by default since the remaining issue on iOS is mostly about test failures,
3014         not an issue with the core functionality of the API.
3015
3016         * Shared/WebPreferences.yaml:
3017
3018 2019-01-11  Brent Fulgham  <bfulgham@apple.com>
3019
3020         Allow WebContent process access to some drawing-related IOKit properties
3021         https://bugs.webkit.org/show_bug.cgi?id=193086
3022         <rdar://problem/46568088>
3023
3024         Reviewed by Eric Carlson.
3025
3026         Add one missing IOKit property, and revise the regexp used for another.
3027
3028         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3029
3030 2019-01-11  John Wilander  <wilander@apple.com>
3031
3032         Compile out Web API Statistics Collection
3033         https://bugs.webkit.org/show_bug.cgi?id=193370
3034         <rdar://problem/45388584>
3035
3036         Reviewed by Brent Fulgham.
3037
3038         * Configurations/FeatureDefines.xcconfig:
3039             Defined ENABLE_WEB_API_STATISTICS, off by default.
3040         * Shared/WebCoreArgumentCoders.cpp:
3041         (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
3042             Skipped encoding of web API statistics.
3043         (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
3044             Skipped decoding of web API statistics.
3045
3046 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
3047
3048         IndexedDB: leak WebIDBConnectionToClient for retain cycle
3049         https://bugs.webkit.org/show_bug.cgi?id=193097
3050         <rdar://problem/46899601>
3051
3052         Reviewed by Brady Eidson.
3053
3054         Let WebIDBConnectionToClient hold reference to IPC::Connection instead of NetworkConnectionToWebProcess to break
3055         the cycle.
3056
3057         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3058         (WebKit::WebIDBConnectionToClient::create):
3059         (WebKit::WebIDBConnectionToClient::WebIDBConnectionToClient):
3060         (WebKit::WebIDBConnectionToClient::messageSenderConnection):
3061         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.h:
3062         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3063         (WebKit::NetworkConnectionToWebProcess::establishIDBConnectionToServer):
3064
3065 2019-01-11  Sihui Liu  <sihui_liu@apple.com>
3066
3067         Make "Disable Web SQL" on by default
3068         https://bugs.webkit.org/show_bug.cgi?id=193354
3069         <rdar://problem/46524584>
3070
3071         Reviewed by Geoffrey Garen.
3072
3073         * Shared/WebPreferences.yaml:
3074
3075 2019-01-11  Devin Rousso  <drousso@apple.com>
3076
3077         Fix style CFNetworkSPI style checker warnings from r239698
3078         https://bugs.webkit.org/show_bug.cgi?id=193369
3079
3080         Reviewed by Joseph Pecoraro.
3081
3082         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3083         (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
3084
3085 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3086
3087         [iOS] Precision drop state thrashes when dragging near the top edge of an editable element
3088         https://bugs.webkit.org/show_bug.cgi?id=193364
3089         <rdar://problem/47214117>
3090
3091         Reviewed by Tim Horton.
3092
3093         On iOS, marking a UIDropProposal as precise offsets the hit-testing location of the drop by a small distance
3094         either upwards or downwards from the actual location of the user's finger. When dragging over an editable
3095         element, WebKit currently marks the drop proposal as precise; however, when dragging over the top edge of an
3096         editable element, what happens is that the hit-testing location is offset to a location outside of the editable
3097         element, which causes us to turn off precision drop mode; subsequently, turning off precision drop mode removes
3098         the offset, which causes us to hit-test within the editable element once again and re-enable precision mode, and
3099         the cycle continues.
3100
3101         In order to mitigate this, bail out of precision drop mode when dragging near the top or bottom edges of the
3102         highest editable root that contains the current drop caret position (or, if the drop caret is inside of a text
3103         form control, use the form control as the editable element instead).
3104
3105         * UIProcess/WebPageProxy.cpp:
3106         (WebKit::WebPageProxy::didPerformDragControllerAction):
3107         * UIProcess/WebPageProxy.h:
3108         (WebKit::WebPageProxy::currentDragCaretEditableElementRect const):
3109         * UIProcess/WebPageProxy.messages.in:
3110         * UIProcess/ios/WKContentViewInteraction.mm:
3111         (-[WKContentView dropInteraction:sessionDidUpdate:]):
3112
3113         Avoid precise mode when we're less than 25pt away from the top and bottom edge of the editable element rect.
3114         Since the drag location offset amount is a fixed offset in window coordinates, we first convert this minimum
3115         distance to the content view's coordinate space by dividing by the content scale factor.
3116
3117         * WebProcess/WebPage/WebPage.cpp:
3118         (WebKit::WebPage::performDragControllerAction):
3119
3120 2019-01-11  Tim Horton  <timothy_horton@apple.com>
3121
3122         REGRESSION (PSON): Firefox app lacks Open in New Tab in menu
3123         https://bugs.webkit.org/show_bug.cgi?id=193366
3124         <rdar://problem/46097212>
3125
3126         Reviewed by Simon Fraser.
3127
3128         A pair of unrelated changes broke Firefox's use of WKWebView internals
3129         to override the long-press menu. Maintain binary compatibility by
3130         introducing linked-on-or-after checks.
3131
3132         * UIProcess/Cocoa/VersionChecks.h:
3133         * UIProcess/WebProcessPool.cpp:
3134         (WebKit::WebProcessPool::createWebPage):
3135         Disable PSON in Firefox when linked against an SDK where PSON wasn't enabled by default.
3136         Because gestures are very stateful, we always swap them out when swapping
3137         processes (changing that behavior is fairly risky). Also, we don't always
3138         inform the client when we swap processes (only when the process actually crashes),
3139         so they currently don't re-adjust the gesture recognizers when a PSON swap occurs.
3140
3141         * UIProcess/ios/WKContentView.mm:
3142         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
3143         Synchronously install gesture recognizers under -init when linked against
3144         an SDK before the version that introduces lazy gesture recognizer installation.
3145         r237331 is an optimization that made us lazily install gestures when the
3146         view is parented, but Firefox (and potentially other clients) depend
3147         on them being installed synchronously in order to find and override them.
3148
3149 2019-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3150
3151         Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API
3152         https://bugs.webkit.org/show_bug.cgi?id=193109
3153         <rdar://problem/44807048>
3154
3155         Reviewed by Ryosuke Niwa.
3156
3157         Add a new SPI configuration flag to enable the UndoManager API. This is off by default.
3158
3159         * Shared/WebPreferences.yaml:
3160         * UIProcess/API/Cocoa/WKWebView.mm:
3161         (-[WKWebView _initializeWithConfiguration:]):
3162         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
3163         (-[WKWebViewConfiguration init]):
3164         (-[WKWebViewConfiguration copyWithZone:]):
3165         (-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
3166         (-[WKWebViewConfiguration _undoManagerAPIEnabled]):
3167         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3168
3169 2019-01-10  Jiewen Tan  <jiewen_tan@apple.com>
3170
3171         [WebAuthN] Change the nonce in the CTAP kInit command to weak random values
3172         https://bugs.webkit.org/show_bug.cgi?id=192061
3173         <rdar://problem/46471091>
3174
3175         Reviewed by Chris Dumez.
3176
3177         Change the nonce in the CTAP kInit command to weak random values as the nonce is mainly
3178         for being a probabilistically unique global identifier for hand shakes, instead of
3179         preventing replay attacks. Otherwise, it might exhaust system entropy unnecessarily.
3180
3181         The patch also removes all logging when debugging the test case flakiness.
3182
3183         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3184         (WebKit::AuthenticatorManager::respondReceived):
3185         (WebKit::AuthenticatorManager::initTimeOutTimer):
3186         (WebKit::AuthenticatorManager::timeOutTimerFired):
3187         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
3188         (WebKit::HidService::deviceAdded):
3189         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
3190         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3191         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
3192         (WebKit::MockHidConnection::send):
3193         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
3194         (WebKit::CtapHidAuthenticator::makeCredential):
3195         (WebKit::CtapHidAuthenticator::getAssertion):
3196         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
3197         (WebKit::CtapHidDriver::Worker::write):
3198         (WebKit::CtapHidDriver::Worker::read):
3199         (WebKit::CtapHidDriver::Worker::returnMessage):
3200         (WebKit::CtapHidDriver::transact):
3201         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3202         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3203
3204 2019-01-10  Timothy Hatcher  <timothy@apple.com>
3205
3206         Add WKBundlePage SPI to temporarily force light or dark appearance on a page.
3207         https://bugs.webkit.org/show_bug.cgi?id=193327
3208         rdar://problem/47093222
3209
3210         Reviewed by Tim Horton.
3211
3212         Tests: WebKit.ForceLightAppearanceInBundle API Test
3213
3214         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3215         (WKBundlePageSetUseDarkAppearance): Added.
3216         (WKBundlePageIsUsingDarkAppearance): Added.
3217         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
3218
3219 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
3220
3221         DeviceID hash salt manager can be NULL
3222         https://bugs.webkit.org/show_bug.cgi?id=193334
3223         <rdar://problem/47179650>
3224
3225         Reviewed by Youenn Fablet.
3226
3227         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
3228         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): No need to
3229         NULL-check websiteDataStore.deviceIdHashSaltStorage, it is a Ref.
3230         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): Ditto.
3231         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo): Ditto.
3232         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): Ditto.
3233
3234         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3235         (WebKit::WebsiteDataStore::WebsiteDataStore): m_deviceIdHashSaltStorage is a Ref.
3236         (WebKit::WebsiteDataStore::fetchDataAndApply): Ditto.
3237         (WebKit::WebsiteDataStore::removeData): Ditto.
3238         * UIProcess/WebsiteData/WebsiteDataStore.h:
3239         (WebKit::WebsiteDataStore::deviceIdHashSaltStorage): Ditto.
3240
3241 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
3242
3243         [macOS] Add name of IORegistry key in sandbox.
3244         https://bugs.webkit.org/show_bug.cgi?id=193335
3245         <rdar://problem/47184951>
3246
3247         Reviewed by Alexey Proskuryakov.
3248
3249         The property IOGVAHEVCDecodeCapabilities was added in https://bugs.webkit.org/show_bug.cgi?id=193324.
3250         Also, the property IOGVAHEVCEncodeCapabilities needs to be added.
3251
3252         * WebProcess/com.apple.WebProcess.sb.in:
3253
3254 2019-01-10  Zalan Bujtas  <zalan@apple.com>
3255
3256         REGRESSION (r237658): Tap highlight limits cause the highlight to no longer show with legitimate button sizes
3257         https://bugs.webkit.org/show_bug.cgi?id=193294
3258         <rdar://problem/46006678>
3259
3260         Reviewed by Simon Fraser.
3261
3262         Input type elements should always paint tap highlight (ignore size heuristic). 
3263
3264         * UIProcess/PageClient.h:
3265         * UIProcess/WebPageProxy.h:
3266         * UIProcess/WebPageProxy.messages.in:
3267         * UIProcess/ios/PageClientImplIOS.h:
3268         * UIProcess/ios/PageClientImplIOS.mm:
3269         (WebKit::PageClientImpl::didGetTapHighlightGeometries):
3270         * UIProcess/ios/WKContentViewInteraction.h:
3271         * UIProcess/ios/WKContentViewInteraction.mm:
3272         (-[WKContentView _showTapHighlight]):
3273         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:nodeHasBuiltInClickHandling:]):
3274         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]): Deleted.
3275         * UIProcess/ios/WebPageProxyIOS.mm:
3276         (WebKit::WebPageProxy::didGetTapHighlightGeometries):
3277         * WebProcess/WebPage/ios/WebPageIOS.mm:
3278         (WebKit::WebPage::sendTapHighlightForNodeIfNecessary):
3279
3280 2019-01-10  Alexey Proskuryakov  <ap@apple.com>
3281
3282         Remove unneeded XPCService variant for plugin service
3283         https://bugs.webkit.org/show_bug.cgi?id=193326
3284
3285         Reviewed by Tim Horton.
3286
3287         * Configurations/PluginService.32.xcconfig: Removed.
3288         * Configurations/PluginService.64.xcconfig:
3289         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist: Removed.
3290         * PluginProcess/EntryPoint/mac/XPCService/PluginService.64.Info.plist: Copied from Source/WebKit/PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist.
3291         * WebKit.xcodeproj/project.pbxproj:
3292
3293 2019-01-10  Eric Carlson  <eric.carlson@apple.com>
3294
3295         Define page media state flags for display capture.
3296         https://bugs.webkit.org/show_bug.cgi?id=193230
3297         <rdar://problem/47095142>
3298
3299         Reviewed by Youenn Fablet.
3300
3301         * UIProcess/API/C/WKPage.cpp:
3302         (WKPageGetMediaState):
3303         * UIProcess/API/C/WKPagePrivate.h:
3304         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3305         (WebKit::UserMediaCaptureManager::Source::Source):
3306         (WebKit::UserMediaCaptureManager::createCaptureSource):
3307
3308 2019-01-10  Alex Christensen  <achristensen@webkit.org>
3309
3310         REGRESSION(r239815) http/tests/workers/service/serviceworker-private-browsing.https.html test times out
3311         https://bugs.webkit.org/show_bug.cgi?id=193325
3312
3313         Reviewed by Joseph Pecoraro.
3314
3315         InjectedBundle::setPrivateBrowsingEnabled effectively didn't do anything when enabled was false.
3316         I made it destroy the legacy private browsing session in the NetworkProcess, which caused a test to time out.
3317         This functionality is only used for testing, so it's no big deal to revert that part of the patch.
3318
3319         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3320         (WebKit::NetworkConnectionToWebProcess::destroyLegacyPrivateBrowsingSession): Deleted.
3321         * NetworkProcess/NetworkConnectionToWebProcess.h:
3322         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3323         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3324         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
3325         * WebProcess/WebProcess.cpp:
3326         (WebKit::WebProcess::destroyLegacyPrivateBrowsingSessionInNetworkProcess): Deleted.
3327         * WebProcess/WebProcess.h:
3328
3329 2019-01-10  Per Arne Vollan  <pvollan@apple.com>
3330
3331         [macOS] Add name of IORegistry key in sandbox.
3332         https://bugs.webkit.org/show_bug.cgi?id=193324
3333
3334         Reviewed by Brent Fulgham.
3335
3336         IOGVAVTCapabilities key has been changed to IOGVAHEVCDecodeCapabilities.
3337
3338         * WebProcess/com.apple.WebProcess.sb.in:
3339
3340 2019-01-10  John Wilander  <wilander@apple.com>
3341
3342         Override the session configuration for cookieAcceptPolicy
3343         https://bugs.webkit.org/show_bug.cgi?id=190925
3344         <rdar://problem/45497382>
3345
3346         Reviewed by Alexey Proskuryakov and Alex Christensen.
3347
3348         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3349         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3350             Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES.
3351
3352 2019-01-09  Matt Rajca  <mrajca@apple.com>
3353
3354         Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
3355         https://bugs.webkit.org/show_bug.cgi?id=193301
3356
3357         Reviewed by Jer Noble.
3358
3359         Register a new quirk that can be configured per-load for per-document media
3360         autoplay behaviors.
3361
3362         * Shared/WebsiteAutoplayQuirk.h:
3363         * Shared/WebsitePoliciesData.cpp:
3364         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3365         * UIProcess/API/C/WKWebsitePolicies.cpp:
3366         (WKWebsitePoliciesSetAllowedAutoplayQuirks):
3367         (WKWebsitePoliciesGetAllowedAutoplayQuirks):
3368         * UIProcess/API/C/WKWebsitePolicies.h:
3369         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3370         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
3371         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
3372         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
3373
3374 2019-01-10  Tim Horton  <timothy_horton@apple.com>
3375
3376         Rename some entitlements files to be more clear about their target platform
3377         https://bugs.webkit.org/show_bug.cgi?id=193311
3378
3379         Reviewed by Alexey Proskuryakov.
3380
3381         * Configurations/Network-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/Network-iOS-minimalsimulator.entitlements.
3382         * Configurations/NetworkService.xcconfig:
3383         * Configurations/WebContent-iOSMac.entitlements: Renamed from Source/WebKit/Configurations/WebContent-iOS-minimalsimulator.entitlements.
3384         * Configurations/WebContentService.xcconfig:
3385         * WebKit.xcodeproj/project.pbxproj:
3386
3387 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
3388
3389         Unreviewed build fix after r239816.
3390
3391         Although EWS had no problem with the patch, I'm seeing build errors on the actual bots.
3392         This patch corrects the problem.
3393
3394         * NetworkProcess/NetworkProcess.cpp:
3395         (WebKit::NetworkProcess::logFrameNavigation):
3396         (WebKit::NetworkProcess::logUserInteraction):
3397
3398 2019-01-09  Brent Fulgham  <bfulgham@apple.com>
3399
3400         Create a WebResourceLoadStatisticsStore attached to the NetworkSession
3401         https://bugs.webkit.org/show_bug.cgi?id=193261
3402         <rdar://problem/47158616>
3403
3404         Reviewed by Alex Christensen.
3405
3406         This patch modifies NetworkSession so that it owns a WebResourceLoadStatisticsStore
3407         object. This object is only created if the ResourceLoadStatistics feature is turned on.
3408
3409         The patch also modifies WebResourceLoadStatisticsStore so that it can be constructed
3410         with an owning NetworkSession as an alternative to the current practice of using a
3411         WebsiteDataStore object.
3412
3413         Two initial messages f