Use SecurityOriginData more consistently in Service Worker code
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-03-24  Chris Dumez  <cdumez@apple.com>
2
3         Use SecurityOriginData more consistently in Service Worker code
4         https://bugs.webkit.org/show_bug.cgi?id=183969
5
6         Reviewed by Darin Adler.
7
8         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
9         SecurityOrigin objects unnecessarily.
10
11         * NetworkProcess/NetworkResourceLoadParameters.cpp:
12         (WebKit::NetworkResourceLoadParameters::encode const):
13         * Shared/API/c/WKSecurityOriginRef.cpp:
14         (WKSecurityOriginCopyDatabaseIdentifier):
15         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
16         (WebKit::WebSWOriginStore::addToStore):
17         (WebKit::WebSWOriginStore::removeFromStore):
18         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
19         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
20         (WebKit::WebSWServerConnection::scheduleJobInServer):
21         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
22         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
23         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
24         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
25         * StorageProcess/StorageProcess.cpp:
26         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
27         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
28         (WebKit::StorageProcess::createStorageToWebProcessConnection):
29         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
30         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
31         (WebKit::StorageProcess::createServerToContextConnection):
32         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
33         * StorageProcess/StorageProcess.h:
34         * UIProcess/API/APIFrameInfo.cpp:
35         (API::FrameInfo::create):
36         * UIProcess/API/C/WKApplicationCacheManager.cpp:
37         (WKApplicationCacheManagerDeleteEntriesForOrigin):
38         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
39         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
40         * UIProcess/API/C/WKResourceCacheManager.cpp:
41         (WKResourceCacheManagerClearCacheForOrigin):
42         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
43         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
44         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
45         * UIProcess/ServiceWorkerProcessProxy.cpp:
46         (WebKit::ServiceWorkerProcessProxy::create):
47         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
48         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
49         * UIProcess/ServiceWorkerProcessProxy.h:
50         * UIProcess/Storage/StorageProcessProxy.cpp:
51         (WebKit::StorageProcessProxy::getStorageProcessConnection):
52         * UIProcess/WebProcessPool.cpp:
53         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
54         (WebKit::WebProcessPool::disconnectProcess):
55         (WebKit::WebProcessPool::updateProcessAssertions):
56         * UIProcess/WebProcessPool.h:
57         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
58         (WebKit::WebsiteDataStore::fetchDataAndApply):
59         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
60         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
61         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
62         (WKBundlePageCopyOriginsWithApplicationCache):
63         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
64         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
65         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
66         * WebProcess/Storage/WebSWClientConnection.cpp:
67         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
68         (WebKit::WebSWClientConnection::matchRegistration):
69         (WebKit::WebSWClientConnection::whenRegistrationReady):
70         (WebKit::WebSWClientConnection::getRegistrations):
71         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
72         (WebKit::WebChromeClient::exceededDatabaseQuota):
73         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
74         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
75         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
76         * WebProcess/WebProcess.cpp:
77         (WebKit::WebProcess::fetchWebsiteData):
78         * WebProcess/WebStorage/StorageAreaImpl.cpp:
79         (WebKit::StorageAreaImpl::securityOrigin const):
80         * WebProcess/WebStorage/StorageAreaImpl.h:
81         * WebProcess/WebStorage/StorageAreaMap.cpp:
82         (WebKit::StorageAreaMap::StorageAreaMap):
83         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
84         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
85         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
86         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
87
88 2018-03-24  Tim Horton  <timothy_horton@apple.com>
89
90         Fix the !ENABLE(MEDIA_STREAM) build
91         https://bugs.webkit.org/show_bug.cgi?id=183977
92
93         Reviewed by Wenson Hsieh.
94
95         * UIProcess/Cocoa/UIDelegate.mm:
96         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
97         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
98         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
99         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
100
101 2018-03-24  Tim Horton  <timothy_horton@apple.com>
102
103         WKFileUploadPanel shouldn't depend on WebKitLegacy
104         https://bugs.webkit.org/show_bug.cgi?id=183981
105
106         Reviewed by Wenson Hsieh.
107
108         * UIProcess/ios/forms/WKFileUploadPanel.mm:
109         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]):
110         Just use the underlying WebCore function instead of the
111         unnecessary NSFileManager category method.
112
113 2018-03-23  Tim Horton  <timothy_horton@apple.com>
114
115         Fix the build with no pasteboard
116         https://bugs.webkit.org/show_bug.cgi?id=183973
117
118         Reviewed by Dan Bernstein.
119
120         * Configurations/FeatureDefines.xcconfig:
121
122 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
123
124         Enable unified text selection in select cases for gradual testing
125         https://bugs.webkit.org/show_bug.cgi?id=183967
126         <rdar://problem/38815328>
127
128         Reviewed by Tim Horton.
129         
130         Enable in select places for a more gradual switch, as this is a big change and we want to make sure
131         it works before switching completely.
132
133         * UIProcess/ios/WKContentViewInteraction.mm:
134         (-[WKContentView useSelectionAssistantWithGranularity:]):
135
136 2018-03-23  John Wilander  <wilander@apple.com>
137
138         Resource Load Statistics: Pick up ITP debug mode flag from defaults
139         https://bugs.webkit.org/show_bug.cgi?id=183956
140         <rdar://problem/38559574>
141
142         Reviewed by Brent Fulgham.
143
144         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
145         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
146
147 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
148
149         [Extra zoom mode] Adopt list view controller UI for select menus
150         https://bugs.webkit.org/show_bug.cgi?id=183944
151         <rdar://problem/38799062>
152
153         Reviewed by Tim Horton.
154
155         Move UIProcess/WKSelectMenuListViewController.* to UIProcess/ios/forms, where it was intended to go.
156
157         * UIProcess/ios/forms/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.h.
158         * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.mm.
159         * WebKit.xcodeproj/project.pbxproj:
160
161 2018-03-23  Chris Dumez  <cdumez@apple.com>
162
163         Promptly terminate service worker processes when they are no longer needed
164         https://bugs.webkit.org/show_bug.cgi?id=183873
165         <rdar://problem/38676995>
166
167         Reviewed by Youenn Fablet.
168
169         The StorageProcess now keeps track of service worker clients for each security
170         origin. When there is no longer any clients for a given security origin, the
171         StorageProcess asks the service worker process for the given origin to terminate
172         and severs its connection to it.
173
174         * Shared/Storage/StorageProcessCreationParameters.h:
175         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
176         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
177         (WebKit::WebSWServerToContextConnection::terminate):
178         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
179         * StorageProcess/StorageProcess.cpp:
180         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
181         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
182         (WebKit::StorageProcess::initializeWebsiteDataStore):
183         (WebKit::StorageProcess::swServerForSession):
184         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
185         (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay):
186         * StorageProcess/StorageProcess.h:
187         * StorageProcess/StorageProcess.messages.in:
188         * UIProcess/API/Cocoa/WKProcessPool.mm:
189         (-[WKProcessPool _disableServiceWorkerProcessTerminationDelay]):
190         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
191         * UIProcess/WebProcessPool.cpp:
192         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
193         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay):
194         * UIProcess/WebProcessPool.h:
195         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
196         (WebKit::WebSWContextManagerConnection::terminateProcess):
197         * WebProcess/Storage/WebSWContextManagerConnection.h:
198         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
199
200 2018-03-23  Brady Eidson  <beidson@apple.com>
201
202         Go to back/forward list items after a process-swapped navigation.
203         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
204
205         Reviewed by Andy Estes.
206
207         This takes the initial work of "process swap a normal navigation" and extends it to
208         process swapping for back/forward item navigations.
209
210         * Scripts/webkit/messages.py:
211
212         Make sure state objects are serialized to the UI Process back/forward list items, as otherwise
213         they will be lost in process-swap scenarios:
214         * Shared/SessionState.cpp:
215         (WebKit::PageState::encode const):
216         (WebKit::PageState::decode):
217         * Shared/SessionState.h:
218
219         Make a new variant of APINavigation specifically for back/forward list items.
220         * UIProcess/API/APINavigation.cpp:
221         (API::Navigation::Navigation):
222         (API::Navigation::loggingURL const):
223         * UIProcess/API/APINavigation.h:
224         (API::Navigation::create):
225         (API::Navigation::backForwardListItem):
226         (API::Navigation::backForwardFrameLoadType const):
227
228         * UIProcess/API/C/WKPage.cpp:
229         (WKPageGoToBackForwardListItem):
230
231         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
232         (-[WKBrowsingContextController goToBackForwardListItem:]):
233
234         * UIProcess/API/Cocoa/WKWebView.mm:
235         (-[WKWebView goToBackForwardListItem:]):
236
237         * UIProcess/WebNavigationState.cpp:
238         (WebKit::WebNavigationState::createLoadRequestNavigation):
239         (WebKit::WebNavigationState::createBackForwardNavigation):
240         * UIProcess/WebNavigationState.h:
241
242         * UIProcess/WebPageProxy.cpp:
243         (WebKit::WebPageProxy::reattachToWebProcessForReload):
244         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
245         (WebKit::WebPageProxy::goForward):
246         (WebKit::WebPageProxy::goBack):
247         (WebKit::WebPageProxy::goToBackForwardItem):
248         (WebKit::WebPageProxy::receivedPolicyDecision):
249         (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others.
250         (WebKit::WebPageProxy::restoreFromSessionState):
251         * UIProcess/WebPageProxy.h:
252
253         * UIProcess/WebProcessProxy.cpp:
254         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity
255         (WebKit::WebProcessProxy::addBackForwardItem): Deleted.
256         * UIProcess/WebProcessProxy.h:
257         * UIProcess/WebProcessProxy.messages.in:
258
259         * UIProcess/ios/ViewGestureControllerIOS.mm:
260         (WebKit::ViewGestureController::endSwipeGesture):
261
262         * UIProcess/mac/ViewGestureControllerMac.mm:
263         (WebKit::ViewGestureController::endSwipeGesture):
264
265         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
266         (WebKit::toPageState):
267         (WebKit::toHistoryItem):
268
269         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
270         (WebKit::updateBackForwardItem):
271
272         * WebProcess/WebPage/WebPage.cpp:
273         (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method,
274           passing the appropriate FrameLoadType around as needed to remember the specific type.
275         (WebKit::WebPage::goForward): Deleted.
276         (WebKit::WebPage::goBack): Deleted.
277         * WebProcess/WebPage/WebPage.h:
278         * WebProcess/WebPage/WebPage.messages.in:
279
280 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
281
282         Don't use the presence of a textSelectionAssistant as a proxy for if we are in content editable.
283         https://bugs.webkit.org/show_bug.cgi?id=183804
284
285         Reviewed by Tim Horton.
286
287         We need to stop using the presence of a textSelectionAssistant as a proxy for if we are selecting in a content editable
288         or not. As we are planning on switching to only using a textSelectionAssistant for selection, these checks need to 
289         be more direct in checking what we actually need to know i.e. are we selecting in a content editable.
290
291         * Platform/spi/ios/UIKitSPI.h:
292         * UIProcess/ios/WKContentViewInteraction.mm:
293         (hasAssistedNode):
294         (-[WKContentView inputView]):
295         (-[WKContentView _selectionClipRect]):
296         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
297         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
298         (-[WKContentView gestureRecognizerShouldBegin:]):
299         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
300         (-[WKContentView webSelectionRects]):
301         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
302         (-[WKContentView _autofillContext]):
303
304 2018-03-23  Youenn Fablet  <youenn@apple.com>
305
306         WebProcessPool should not ask to register all clients for each service worker process creation
307         https://bugs.webkit.org/show_bug.cgi?id=183941
308
309         Reviewed by Chris Dumez.
310
311         Call registerServiceWorkerClients when there is no service worker process.
312         Update service worker clients to register all of them no matter the session ID.
313
314         * UIProcess/WebProcessPool.cpp:
315         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
316         * WebProcess/WebProcess.cpp:
317         (WebKit::WebProcess::registerServiceWorkerClients):
318         * WebProcess/WebProcess.h:
319         * WebProcess/WebProcess.messages.in:
320
321 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
322
323         [Extra zoom mode] Adopt list view controller UI for select menus
324         https://bugs.webkit.org/show_bug.cgi?id=183944
325         <rdar://problem/38799062>
326
327         Reviewed by Andy Estes.
328
329         Rename WKSelectMenuViewController to WKSelectMenuListViewController, and also rename the relevant
330         WebKitAdditions harness files. See corresponding changes for more details.
331
332         * UIProcess/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.h.
333         * UIProcess/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.mm.
334         * UIProcess/ios/WKContentViewInteraction.h:
335         * UIProcess/ios/WKContentViewInteraction.mm:
336         (-[WKContentView presentSelectMenuViewController:]):
337         (-[WKContentView dismissSelectMenuViewController:]):
338         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
339         (-[WKContentView numberOfItemsInSelectMenu:]):
340         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
341         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
342         (-[WKContentView selectMenuUsesMultipleSelection:]):
343         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
344         (-[WKContentView _wheelChangedWithEvent:]):
345
346         Overriding wheel events and re-dispatching them is no longer needed after r229437, so we can just remove special
347         handling for select menus here.
348
349         (-[WKContentView didCancelSelectionInSelectMenu:]): Deleted.
350         (-[WKContentView selectMenuSupportsMultipleSelection:]): Deleted.
351         (-[WKContentView selectMenu:hasCheckedOptionAtIndex:]): Deleted.
352         (-[WKContentView startingIndexForSelectMenu:]): Deleted.
353
354         The starting index for a select menu is no longer relevant when using list view controllers for input, so we can
355         just remove this delegate hook altogether.
356
357         * WebKit.xcodeproj/project.pbxproj:
358
359 2018-03-23  Youenn Fablet  <youenn@apple.com>
360
361         CacheStorage::Caches should clear m_caches when clearing its representation even though it is not yet initialized
362         https://bugs.webkit.org/show_bug.cgi?id=183945
363
364         Reviewed by Chris Dumez.
365
366         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
367         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
368         In case we clear Caches in the middle of the initialization, m_caches might not be empty
369         but m_isInitialized is not yet set to true since we are computing the Caches size.
370         Update the assertion and clear m_caches in that case.
371
372 2018-03-23  David Kilzer  <ddkilzer@apple.com>
373
374         Stop using dispatch_set_target_queue()
375         <https://webkit.org/b/183908>
376         <rdar://problem/33553533>
377
378         Reviewed by Daniel Bates.
379
380         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
381         (WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
382         dispatch_set_target_queue() since this is handled in the
383         dispatch_io_create() call above.
384
385 2018-03-23  Youenn Fablet  <youenn@apple.com>
386
387         CacheStorage::Engine should not ref itself when hopping to a background thread
388         https://bugs.webkit.org/show_bug.cgi?id=183925
389         <rdar://problem/38580483>
390
391         Reviewed by Chris Dumez.
392
393         Add support for weak pointers to CacheStorage Engine.
394         Use weak pointer when hopping to background threads.
395         Store callbacks in CacheStorage::Engine maps to keep them being destroyed in the main thread only.
396         Made some callbacks CompletionHandler as a bonus.
397
398         Made sure to use just one Engine for all private sessions.
399
400         * NetworkProcess/cache/CacheStorageEngine.cpp:
401         (WebKit::CacheStorage::Engine::~Engine):
402         (WebKit::CacheStorage::Engine::from):
403         (WebKit::CacheStorage::Engine::initialize):
404         (WebKit::CacheStorage::Engine::writeFile):
405         (WebKit::CacheStorage::Engine::readFile):
406         * NetworkProcess/cache/CacheStorageEngine.h:
407         (WebKit::CacheStorage::Engine::weakPtrFactory):
408
409 2018-03-23  Ryan Haddad  <ryanhaddad@apple.com>
410
411         Unreviewed build fix.
412
413         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
414
415 2018-03-23  Miguel Gomez  <magomez@igalia.com>
416
417         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
418         https://bugs.webkit.org/show_bug.cgi?id=183892
419
420         Remove the UpdateContentsFlag parameter when calling BitmapTexture::updateContents().
421
422         Reviewed by Žan Doberšek.
423
424         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
425         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
426
427 2018-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
428
429         [WPE][GTK] Fix -Wswitch warnings after r229778
430         https://bugs.webkit.org/show_bug.cgi?id=183927
431
432         Reviewed by Carlos Garcia Campos.
433
434         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
435         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Log a warning if Suspend is
436         received as a PolicyAction
437         * UIProcess/API/glib/WebKitNavigationClient.cpp: Ignore the ProcessSwap termination reason,
438         which should be invisible to WebKit clients
439
440 2018-03-22  Chris Dumez  <cdumez@apple.com>
441
442         Include security origin in the service worker process name
443         https://bugs.webkit.org/show_bug.cgi?id=183913
444
445         Reviewed by Youenn Fablet.
446
447         Include security origin in the service worker process name to facilitate debugging. This way, we
448         can differentiate which service worker process is used for which origin in activity monitor.
449
450         * Shared/ChildProcess.h:
451         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
452         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
453         * UIProcess/ServiceWorkerProcessProxy.cpp:
454         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
455         * WebProcess/cocoa/WebProcessCocoa.mm:
456         (WebKit::WebProcess::initializeProcessName):
457
458 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
459
460         Unreviewed, silence unused variable warning
461
462         * UIProcess/WebPageProxy.cpp:
463         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
464
465 2018-03-22  Dan Bernstein  <mitz@apple.com>
466
467         WKWebView doesn’t expose its spellCheckerDocumentTag
468         https://bugs.webkit.org/show_bug.cgi?id=183797
469         <rdar://problem/38678089>
470
471         Reviewed by Tim Horton.
472
473         * UIProcess/API/Cocoa/WKWebView.mm:
474         (-[WKWebView _spellCheckerDocumentTag]): Added this getter which calls through to the WebViewImpl.
475         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared _spellCheckerDocumentTag property.
476
477 2018-03-22  Chris Dumez  <cdumez@apple.com>
478
479         Use the same SWServer for all ephemeral sessions
480         https://bugs.webkit.org/show_bug.cgi?id=183921
481         <rdar://problem/36873075>
482
483         Reviewed by Youenn Fablet.
484
485         Use the same SWServer for all ephemeral sessions. SWServers never go away and we create
486         one per sessionID. When browsing doing private browsing in Safari (and other fetching
487         favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept
488         constructing new SWServers that would never go away. Each SWServer has a thread so we
489         would eventually hit the thread limit for the storage process.
490
491         * StorageProcess/StorageProcess.cpp:
492         (WebKit::StorageProcess::swServerForSession):
493
494 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
495
496         Unreviewed, fix format string warnings in service worker code
497
498         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
499
500         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
501         (WebKit::WebSWServerConnection::startFetch):
502         (WebKit::WebSWServerConnection::didFinishFetch):
503         (WebKit::WebSWServerConnection::didFailFetch):
504         (WebKit::WebSWServerConnection::didNotHandleFetch):
505
506 2018-03-22  Daniel Bates  <dabates@apple.com>
507
508         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
509         https://bugs.webkit.org/show_bug.cgi?id=183907
510         <rdar://problem/38759127>
511
512         Reviewed by Alex Christensen.
513
514         Adds both modern Objective-C SPI and C SPI to allow an embedding client to register a scheme
515         whose content should be displayed/loaded if and only if it can be requested. Disregarding an
516         app that enables universal access, by using this SPI WebKit will refuse to display cross-origin
517         content for the registered schemes.
518
519         We need to add C SPI for embedding clients that have not transitioned to the modern Objective-
520         C API/SPI.
521
522         * Shared/WebProcessCreationParameters.cpp:
523         (WebKit::WebProcessCreationParameters::encode const):
524         (WebKit::WebProcessCreationParameters::decode):
525         * Shared/WebProcessCreationParameters.h:
526         * UIProcess/API/C/WKContext.cpp:
527         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
528         * UIProcess/API/C/WKContextPrivate.h:
529         * UIProcess/API/Cocoa/WKProcessPool.mm:
530         (-[WKProcessPool _registerURLSchemeAsCanDisplayOnlyIfCanRequest:]):
531         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
532         * UIProcess/WebProcessPool.cpp:
533         (WebKit::WebProcessPool::initializeNewWebProcess):
534         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
535         * UIProcess/WebProcessPool.h:
536         * WebProcess/WebProcess.cpp:
537         (WebKit::WebProcess::initializeWebProcess):
538         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
539         * WebProcess/WebProcess.h:
540         * WebProcess/WebProcess.messages.in:
541
542 2018-03-22  Tim Horton  <timothy_horton@apple.com>
543
544         Improve readability of WebCore's OTHER_LDFLAGS
545         https://bugs.webkit.org/show_bug.cgi?id=183909
546         <rdar://problem/38760992>
547
548         Reviewed by Dan Bernstein.
549
550         * Configurations/Base.xcconfig:
551         * Configurations/FeatureDefines.xcconfig:
552
553 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
554
555         [TexMap] Make TextureMapperContextAttributes thread-specific
556         https://bugs.webkit.org/show_bug.cgi?id=183895
557
558         Reviewed by Carlos Garcia Campos.
559
560         CoordinatedGraphicsScene, as an implementor of the
561         TextureMapperPlatformLayerProxy::Compositor interface, doesn't have to
562         implement the texmapGL() method anymore.
563
564         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
565         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
566         (WebKit::CoordinatedGraphicsScene::texmapGL): Deleted.
567         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
568
569 2018-03-21  Frederic Wang  <fwang@igalia.com>
570
571         Unreviewed, update comment added in r229801.
572
573         * WebProcess/WebPage/ios/FindControllerIOS.mm:
574         (WebKit::FindController::didFindString): Remove "On Mobile" and mention bug 183889.
575
576 2018-03-21  Chris Dumez  <cdumez@apple.com>
577
578         Regression(r229831): ProcessSwap.Basic API test is crashing
579         https://bugs.webkit.org/show_bug.cgi?id=183884
580
581         Reviewed by Brady Eidson.
582
583         This code should only be called for navigation policy decisions.
584         It used to work without this check because of an early return, which
585         was dropped in r229831.
586
587         * UIProcess/WebPageProxy.cpp:
588         (WebKit::WebPageProxy::receivedPolicyDecision):
589
590 2018-03-21  Wenson Hsieh  <wenson_hsieh@apple.com>
591
592         [Extra zoom mode] Add new SPI hooks for clients to vend an input session context view
593         https://bugs.webkit.org/show_bug.cgi?id=183866
594         <rdar://problem/38692256>
595
596         Reviewed by Tim Horton.
597
598         Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
599         when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
600         delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
601         the actual view is then queried.
602
603         If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
604         to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
605         text input list view controller).
606
607         * UIProcess/API/Cocoa/_WKFormInputSession.h:
608         * UIProcess/API/Cocoa/_WKInputDelegate.h:
609
610         Add the new SPI hooks, described above.
611
612         * UIProcess/ios/WKContentViewInteraction.h:
613         * UIProcess/ios/WKContentViewInteraction.mm:
614         (-[WKFormInputSession reloadFocusedElementContextView]):
615
616         Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
617
618         (-[WKContentView setupInteraction]):
619         (-[WKContentView _stopAssistingNode]):
620         (-[WKContentView reloadContextViewForPresentedListViewController]):
621         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
622
623         Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
624         condition, the list view controller's inner table view would get reloaded when the form input session's text
625         suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
626         dismissal animation of view controller.
627
628 2018-03-21  Chris Dumez  <cdumez@apple.com>
629
630         WebKitTestRunner crashed in com.apple.WebKit: WebKit::WebProcessPool::terminateServiceWorkerProcesses
631         https://bugs.webkit.org/show_bug.cgi?id=183875
632
633         Reviewed by Brent Fulgham.
634
635         Protect |this| while we're iterating over m_serviceWorkerProcesses and terminating
636         each service worker process. It is possible for the WebProcess pool to get destroyed
637         as a result of terminating a service worker process.
638
639         This change is covered by layout tests that are currently crashing on the ASAN bots.
640
641         * UIProcess/WebProcessPool.cpp:
642         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
643
644 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
645
646         Fix typo in inactive media stream timeout default value
647         https://bugs.webkit.org/show_bug.cgi?id=183872
648         <rdar://problem/38723903>
649
650         Reviewed by Jer Noble.
651
652         * Shared/WebPreferences.yaml: Fix typo.
653         * Shared/WebPreferencesDefaultValues.h: Ditto.
654
655 2018-03-21  Chris Dumez  <cdumez@apple.com>
656
657         Make policy decisions asynchronous
658         https://bugs.webkit.org/show_bug.cgi?id=180568
659         <rdar://problem/37131297>
660
661         Reviewed by Alex Christensen.
662
663         Get rid of synchronous IPC and synchronous code paths for policy delegates.
664         Policy decisions are now all made asynchronously and rely on asynchronous
665         IPC.
666
667         This code change is based on work by Alex Christensen.
668
669         * UIProcess/WebPageProxy.cpp:
670         (WebKit::WebPageProxy::receivedPolicyDecision):
671         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
672         (WebKit::WebPageProxy::decidePolicyForResponse):
673         * UIProcess/WebPageProxy.h:
674         * UIProcess/WebPageProxy.messages.in:
675         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
676         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
677         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
678
679 2018-03-21  Chris Dumez  <cdumez@apple.com>
680
681         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
682         https://bugs.webkit.org/show_bug.cgi?id=183787
683
684         Reviewed by Wenson Hsieh.
685
686         Without asynchronous policy delegates, when the client requests a navigation, we would:
687         1. Do a synchronous navigation policy check
688         2. If the client allows the navigation, start the provisional load
689
690         Starting the provisional load would freeze the layer tree until first meaningful
691         layout via WebFrameLoaderClient::provisionalLoadStarted() -> WebPage::didStartPageTransition().
692
693         When constructing a WebView and then requesting a load right away. This would make sure
694         we do not commit a layer tree for the initial about:blank page because the layer tree
695         would be frozen until we have something meaningful to show for the following load.
696
697         However, with asynchronous policy delegates, we are able to do a layer tree commit
698         during the asynchronous navigation policy check because the layer tree is not frozen
699         yet (provisional load has not started) and the process is not stuck on synchronous
700         IPC. When constructing a WebView and then requesting a load right away, this would
701         allow a layer tree commit for about:blank to happen before we've even started the
702         load. This would cause some API tests to fail on iOS.
703
704         To address the issue, we try and maintain pre-existing behavior by freezing the
705         layer tree during navigation policy decision.
706
707         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
708         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
709         (WebKit::WebFrameLoaderClient::didDecidePolicyForNavigationAction):
710         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
711         * WebProcess/WebPage/WebPage.cpp:
712         (WebKit::WebPage::didStartNavigationPolicyCheck):
713         (WebKit::WebPage::didCompleteNavigationPolicyCheck):
714         * WebProcess/WebPage/WebPage.h:
715
716 2018-03-21  Brent Fulgham  <bfulgham@apple.com>
717
718         Allow the WebContent process to read ViewBridge preferences
719         https://bugs.webkit.org/show_bug.cgi?id=183862
720         <rdar://problem/38459456>
721
722         Reviewed by Eric Carlson.
723
724         * WebProcess/com.apple.WebProcess.sb.in:
725
726 2018-03-21  Frederic Wang  <fwang@igalia.com>
727
728         [iOS] Text highlighted by the Find UI overlaps with NBC news header on google.com
729         https://bugs.webkit.org/show_bug.cgi?id=183658
730
731         Reviewed by Tim Horton.
732
733         On Mobile, many sites have overlay headers or footers that may overlap with the highlighted
734         text inside a scrollable overflow node. To workaround that issue, this commit changes the
735         behavior so that the text is revealed at the center of the overflow node.
736
737         * WebProcess/WebPage/ios/FindControllerIOS.mm:
738         (WebKit::FindController::didFindString): Use alignCenterAlways instead of alignToEdgeIfNeeded.
739
740 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
741
742         [GTK][WPE] JSC bindings not introspectable
743         https://bugs.webkit.org/show_bug.cgi?id=136989
744
745         Reviewed by Michael Catanzaro.
746
747         Deprecate the functions that are not introspectable due to JSC C API in GTK+ port and remove them in WPE
748         port. Add alternative functions using the new JSC GLib API. We no longer need to keep a global context attached
749         to every view. We can simply create a temporary global context on demand and release it after 1 second. This
750         also allows us to remove WebPageProxy::javascriptGlobalContext() and all the related code.
751
752         * PlatformGTK.cmake:
753         * PlatformWPE.cmake:
754         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
755         (_WebKitJavascriptResult::_WebKitJavascriptResult):
756         (webkitJavascriptResultCreate):
757         (webkit_javascript_result_get_global_context):
758         (webkit_javascript_result_get_value):
759         (webkit_javascript_result_get_js_value):
760         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
761         (SharedJavascriptContext::singleton):
762         (SharedJavascriptContext::SharedJavascriptContext):
763         (SharedJavascriptContext::getOrCreateContext):
764         (SharedJavascriptContext::releaseContext):
765         * UIProcess/API/glib/WebKitUserContentManager.cpp:
766         * UIProcess/API/glib/WebKitWebView.cpp:
767         (webkit_web_view_get_javascript_global_context):
768         (webkitWebViewRunJavaScriptCallback):
769         * UIProcess/API/gtk/PageClientImpl.cpp:
770         * UIProcess/API/gtk/PageClientImpl.h:
771         * UIProcess/API/gtk/WebKitJavascriptResult.h:
772         * UIProcess/API/gtk/WebKitWebView.h:
773         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
774         * UIProcess/API/wpe/APIViewClient.h:
775         (API::ViewClient::handleDownloadRequest):
776         * UIProcess/API/wpe/PageClientImpl.cpp:
777         * UIProcess/API/wpe/PageClientImpl.h:
778         * UIProcess/API/wpe/WPEView.cpp:
779         * UIProcess/API/wpe/WPEView.h:
780         * UIProcess/API/wpe/WebKitJavascriptResult.h:
781         * UIProcess/API/wpe/WebKitWebView.h:
782         * UIProcess/PageClient.h:
783         * UIProcess/WebPageProxy.h:
784         * UIProcess/gtk/WebPageProxyGtk.cpp:
785         * UIProcess/wpe/WebPageProxyWPE.cpp:
786         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
787         (webkit_frame_get_js_context):
788         (webkit_frame_get_js_context_for_script_world):
789         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
790         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
791
792 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
793
794         [GTK][WPE] Initial implementation of JavaScriptCore glib bindings
795         https://bugs.webkit.org/show_bug.cgi?id=164061
796
797         Reviewed by Michael Catanzaro.
798
799         Set decorator and deprecation_guard options in API docs config files, since they are no longer common to all
800         libraries.
801
802         * PlatformGTK.cmake:
803
804 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
805
806         [CoordGraphics] Simplify CoordinatedGraphicsScene activation
807         https://bugs.webkit.org/show_bug.cgi?id=183772
808
809         Reviewed by Carlos Garcia Campos.
810
811         Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
812         the m_isActive member variable. We don't have to call renderNextFrame()
813         anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
814         but that can be avoided if m_isWaitingForRenderer in that class is
815         initialized to false.
816
817         CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
818         ThreadedCompositor implementation are removed. renderNextFrame() in the
819         CoordinatedGraphicsScene class can also be removed, along with the
820         unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
821         the associated m_clientRunLoop member variable.
822
823         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
824         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
825         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
826         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
827         (WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
828         (WebKit::CoordinatedGraphicsScene::setActive): Deleted.
829         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
830         (WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
831         (WebKit::CoordinatedGraphicsScene::setActive):
832         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
833         (WebKit::m_displayRefreshMonitor):
834         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
835         (WebKit::ThreadedCompositor::renderNextFrame): Deleted.
836         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
837         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
838
839 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
840
841         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
842         https://bugs.webkit.org/show_bug.cgi?id=183771
843
844         Reviewed by Carlos Garcia Campos.
845
846         In CoordinatedGraphicsScene::paintToCurrentGLContext(), retrieve
847         information about any running animation in the scene via the
848         TextureMapperLayer::applyAnimationsRecursively() call. Use that boolean
849         value at the end up the method, instead of again traversing the
850         TextureMapperLayer tree to determine whether any running animations are
851         present.
852
853         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
854         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
855
856 2018-03-20  Tim Horton  <timothy_horton@apple.com>
857
858         Enable the minimal simulator feature flag when appropriate
859         https://bugs.webkit.org/show_bug.cgi?id=183807
860
861         Reviewed by Dan Bernstein.
862
863         * Configurations/FeatureDefines.xcconfig:
864
865 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
866
867         Expose content attributes on _WKLinkIconParameters
868         https://bugs.webkit.org/show_bug.cgi?id=183768
869
870         Reviewed by Alex Christensen.
871
872         Added _WKLinkIconParameters.attributes to expose content attributes of a link element
873         which defined a favicon, touch icon, or pre-compressed touch icon.
874
875         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
876         (_WKLinkIconParameters.attributes): Added.
877         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm:
878         (_WKLinkIconParameters._attributes): Added.
879         (-[_WKLinkIconParameters _initWithLinkIcon:]): Convert the hash map from WebCore to a NSDictionary.
880         (-[_WKLinkIconParameters attributes]): Added.
881
882 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
883
884         Add AssistedNodeInformation plumbing for form control placeholder text and label text
885         https://bugs.webkit.org/show_bug.cgi?id=183802
886         <rdar://problem/38686273>
887
888         Reviewed by Tim Horton.
889
890         Surfaces some additional information about the currently focused element to the input delegate in the UI process.
891         See comments below for more details.
892
893         Test: WebKit.FocusedElementInfo
894
895         * Shared/AssistedNodeInformation.cpp:
896         (WebKit::AssistedNodeInformation::encode const):
897         (WebKit::AssistedNodeInformation::decode):
898         * Shared/AssistedNodeInformation.h:
899
900         Add `placeholder` and `label` to AssistedNodeInformation, which capture the value of the placeholder attribute
901         and the text of the first associated label element for the focused form control. Also add boilerplate encoder/
902         decoder support for these members.
903
904         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
905
906         Augment _WKFocusedElementInfo to include placeholder and label.
907
908         * UIProcess/ios/WKContentViewInteraction.mm:
909         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
910         (-[WKFocusedElementInfo label]):
911         (-[WKFocusedElementInfo placeholder]):
912         * WebProcess/WebPage/ios/WebPageIOS.mm:
913         (WebKit::WebPage::getAssistedNodeInformation):
914
915         For input elements and textareas, set the placeholder to the value of the placeholder attribute. For all
916         elements with associated labels, grab the inner text of the first label that is not empty, ignoring all labels
917         that are `display: none` (i.e. not being rendered).
918
919 2018-03-20  Brady Eidson  <beidson@apple.com>
920
921         First piece of process swapping on navigation.
922         https://bugs.webkit.org/show_bug.cgi?id=183665
923
924         Reviewed by Andy Estes.
925
926         This patch adds the first pieces of the following feature:
927         "When a navigation originating inside a WKWebView goes to a different origin,
928          swap to a new WebProcess for that navigation"
929
930         There are significant bugs to be resolved and significant optimizations to be made.
931         Which is why the feature is disabled by default.
932
933         Besides the core logic implementing the feature, this patch does a lot of related 
934         work such as:
935         - Removing some now-invalid ASSERTs
936         - Adding some ASSERTs
937         - Update various switch states to handle the new "Suspend" policy and "NavigationSwap"
938           process termination reason
939
940         * NetworkProcess/NetworkDataTaskBlob.cpp:
941         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
942
943         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
944         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
945
946         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
947         (toNSURLSessionResponseDisposition):
948
949         * Platform/Logging.h:
950
951         * Shared/LoadParameters.cpp:
952         (WebKit::LoadParameters::encode const):
953         (WebKit::LoadParameters::decode):
954         * Shared/LoadParameters.h:
955
956         * Shared/ProcessTerminationReason.h: Add "NavigationSwap" as a process termination reason.
957
958         * UIProcess/API/APINavigation.h:
959
960         * UIProcess/API/APIProcessPoolConfiguration.cpp:
961         (API::ProcessPoolConfiguration::copy):
962
963         * UIProcess/API/C/WKAPICast.h:
964         (WebKit::toAPI):
965
966         * UIProcess/Cocoa/NavigationState.mm:
967         (WebKit::wkProcessTerminationReason):
968
969         * UIProcess/WebFramePolicyListenerProxy.cpp:
970         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
971         * UIProcess/WebFramePolicyListenerProxy.h:
972         (WebKit::WebFramePolicyListenerProxy::create):
973         (WebKit::WebFramePolicyListenerProxy::policyListenerType const):
974
975         * UIProcess/WebFrameProxy.cpp:
976         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
977         (WebKit::WebFrameProxy::activePolicyListenerProxy):
978         * UIProcess/WebFrameProxy.h:
979
980         * UIProcess/WebNavigationState.cpp:
981         (WebKit::WebNavigationState::navigation):
982         (WebKit::WebNavigationState::takeNavigation):
983
984         * UIProcess/WebPageProxy.cpp:
985         (WebKit::WebPageProxy::reattachToWebProcess):
986         (WebKit::WebPageProxy::attachToProcessForNavigation): Pretend that the existing process 
987           terminated using the new "NavigationSwap" reason, then manually start the next load.
988         (WebKit::WebPageProxy::loadRequest):
989         (WebKit::WebPageProxy::loadRequestWithNavigation):
990         (WebKit::WebPageProxy::receivedPolicyDecision):
991         (WebKit::WebPageProxy::continueNavigationInNewProcess):
992         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
993         (WebKit::WebPageProxy::decidePolicyForResponse):
994         (WebKit::WebPageProxy::processDidTerminate):
995         (WebKit::WebPageProxy::resetState):
996         (WebKit::WebPageProxy::resetStateAfterProcessExited):
997         * UIProcess/WebPageProxy.h:
998
999         * UIProcess/WebProcessPool.cpp:
1000         (WebKit::WebProcessPool::processForNavigation): Determine which process should be used
1001           for a proposed navigation, creating a new one if necessary.
1002         * UIProcess/WebProcessPool.h:
1003
1004         * UIProcess/WebStorage/StorageManager.cpp:
1005         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
1006
1007         * WebProcess/WebPage/WebPage.cpp:
1008         (WebKit::WebPage::loadRequest):
1009
1010 2018-03-20  Youenn Fablet  <youenn@apple.com>
1011
1012         ServiceWorkerClientFetch::didReceiveData should check for m_encodedDataLength
1013         https://bugs.webkit.org/show_bug.cgi?id=183668
1014
1015         Reviewed by Chris Dumez.
1016
1017         Crash happens when releasing a RefPtr<SharedBuffer> buffer that is null.
1018         It happens because ServiceWorkerClientFetch can call m_loader->didReceiveBuffer at two different places.
1019         Either when receiving an IPC call or as part of completion handler for the response validation check.
1020         At each call site, we release the buffer to pass it to the loader and we set m_encodedLength to zero.
1021         The fix is to add the m_encodedLength check like done in the case of response validation check completion handler.
1022
1023         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1024         (WebKit::ServiceWorkerClientFetch::didReceiveData):
1025
1026 2018-03-20  Jeff Miller  <jeffm@apple.com>
1027
1028         Expose aggressiveTileRetentionEnabled in WKPreferences SPI to match C SPI
1029         https://bugs.webkit.org/show_bug.cgi?id=183790
1030
1031         Reviewed by Alex Christensen.
1032         
1033         Expose this property on macOS only.
1034
1035         * UIProcess/API/Cocoa/WKPreferences.mm:
1036         (-[WKPreferences _setAggressiveTileRetentionEnabled:]):
1037         (-[WKPreferences _aggressiveTileRetentionEnabled]):
1038         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1039
1040 2018-03-20  Tim Horton  <timothy_horton@apple.com>
1041
1042         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
1043         https://bugs.webkit.org/show_bug.cgi?id=183758
1044         <rdar://problem/38017644>
1045
1046         Reviewed by Dan Bernstein.
1047
1048         * Configurations/FeatureDefines.xcconfig:
1049
1050 2018-03-20  Chris Dumez  <cdumez@apple.com>
1051
1052         Unreviewed, rolling out r229726 and r229763.
1053
1054         Caused some API test failures on iOS
1055
1056         Reverted changesets:
1057
1058         "Make policy decisions asynchronous"
1059         https://bugs.webkit.org/show_bug.cgi?id=180568
1060         https://trac.webkit.org/changeset/229726
1061
1062         "Rebaseline three webarchive tests for WK2 after r229726."
1063         https://bugs.webkit.org/show_bug.cgi?id=180568
1064         https://trac.webkit.org/changeset/229763
1065
1066 2018-03-20  Brent Fulgham  <bfulgham@apple.com>
1067
1068         [iOS] Grant IOKit preference access for the Home button
1069         https://bugs.webkit.org/show_bug.cgi?id=183754
1070         <rdar://problem/38179704>
1071
1072         Reviewed by Eric Carlson.
1073
1074         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1075
1076 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1077
1078         [Extra zoom mode] Adopt updated input view controller machinery for text input
1079         https://bugs.webkit.org/show_bug.cgi?id=183765
1080         <rdar://problem/36926269>
1081
1082         Reviewed by Tim Horton.
1083
1084         Adopt new classes for extra zoomed text inputs. Massage WKTextInputViewController into WKTextInputListView-
1085         Controller and introduce WKFormControlListViewController, the eventual replacement for the base class
1086         WKTextFormControlViewController that will act as the base class of all list-view-controller-based input UI in
1087         extra zoom mode.
1088
1089         * UIProcess/ios/WKContentViewInteraction.h:
1090         * UIProcess/ios/WKContentViewInteraction.mm:
1091         (-[WKContentView presentTextInputViewController:]):
1092         (-[WKContentView dismissTextInputViewController:]):
1093         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
1094         (-[WKContentView _wheelChangedWithEvent:]):
1095         * UIProcess/ios/forms/WKFormControlListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
1096         * UIProcess/ios/forms/WKFormControlListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.mm.
1097         * UIProcess/ios/forms/WKTextInputListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
1098         * UIProcess/ios/forms/WKTextInputListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
1099         * WebKit.xcodeproj/project.pbxproj:
1100
1101 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
1102
1103         Clear style colors when setting default appearance
1104         https://bugs.webkit.org/show_bug.cgi?id=183759
1105
1106         Reviewed by Tim Horton.
1107
1108         Colors are cached and need to be cleared and recalculated.
1109
1110         * WebProcess/WebPage/WebPage.cpp:
1111         (WebKit::WebPage::setDefaultAppearance):
1112
1113 2018-03-19  Chris Dumez  <cdumez@apple.com>
1114
1115         WKWebView.ClearAppCache is a flaky API test failure on High Sierra.
1116         https://bugs.webkit.org/show_bug.cgi?id=181546
1117         <rdar://problem/36444327>
1118
1119         Reviewed by Ryosuke Niwa.
1120
1121         in LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(), add origin
1122         to originIdentifiersToDelete if we cannot determine the last modification
1123         time of the database file. This likely means the database file does not
1124         exist. However, we still needs to make sure the origin gets removed from
1125         the origins database and there may be *.wal / *.shm variants of the database
1126         that are still on disk and need to be deleted.
1127
1128         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1129         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
1130
1131 2018-03-19  Chris Dumez  <cdumez@apple.com>
1132
1133         Have one service worker process per security origin
1134         https://bugs.webkit.org/show_bug.cgi?id=183600
1135         <rdar://problem/35280128>
1136
1137         Reviewed by Brady Eidson.
1138
1139         Split service workers from different origins into their own processes
1140         for security reasons.
1141
1142         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1143         (WebKit::WebSWServerConnection::startFetch):
1144         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1145         (WebKit::WebSWServerConnection::scheduleJobInServer):
1146         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1147         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1148         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1149         * StorageProcess/StorageProcess.cpp:
1150         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection):
1151         (WebKit::StorageProcess::didClose):
1152         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1153         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
1154         (WebKit::StorageProcess::didReceiveMessage):
1155         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1156         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
1157         (WebKit::StorageProcess::createServerToContextConnection):
1158         * StorageProcess/StorageProcess.h:
1159         * StorageProcess/StorageProcess.messages.in:
1160         * StorageProcess/StorageToWebProcessConnection.cpp:
1161         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
1162         (WebKit::StorageToWebProcessConnection::didClose):
1163         * StorageProcess/StorageToWebProcessConnection.h:
1164         * UIProcess/API/C/WKContext.cpp:
1165         (WKContextTerminateServiceWorkerProcess):
1166         * UIProcess/API/Cocoa/WKProcessPool.mm:
1167         (-[WKProcessPool _terminateServiceWorkerProcesses]):
1168         (-[WKProcessPool _webPageContentProcessCount]):
1169         (-[WKProcessPool _serviceWorkerProcessCount]):
1170         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1171         * UIProcess/Network/NetworkProcessProxy.cpp:
1172         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
1173         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
1174         * UIProcess/ServiceWorkerProcessProxy.cpp:
1175         (WebKit::ServiceWorkerProcessProxy::create):
1176         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1177         * UIProcess/ServiceWorkerProcessProxy.h:
1178         (isType):
1179         * UIProcess/Storage/StorageProcessProxy.cpp:
1180         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1181         (WebKit::StorageProcessProxy::didFinishLaunching):
1182         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
1183         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
1184         * UIProcess/Storage/StorageProcessProxy.h:
1185         * UIProcess/Storage/StorageProcessProxy.messages.in:
1186         * UIProcess/WebProcessPool.cpp:
1187         (WebKit::WebProcessPool::getStorageProcessConnection):
1188         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1189         (WebKit::WebProcessPool::createNewWebProcess):
1190         (WebKit::WebProcessPool::disconnectProcess):
1191         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
1192         (WebKit::WebProcessPool::createWebPage):
1193         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
1194         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
1195         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
1196         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
1197         (WebKit::WebProcessPool::updateProcessAssertions):
1198         (WebKit::WebProcessPool::serviceWorkerProcessProxyFromPageID const):
1199         * UIProcess/WebProcessPool.h:
1200         * UIProcess/WebProcessProxy.cpp:
1201         (WebKit::WebProcessProxy::getStorageProcessConnection):
1202
1203 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
1204
1205         Unreviewed, another quick fix for r229699
1206
1207         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
1208
1209         * Configurations/FeatureDefines.xcconfig:
1210
1211 2018-03-19  Chris Dumez  <cdumez@apple.com>
1212
1213         Make policy decisions asynchronous
1214         https://bugs.webkit.org/show_bug.cgi?id=180568
1215         <rdar://problem/37131297>
1216
1217         Reviewed by Alex Christensen.
1218
1219         Get rid of synchronous IPC and synchronous code paths for policy delegates.
1220         Policy decisions are now all made asynchronously and rely on asynchronous
1221         IPC.
1222
1223         This code change is based on work by Alex Christensen.
1224
1225         * UIProcess/WebPageProxy.cpp:
1226         (WebKit::WebPageProxy::receivedPolicyDecision):
1227         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1228         (WebKit::WebPageProxy::decidePolicyForResponse):
1229         * UIProcess/WebPageProxy.h:
1230         * UIProcess/WebPageProxy.messages.in:
1231         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1232         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1233         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1234
1235 2018-03-19  Brian Burg  <bburg@apple.com>
1236
1237         Web Inspector: clean up WKWebView configuration code
1238         https://bugs.webkit.org/show_bug.cgi?id=183747
1239         <rdar://problem/38629343>
1240
1241         Reviewed by Timothy Hatcher.
1242
1243         * UIProcess/mac/WKInspectorViewController.mm:
1244         (-[WKInspectorViewController webView]): Always use system
1245         appearance for Inspector's web content.
1246
1247 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
1248
1249         [Extra zoom mode] Require fullscreen for video playback
1250         https://bugs.webkit.org/show_bug.cgi?id=183742
1251         <rdar://problem/38235862>
1252
1253         Reviewed by Jer Noble.
1254
1255         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1256         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1257         (-[WKVideoFullScreenViewController initWithAVPlayerViewController:]):
1258         (-[WKVideoFullScreenViewController viewDidLoad]):
1259         (-[WKVideoFullScreenViewController prefersStatusBarHidden]):
1260         (WebKit::VideoFullscreenModelContext::presentingViewController):
1261         (WebKit::VideoFullscreenModelContext::createVideoFullscreenViewController):
1262         * WebProcess/cocoa/VideoFullscreenManager.mm:
1263         (WebKit::VideoFullscreenManager::didEnterFullscreen):
1264
1265 2018-03-19  Daniel Bates  <dabates@apple.com>
1266
1267         test-webkitpy no longer runs WebKit2 tests
1268         https://bugs.webkit.org/show_bug.cgi?id=183724
1269
1270         Reviewed by Alexey Proskuryakov.
1271
1272         Fixes an issue where Python emits errors "global name reset_results is not defined" when
1273         running tests in messages_unittest.py using test-webkitpy.
1274
1275         Currently messages_unittest.py conditionally defines the global variable reset_results
1276         when run as the main program (i.e. __name__ == "__main__"). When messages_unittest.py is
1277         imported as a module as test-webkitpy does then it is not considered the main program
1278         ;=> the top-level script environment is not __main__ ;=> we do not define the global
1279         variable reset_results. Instead we should unconditionally define the global variable
1280         reset_results.
1281
1282         * Scripts/webkit/messages_unittest.py:
1283
1284 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
1285
1286         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
1287         https://bugs.webkit.org/show_bug.cgi?id=183604
1288         <rdar://problem/38305109>
1289
1290         Reviewed by Brent Fulgham.
1291
1292         * UIProcess/WebPageProxy.h:
1293         * UIProcess/WebPageProxy.messages.in:
1294         * UIProcess/mac/DisplayLink.cpp: Added.
1295         (WebKit::DisplayLink::DisplayLink):
1296         (WebKit::DisplayLink::~DisplayLink):
1297         (WebKit::DisplayLink::displayLinkCallback):
1298         * UIProcess/mac/DisplayLink.h: Added.
1299         * UIProcess/mac/WebPageProxyMac.mm:
1300         (WebKit::WebPageProxy::startDisplayRefreshMonitor):
1301         (WebKit::WebPageProxy::stopDisplayRefreshMonitor):
1302         * WebKit.xcodeproj/project.pbxproj:
1303         * WebProcess/WebPage/DrawingArea.cpp:
1304         (WebKit::DrawingArea::createDisplayRefreshMonitor):
1305         * WebProcess/WebPage/DrawingArea.h:
1306         * WebProcess/WebPage/DrawingArea.messages.in:
1307         * WebProcess/WebPage/mac/DrawingAreaMac.cpp: Added.
1308         (WebKit::DisplayRefreshMonitorMac::create):
1309         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
1310         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
1311         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
1312         (WebKit::DisplayRefreshMonitorMac::displayLinkFired):
1313         (WebKit::DrawingArea::screenWasRefreshed):
1314         (WebKit::DrawingArea::createDisplayRefreshMonitor):
1315
1316 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
1317
1318         [WebAuthN] Implement authenticatorMakeCredential
1319         https://bugs.webkit.org/show_bug.cgi?id=183527
1320         <rdar://problem/35275886>
1321
1322         Reviewed by Brent Fulgham.
1323
1324         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
1325         (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy):
1326         (WebKit::WebCredentialsMessengerProxy::makeCredential):
1327         (WebKit::WebCredentialsMessengerProxy::getAssertion):
1328         (WebKit::WebCredentialsMessengerProxy::isUserVerifyingPlatformAuthenticatorAvailable):
1329         (WebKit::WebCredentialsMessengerProxy::exceptionReply):
1330         (WebKit::WebCredentialsMessengerProxy::makeCredentialReply):
1331         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
1332         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
1333         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm: Removed.
1334         * WebKit.xcodeproj/project.pbxproj:
1335         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
1336         (WebKit::WebCredentialsMessenger::makeCredential):
1337         (WebKit::WebCredentialsMessenger::makeCredentialReply):
1338         * WebProcess/CredentialManagement/WebCredentialsMessenger.h:
1339         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
1340
1341 2018-03-17  Daniel Bates  <dabates@apple.com>
1342
1343         Tests fail in messages_unittest.py
1344         https://bugs.webkit.org/show_bug.cgi?id=183725
1345
1346         Partial revert of r222113. The messages generator machinery does not know when
1347         it is sufficient to emit an include for wtf/Forward.h as opposed to a concrete
1348         header.
1349
1350         * Scripts/webkit/LegacyMessages-expected.h:
1351         * Scripts/webkit/Messages-expected.h:
1352
1353 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1354
1355         Unreviewed, rolling out r229688.
1356
1357         There's a solution that doesn't require this SPI.
1358
1359         Reverted changeset:
1360
1361         "Add SPI to expose width and height anchors for WKWebView's
1362         content view"
1363         https://bugs.webkit.org/show_bug.cgi?id=183711
1364         https://trac.webkit.org/changeset/229688
1365
1366 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1367
1368         Add SPI to expose width and height anchors for WKWebView's content view
1369         https://bugs.webkit.org/show_bug.cgi?id=183711
1370         <rdar://problem/38562899>
1371
1372         Reviewed by Tim Horton.
1373
1374         Add _contentWidthAnchor and _contentHeightAnchor SPI to WKWebView for internal clients to be able to reason
1375         about the size of the content view on iOS using autolayout.
1376
1377         Test: WebKit.AutoLayoutPositionHeaderAndFooterViewsInScrollView.
1378
1379         * UIProcess/API/Cocoa/WKWebView.mm:
1380         (-[WKWebView _contentWidthAnchor]):
1381         (-[WKWebView _contentHeightAnchor]):
1382         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1383
1384 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
1385
1386         Add _useSystemAppearance to WKView
1387         https://bugs.webkit.org/show_bug.cgi?id=183706
1388         <rdar://problem/38516584>
1389
1390         Reviewed by Tim Horton.
1391
1392         Plumb useSystemAppearance and other supporting functions to WKView
1393
1394         * UIProcess/API/Cocoa/WKViewPrivate.h:
1395         * UIProcess/API/Cocoa/WKWebView.mm:
1396         (-[WKWebView _initializeWithConfiguration:]):
1397         (-[WKWebView _useSystemAppearance]):
1398         (-[WKWebView _setUseSystemAppearance:]):
1399         (-[WKWebView effectiveAppearanceDidChange]):
1400         * UIProcess/API/mac/WKView.mm:
1401         (-[WKView effectiveAppearanceDidChange]):
1402         (-[WKView _setUseSystemAppearance:]):
1403         (-[WKView _useSystemAppearance]):
1404         (-[WKView _setDefaultAppearance:]):
1405         * UIProcess/Cocoa/WebViewImpl.h:
1406         * UIProcess/Cocoa/WebViewImpl.mm:
1407         (WebKit::WebViewImpl::setUseSystemAppearance):
1408         (WebKit::WebViewImpl::useSystemAppearance):
1409         (WebKit::WebViewImpl::setDefaultAppearance):
1410
1411 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
1412
1413         Set a trap to catch an infrequent form-related nullptr crash
1414         https://bugs.webkit.org/show_bug.cgi?id=183704
1415         <rdar://problem/37579354>
1416
1417         Reviewed by Ryosuke Niwa.
1418
1419         Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.
1420
1421         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1422         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
1423
1424 2018-03-16  Jer Noble  <jer.noble@apple.com>
1425
1426         Make Fullscreen API an Experimental Feature
1427         https://bugs.webkit.org/show_bug.cgi?id=183662
1428
1429         Reviewed by Jon Lee.
1430
1431         Add the ability to have a conditional for whether an Experimental Feature is "visible", separate from
1432         whether the preference is available, for definining platform-specific Experimental Features.
1433
1434         * Scripts/GeneratePreferences.rb:
1435         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
1436         * Shared/WebPreferences.yaml:
1437
1438 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
1439
1440         Ensure that style is updated when the effective appearance changes
1441         https://bugs.webkit.org/show_bug.cgi?id=183690
1442         <rdar://problem/38385900>
1443
1444         Reviewed by Tim Horton and Wenson Hsieh.
1445
1446         Respond to and respect the effective appearance changing.
1447
1448         * UIProcess/API/Cocoa/WKWebView.mm:
1449         (-[WKWebView effectiveAppearanceDidChange]):
1450         * WebProcess/WebPage/WebPage.cpp:
1451         (WebKit::WebPage::setDefaultAppearance):
1452
1453 2018-03-16  Chris Dumez  <cdumez@apple.com>
1454
1455         URLSchemeHandler.Basic API test fails with async policy delegates
1456         https://bugs.webkit.org/show_bug.cgi?id=183678
1457
1458         Reviewed by Alex Christensen.
1459
1460         The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
1461         on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
1462         asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
1463         for an async policy delegate.
1464
1465         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
1466         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
1467         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
1468         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
1469         (WebKit::WebURLSchemeTaskProxy::didComplete):
1470         (WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
1471         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
1472         (WebKit::WebURLSchemeTaskProxy::queueTask):
1473
1474 2018-03-16  Claudio Saavedra  <csaavedra@igalia.com>
1475
1476         Suppress GCC warnings by using #include instead of #import
1477
1478         Unreviewed.
1479         * UIProcess/SystemPreviewController.cpp:
1480
1481 2018-03-15  Keith Rollin  <krollin@apple.com>
1482
1483         Telemetry for stalled webpage loads
1484         https://bugs.webkit.org/show_bug.cgi?id=183221
1485         <rdar://problem/36549013>
1486
1487         Reviewed by Chris Dumez.
1488
1489         Add telemetry for page loads, tracking the pages that succeed, fail,
1490         or are canceled. This information will be used to track the overall
1491         health of our page loading as time goes on.
1492
1493         * UIProcess/WebPageProxy.cpp:
1494         (WebKit::WebPageProxy::close):
1495         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1496         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1497         (WebKit::WebPageProxy::didFinishLoadForFrame):
1498         (WebKit::WebPageProxy::didFailLoadForFrame):
1499         (WebKit::WebPageProxy::reportPageLoadResult):
1500         * UIProcess/WebPageProxy.h:
1501         (WebKit::WebPageProxy::reportPageLoadResult):
1502
1503 2018-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1504
1505         [iOS WK2] Hit-testing fails when specifying a large top content inset
1506         https://bugs.webkit.org/show_bug.cgi?id=183648
1507         <rdar://problem/38421894>
1508
1509         Reviewed by Tim Horton.
1510
1511         Currently, in the process of computing unobscured content rect in the UI process on iOS, we subtract away parts
1512         of the view that are obscured by insets (e.g. MobileSafari's chrome). The helper method -[WKWebView
1513         _computeContentInset] is intended to compute these obscuring insets around the view, but it takes scroll view
1514         insets into account. This means that if WKWebView's inner scroll view has content insets, we'll end up shrinking
1515         the unobscured content rect as if the insetted region obscures the viewport; this causes visible content on the
1516         page to be uninteractible, since WKWebView erroneously thinks it's obscured.
1517
1518         To address this, we rename _computeContentInset to _computeObscuredInset, and make it _not_ affected by the
1519         scroll view's content insets. From code inspection and testing, all but one of the former call sites of
1520         _computeContentInset really need the obscured inset instead (see below). The one exception, -[WKWebView
1521         _adjustedContentOffset:], takes a scroll position from the page and maps it to a content offset in the inner
1522         UIScrollView (see below for more details).
1523
1524         Tests:  ScrollViewInsetTests.InnerHeightWithLargeTopContentInset
1525                 ScrollViewInsetTests.InnerHeightWithLargeBottomContentInset
1526                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash
1527                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterNavigation
1528
1529         * UIProcess/API/Cocoa/WKWebView.mm:
1530         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
1531         (-[WKWebView _initialContentOffsetForScrollView]):
1532
1533         See -_contentOffsetAdjustedForObscuredInset: below.
1534
1535         (-[WKWebView _contentOffsetAdjustedForObscuredInset:]):
1536
1537         Formerly -_adjustedContentOffset:. -_contentOffsetAdjustedForObscuredInset: no longer takes scroll view content
1538         inset into account, and only cares about insets that obscure the view. This means that the scroll position
1539         (0, 0) in the document now maps to the content offset in the inner UIScrollView, such that the top of the page
1540         is aligned with the top of the viewport.
1541
1542         However, many call sites of -_adjustedContentOffset: were intended to compute the initial, top-left-most content
1543         offset in the scroll view to scroll to when resetting the web view (i.e., they pass in CGPointZero for the
1544         scroll position). An example of this is the scroll position to jump to after web content process termination, or
1545         the scroll position after main frame navigation. In these cases, we actually want to jump to the top of the
1546         scroll view, so we do want to use the version of the computed content insets that accounts for scroll view
1547         insets.
1548
1549         Since these cases are limited to finding the top-left-most scroll position, we pull this out into a separate
1550         helper method (-_initialContentOffsetForScrollView) and replace calls to
1551         `-[self _adjustedContentOffset:CGPointZero]` with this instead.
1552
1553         (-[WKWebView _computedObscuredInset]):
1554
1555         A version of -_computeContentInset that doesn't care about scroll view insets. Used whereever we need to account
1556         for obscured insets rather than the combination of content insets and unobscured insets (e.g.
1557         -_initialContentOffsetForScrollView).
1558
1559         (-[WKWebView _processDidExit]):
1560         (-[WKWebView _didCommitLayerTree:]):
1561         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
1562         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
1563         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
1564         (-[WKWebView _updateVisibleContentRects]):
1565         (-[WKWebView _navigationGestureDidBegin]):
1566
1567         In all these places where we inset the view bounds to compute the unobscured region of the viewport, it doesn't
1568         make sense to additionally inset by the scroll view's content insets, since (1) the scroll view's content insets
1569         don't obscure the viewport, and (2) it's perfectly valid for the inner scroll view to have arbitrarily large
1570         content insets.
1571
1572         (-[WKWebView _adjustedContentOffset:]): Deleted.
1573
1574         Renamed to -_contentOffsetAdjustedForObscuredInset:.
1575
1576         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1577         * UIProcess/ios/WKPDFView.mm:
1578         (-[WKPDFView _offsetForPageNumberIndicator]):
1579
1580         Similar to -_scrollToFragment: (see below).
1581
1582         (-[WKPDFView _scrollToFragment:]):
1583
1584         This helper figures out which content offset to scroll to, given the y-origin of a page in a PDF document. If
1585         insets are added to the scroll view, we end up scrolling to the wrong content offset since we'll add the height
1586         of the top content inset (imagine that the top content inset is enormous — then we'll scroll an amount equal to
1587         the top content inset _past_ the point where the y-origin of the page is at the top of the viewport).
1588
1589 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
1590
1591         [macOS] Correct sandbox violations during Flash playback under ToT WebKit
1592         https://bugs.webkit.org/show_bug.cgi?id=183672
1593         <rdar://problem/38510839>
1594
1595         Reviewed by Eric Carlson.
1596
1597         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
1598         * WebProcess/com.apple.WebProcess.sb.in:
1599
1600 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
1601
1602         REGRESSION(r229484): Plugins often require CGS Connections to draw
1603         https://bugs.webkit.org/show_bug.cgi?id=183663
1604         <rdar://problem/38439218>
1605
1606         Reviewed by Per Arne Vollan.
1607
1608         Flash requires an active CGSConnection to work properly. Since we don't want the WebContent
1609         process to have on, create a new plugin process-specific layer host creation method that
1610         gives this access.
1611
1612         * Platform/mac/LayerHostingContext.h:
1613         * Platform/mac/LayerHostingContext.mm:
1614         (WebKit::LayerHostingContext::createForExternalPluginHostingProcess): Added.
1615         * PluginProcess/mac/PluginControllerProxyMac.mm:
1616         (WebKit::PluginControllerProxy::updateLayerHostingContext): Use the new creation
1617         method.
1618
1619 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
1620
1621         [TexMap] Remove TextureMapperLayer::texture()
1622         https://bugs.webkit.org/show_bug.cgi?id=183635
1623
1624         Reviewed by Michael Catanzaro.
1625
1626         Remove the CoordinatedBackingStore::texture() override since the virtual
1627         method is also being removed.
1628
1629         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1630         (WebKit::CoordinatedBackingStore::texture const): Deleted.
1631         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
1632
1633 2018-03-14  John Wilander  <wilander@apple.com>
1634
1635         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
1636         https://bugs.webkit.org/show_bug.cgi?id=183641
1637         <rdar://problem/38469497>
1638
1639         Reviewed by Brent Fulgham and Chris Dumez.
1640
1641         This change is to stabilize existing layout tests by removing
1642         all storage access entries on a call to 
1643         WebResourceLoadStatisticsStore::clearInMemory().
1644         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
1645
1646         Almost all of the code changes are piping to get this
1647         call from the WebResourceLoadStatisticsStore to
1648         WebCore::NetworkStorageSession where entries reside.
1649
1650         * NetworkProcess/NetworkProcess.cpp:
1651         (WebKit::NetworkProcess::removeAllStorageAccess):
1652         * NetworkProcess/NetworkProcess.h:
1653         * NetworkProcess/NetworkProcess.messages.in:
1654         * UIProcess/Network/NetworkProcessProxy.cpp:
1655         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
1656         * UIProcess/Network/NetworkProcessProxy.h:
1657         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1658         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1659         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
1660         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
1661             Now also clears all storage access entries in the network process.
1662         * UIProcess/WebResourceLoadStatisticsStore.h:
1663         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1664         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
1665         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1666         * UIProcess/WebsiteData/WebsiteDataStore.h:
1667
1668 2018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
1669
1670         Unreviewed, rolling out r229613.
1671
1672         Caused API test failures
1673
1674         Reverted changeset:
1675
1676         "Make policy decisions asynchronous"
1677         https://bugs.webkit.org/show_bug.cgi?id=180568
1678         https://trac.webkit.org/changeset/229613
1679
1680 2018-03-14  Chris Dumez  <cdumez@apple.com>
1681
1682         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
1683         https://bugs.webkit.org/show_bug.cgi?id=183626
1684
1685         Reviewed by Youenn Fablet.
1686
1687         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving
1688         towards having multiple context connections.
1689
1690         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1691         (WebKit::WebSWServerConnection::startFetch):
1692         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
1693
1694 2018-03-14  Chris Dumez  <cdumez@apple.com>
1695
1696         Make policy decisions asynchronous
1697         https://bugs.webkit.org/show_bug.cgi?id=180568
1698         <rdar://problem/37131297>
1699
1700         Reviewed by Alex Christensen.
1701
1702         Get rid of synchronous IPC and synchronous code paths for policy delegates.
1703         Policy decisions are now all made asynchronously and rely on asynchronous
1704         IPC.
1705
1706         This code change is based on work by Alex Christensen.
1707
1708         * UIProcess/WebPageProxy.cpp:
1709         (WebKit::WebPageProxy::receivedPolicyDecision):
1710         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1711         (WebKit::WebPageProxy::decidePolicyForResponse):
1712         * UIProcess/WebPageProxy.h:
1713         * UIProcess/WebPageProxy.messages.in:
1714         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1715         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1716         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1717
1718 2018-03-14  Chris Dumez  <cdumez@apple.com>
1719
1720         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
1721         https://bugs.webkit.org/show_bug.cgi?id=183624
1722
1723         Reviewed by Youenn Fablet.
1724
1725         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
1726         since it was going through all SWServers. Calling workerContextProcessConnectionCreated()
1727         on every StorageToWebProcessConnection was thus doing redundant work.
1728
1729         * StorageProcess/StorageProcess.cpp:
1730         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1731         * StorageProcess/StorageToWebProcessConnection.cpp:
1732         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
1733         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated): Deleted.
1734         * StorageProcess/StorageToWebProcessConnection.h:
1735
1736 2018-03-14  Tim Horton  <timothy_horton@apple.com>
1737
1738         Fix the build after r229567
1739
1740         * Configurations/FeatureDefines.xcconfig:
1741
1742 2018-03-13  John Wilander  <wilander@apple.com>
1743
1744         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
1745         https://bugs.webkit.org/show_bug.cgi?id=183620
1746         <rdar://problem/38431469>
1747
1748         Reviewed by Brent Fulgham.
1749
1750         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
1751         wasn't enough to address the compatibility issues with popups. Some of
1752         them just detect their unpartitioned cookies, auto-dismiss themselves,
1753         and expect their unpartitioned cookies to be available under the opener
1754         afterwards. We should grant them access if the popup's domain has had
1755         user interaction _previously_.
1756
1757         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
1758         because if the popup's domain has not received user interaction
1759         previously, we will not grant it storage access on just the window open.
1760
1761         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1762         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
1763         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener): Deleted.
1764             Renamed WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener()
1765             to WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
1766             since there is now a case where access will not be granted, i.e. when
1767             the popup domain has not had user interaction previously.
1768         * UIProcess/WebResourceLoadStatisticsStore.h:
1769         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1770              Similar renaming.
1771         * WebProcess/WebProcess.cpp:
1772         (WebProcess::WebProcess):
1773              Similar renaming.
1774
1775 2018-03-13  Jer Noble  <jer.noble@apple.com>
1776
1777         Add missing artwork for fullscreen mode.
1778         https://bugs.webkit.org/show_bug.cgi?id=183618
1779
1780         Reviewed by Jon Lee.
1781
1782         * Resources/ios/iOS.xcassets/Done.imageset/Contents.json: Added.
1783         * Resources/ios/iOS.xcassets/Done.imageset/Done.pdf: Added.
1784         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/Contents.json: Added.
1785         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png: Added.
1786         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png: Added.
1787         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png: Added.
1788         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/Contents.json: Added.
1789         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png: Added.
1790         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png: Added.
1791         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png: Added.
1792
1793 2018-03-13  Brian Burg  <bburg@apple.com>
1794
1795         [WK2] Web Inspector: NavigationAction for opening a link in a new tab should have a UserGestureIndicator
1796         https://bugs.webkit.org/show_bug.cgi?id=183612
1797         <rdar://problem/38388641>
1798
1799         Reviewed by Timothy Hatcher.
1800
1801         The current gesture token will be attached to the NavigationAction at construction time,
1802         so set up a UserGestureIndicator when creating the action and sending it out.
1803
1804         * WebProcess/WebPage/WebInspector.cpp:
1805         (WebKit::WebInspector::openInNewTab):
1806
1807 2018-03-13  Dean Jackson  <dino@apple.com>
1808
1809         WKSystemPreviewView needs to implement some of UIScrollViewDelegate
1810         https://bugs.webkit.org/show_bug.cgi?id=183607
1811         <rdar://problem/38427622>
1812
1813         Reviewed by Antoine Quint.
1814
1815         Add an empty implementation of scrollViewDidScroll.
1816
1817         * UIProcess/ios/WKSystemPreviewView.mm:
1818         (-[WKSystemPreviewView scrollViewDidScroll:]):
1819
1820 2018-03-13  Jiewen Tan  <jiewen_tan@apple.com>
1821
1822         Soft-link LocalAuthentication.Framework
1823         https://bugs.webkit.org/show_bug.cgi?id=183587
1824         <rdar://problem/38219763>
1825
1826         Reviewed by Brian Burg.
1827
1828         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm:
1829         (WebKit::WebCredentialsMessengerProxy::platformIsUserVerifyingPlatformAuthenticatorAvailable):
1830         * WebKit.xcodeproj/project.pbxproj:
1831
1832 2018-03-12  Dean Jackson  <dino@apple.com>
1833
1834         Add a WKWebViewContentProvider for system previews
1835         https://bugs.webkit.org/show_bug.cgi?id=183582
1836         <rdar://problem/38393569>
1837
1838         Reviewed by Tim Horton.
1839
1840         Implement WKSystemPreviewView, which conforms to WKWebViewContentProvider, in
1841         order to view content as a "system preview". This effectively replaces the
1842         SystemPreviewController, which will be removed soon.
1843
1844         Some of the required methods of WKWebViewContentProvider are not necessary on
1845         this instance, so a follow-up patch will clean the protocol up a bit.
1846
1847         * UIProcess/Cocoa/NavigationState.mm: Don't trigger a SystemPreview when downloading.
1848         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
1849
1850         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1851         (-[WKWebViewContentProviderRegistry init]): Register the WKSystemPreviewView for
1852         MIME types retrieved from WebKitAdditions.
1853
1854         * UIProcess/ios/WKSystemPreviewView.h: Added.
1855         * UIProcess/ios/WKSystemPreviewView.mm: Added.
1856
1857         (-[WKSystemPreviewView web_initWithFrame:webView:]):
1858         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): This is the
1859         method that actually creates a QuickLook preview and provides the data.
1860         (-[WKSystemPreviewView web_setMinimumSize:]):
1861         (-[WKSystemPreviewView web_setOverlaidAccessoryViewsInset:]):
1862         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
1863         (-[WKSystemPreviewView web_setFixedOverlayView:]):
1864         (-[WKSystemPreviewView web_didSameDocumentNavigation:]):
1865         (-[WKSystemPreviewView web_countStringMatches:options:maxCount:]):
1866         (-[WKSystemPreviewView web_findString:options:maxCount:]):
1867         (-[WKSystemPreviewView web_hideFindUI]):
1868
1869         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): QuickLook delegates.
1870         (-[WKSystemPreviewView previewController:previewItemAtIndex:]):
1871         (-[WKSystemPreviewView provideDataForItem:]):
1872         (-[WKSystemPreviewView previewControllerWillDismiss:]):
1873
1874         * WebKit.xcodeproj/project.pbxproj: Add new files.
1875
1876 2018-03-12  John Wilander  <wilander@apple.com>
1877
1878         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
1879         https://bugs.webkit.org/show_bug.cgi?id=183577
1880         <rdar://problem/38266987>
1881
1882         Reviewed by Brent Fulgham.
1883
1884         * NetworkProcess/NetworkProcess.cpp:
1885         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1886             Now also checks for general page access.
1887         (WebKit::NetworkProcess::grantStorageAccess):
1888             Renamed from grantStorageAccessForFrame since the frameID now is optional.
1889         (WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
1890             Renamed since the frameID now is optional.
1891         * NetworkProcess/NetworkProcess.h:
1892             Renaming since the frameID now is optional.
1893         * NetworkProcess/NetworkProcess.messages.in:
1894             Renaming since the frameID now is optional.
1895         * NetworkProcess/NetworkResourceLoader.cpp:
1896         (WebKit::NetworkResourceLoader::logCookieInformation):
1897             Consequence of function renaming.
1898         * UIProcess/Network/NetworkProcessProxy.cpp:
1899         (WebKit::NetworkProcessProxy::grantStorageAccess):
1900         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
1901             Renaming since the frameID now is optional.
1902         * UIProcess/Network/NetworkProcessProxy.h:
1903         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1904         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1905             Renaming since the frameID now is optional.
1906         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1907             Handler renaming since the frameID now is optional.
1908         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
1909             New function for that grants cookie access under a whole page.
1910         * UIProcess/WebResourceLoadStatisticsStore.h:
1911             Member renaming since the frameID now is optional.
1912         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
1913             New message received straight from WebCore::ResourceLoadObserver.
1914         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1915         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
1916             Renamed and made frameID optional.
1917         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1918             Consequence of renaming and making frameID optional.
1919         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
1920             Renamed and made frameID optional.
1921         * UIProcess/WebsiteData/WebsiteDataStore.h:
1922         * WebProcess/WebProcess.cpp:
1923         (WebProcess::WebProcess):
1924             Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
1925             WebCore::ResourceLoadObserver.
1926
1927 2018-03-12  Tim Horton  <timothy_horton@apple.com>
1928
1929         Stop using SDK conditionals to control feature definitions
1930         https://bugs.webkit.org/show_bug.cgi?id=183430
1931         <rdar://problem/38251619>
1932
1933         Reviewed by Dan Bernstein.
1934
1935         * Configurations/FeatureDefines.xcconfig:
1936         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
1937
1938 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
1939
1940         Runtime flag for link prefetch and remove link subresource.
1941         https://bugs.webkit.org/show_bug.cgi?id=183540
1942
1943         Reviewed by Chris Dumez.
1944
1945         Remove the LINK_PREFETCH build time flag.
1946
1947         * Configurations/FeatureDefines.xcconfig:
1948         * WebProcess/Network/WebLoaderStrategy.cpp:
1949         (WebKit::maximumBufferingTime):
1950
1951 2018-03-12  Chris Dumez  <cdumez@apple.com>
1952
1953         Load may get committed before receiving policy for the resource response
1954         https://bugs.webkit.org/show_bug.cgi?id=183579
1955         <rdar://problem/38268780>
1956
1957         Reviewed by Youenn Fablet.
1958
1959         r228852 updated WebResourceLoader::didReceiveResponse to only send the
1960         ContinueDidReceiveResponse IPC back to the Networkprocess *after* the
1961         policy decision for the resource response has been made. This is necessary
1962         now that policy decisions can be made asynchronously.
1963
1964         However, one of the 2 code paths in NetworkProcess side (code path when
1965         the resource is already in the HTTP disk cache) failed to wait for the
1966         ContinueDidReceiveResponse IPC before sending over the data to the WebProcess.
1967         As a result, the WebProcess could commit the load before even receiving the
1968         policy response from the client.        
1969
1970         * NetworkProcess/NetworkResourceLoader.cpp:
1971         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
1972         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1973         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
1974         * NetworkProcess/NetworkResourceLoader.h:
1975         Make sure NetworkResourceLoader::didRetrieveCacheEntry() does not start sending the data
1976         until the network process gets the ContinueDidReceiveResponse IPC back from the WebProcess.
1977
1978         * WebProcess/Network/WebResourceLoader.cpp:
1979         (WebKit::WebResourceLoader::didReceiveResponse):
1980         (WebKit::WebResourceLoader::didReceiveData):
1981         * WebProcess/Network/WebResourceLoader.h:
1982         Add assertion to make sure didReceiveData() never gets called before didReceiveResponse's
1983         completion handler has been called. If this hits, then the load may get committed even
1984         though the client did not reply to the policy for the resource response yet.
1985
1986 2018-03-12  Ali Juma  <ajuma@chromium.org>
1987
1988         http/tests/workers/service/service-worker-download.https.html times out with async policy delegates
1989         https://bugs.webkit.org/show_bug.cgi?id=183479
1990
1991         Reviewed by Youenn Fablet.
1992
1993         Ensure that ServiceWorkerFetchClient::m_isCheckingResponse is set before code that depends on it
1994         executes. This bit was set by code that's posted to the runloop using 'callOnMainThread' in
1995         ServiceWorkerFetchClient::didReceiveResponse. But when didReceiveResponse is executing, tasks for
1996         handling didReceiveData, didFail, or didFinish may already have been posted to the runloop, and in
1997         that case would execute before m_isCheckingResponse gets set, and then incorrectly fail to 
1998         early-out. Fix this by directly setting m_isCheckingResponse in didReceiveResponse.
1999
2000         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2001         (WebKit::ServiceWorkerClientFetch::start):
2002         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2003
2004 2018-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2005
2006         REGRESSION(r211643): Dismissing WKActionSheet should not also dismiss its presenting view controller
2007         https://bugs.webkit.org/show_bug.cgi?id=183549
2008         <rdar://problem/34960698>
2009
2010         Reviewed by Andy Estes.
2011
2012         Fixes the bug by dismissing the presented view controller (i.e. the action sheet or the view controller being
2013         presented during rotation) rather than the presenting view controller.
2014
2015         Test: ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
2016
2017         * UIProcess/ios/WKActionSheet.mm:
2018         (-[WKActionSheet doneWithSheet:]):
2019
2020 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
2021
2022         Remove GridLayout runtime flag
2023         https://bugs.webkit.org/show_bug.cgi?id=183484
2024
2025         Reviewed by Myles C. Maxfield.
2026
2027         The Grid Layout feature has been enabled by default for almost a
2028         year, so I think it's time to remove the runtime flag and the
2029         codepath run when the feature is disabled.
2030
2031         * Shared/WebPreferences.yaml:
2032         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2033         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2034
2035 2018-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2036
2037         Fix the internal iOS build after r229512
2038         https://bugs.webkit.org/show_bug.cgi?id=183550
2039
2040         Reviewed by Zalan Bujtas.
2041
2042         Fixes a typo in a header import, as well as a nullability error. `SecTrustEvaluate()` takes in a nonnull outparam,
2043         which was removed in r229512; this adds the outparam back, but does not consult its value when setting the
2044         `infoDictionary`.
2045
2046         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2047         (-[WKFullScreenWindowController _EVOrganizationName]):
2048
2049 2018-03-10  Jer Noble  <jer.noble@apple.com>
2050
2051         Improvements to fullscreen; new UI and security features
2052         https://bugs.webkit.org/show_bug.cgi?id=183503
2053
2054         Reviewed by Dean Jackson.
2055
2056         Now that the iOS Fullscreen code has more than one major class, move it into an ios/
2057         directory.
2058
2059         Clean up the WKFullScreenWindowControllerIOS class to more clearly separate external
2060         facing API from purely internal functions.
2061
2062         Move the WKFullScreenViewController out into its own file. Add support for fullscreen
2063         top inset and fullscreen autohide duration CSS constants.
2064
2065         Add a heuristic to distinguish between media control related touches and ones that look
2066         more keyboard interactions.
2067
2068         Add a new UIStackView based control to hold the fullscreen controls.
2069
2070         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Removed.
2071         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp: Added.
2072         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
2073         (WebKit::FullscreenTouchSecheuristic::reset):
2074         (WebKit::FullscreenTouchSecheuristic::distanceScore):
2075         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
2076         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h: 
2077         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
2078         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
2079         (WebKit::FullscreenTouchSecheuristic::setXWeight):
2080         (WebKit::FullscreenTouchSecheuristic::setYWeight):
2081         (WebKit::FullscreenTouchSecheuristic::setSize):
2082         (WebKit::FullscreenTouchSecheuristic::setGamma):
2083         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
2084         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
2085         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: Added.
2086         (WKFullScreenViewControllerPlaybackSessionModelClient::setParent):
2087         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
2088         (-[_WKExtrinsicButton setExtrinsicContentSize:]):
2089         (-[_WKExtrinsicButton intrinsicContentSize]):
2090         (-[WKFullScreenViewController initWithWebView:]):
2091         (-[WKFullScreenViewController dealloc]):
2092         (-[WKFullScreenViewController showUI]):
2093         (-[WKFullScreenViewController hideUI]):
2094         (-[WKFullScreenViewController videoControlsManagerDidChange]):
2095         (-[WKFullScreenViewController setPrefersStatusBarHidden:]):
2096         (-[WKFullScreenViewController setPlaying:]):
2097         (-[WKFullScreenViewController setPictureInPictureActive:]):
2098         (-[WKFullScreenViewController loadView]):
2099         (-[WKFullScreenViewController viewWillAppear:]):
2100         (-[WKFullScreenViewController viewDidLayoutSubviews]):
2101         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
2102         (-[WKFullScreenViewController preferredStatusBarStyle]):
2103         (-[WKFullScreenViewController prefersStatusBarHidden]):
2104         (-[WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2105         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
2106         (-[WKFullScreenViewController _manager]):
2107         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
2108         (-[WKFullScreenViewController _cancelAction:]):
2109         (-[WKFullScreenViewController _togglePiPAction:]):
2110         (-[WKFullScreenViewController _touchDetected:]):
2111         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
2112         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
2113         (-[WKFullScreenViewController _showPhishingAlert]):
2114         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
2115         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: Added.
2116         (WebKit::replaceViewWithView):
2117         (WebKit::WKWebViewState::applyTo):
2118         (WebKit::WKWebViewState::store):
2119         (-[WKFullscreenAnimationController transitionDuration:]):
2120         (-[WKFullscreenAnimationController configureInitialAndFinalStatesForTransition:]):
2121         (-[WKFullscreenAnimationController animateTransition:]):
2122         (-[WKFullscreenAnimationController animationEnded:]):
2123         (-[WKFullscreenAnimationController startInteractiveTransition:]):
2124         (-[WKFullscreenAnimationController updateWithPercent:]):
2125         (-[WKFullscreenAnimationController updateWithPercent:translation:anchor:]):
2126         (-[WKFullscreenAnimationController end:]):
2127         (-[WKFullScreenInteractiveTransition initWithAnimator:anchor:]):
2128         (-[WKFullScreenInteractiveTransition wantsInteractiveStart]):
2129         (-[WKFullScreenInteractiveTransition startInteractiveTransition:]):
2130         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withTranslation:]):
2131         (-[WKFullScreenInteractiveTransition cancelInteractiveTransition]):
2132         (-[WKFullScreenInteractiveTransition finishInteractiveTransition]):
2133         (-[WKFullScreenWindowController initWithWebView:]):
2134         (-[WKFullScreenWindowController dealloc]):
2135         (-[WKFullScreenWindowController isFullScreen]):
2136         (-[WKFullScreenWindowController webViewPlaceholder]):
2137         (-[WKFullScreenWindowController enterFullScreen]):
2138         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2139         (-[WKFullScreenWindowController requestExitFullScreen]):
2140         (-[WKFullScreenWindowController exitFullScreen]):
2141         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2142         (-[WKFullScreenWindowController _completedExitFullScreen]):
2143         (-[WKFullScreenWindowController close]):
2144         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
2145         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
2146         (-[WKFullScreenWindowController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
2147         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
2148         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
2149         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
2150         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
2151         (-[WKFullScreenWindowController _invalidateEVOrganizationName]):
2152         (-[WKFullScreenWindowController _isSecure]):
2153         (-[WKFullScreenWindowController _serverTrust]):
2154         (-[WKFullScreenWindowController _EVOrganizationName]):
2155         (-[WKFullScreenWindowController _updateLocationInfo]):
2156         (-[WKFullScreenWindowController _manager]):
2157         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
2158         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
2159         * UIProcess/ios/fullscreen/WKFullscreenStackView.h: Renamed from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
2160         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Added.
2161         (+[WKFullscreenStackView baseEffects]):
2162         (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]):
2163         (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]):
2164         (+[WKFullscreenStackView secondaryMaterialOverlayView]):
2165         (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]):
2166         (+[WKFullscreenStackView applySecondaryGlyphTintToView:]):
2167         (-[WKFullscreenStackView initWithArrangedSubviews:axis:]):
2168         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
2169         (-[WKFullscreenStackView contentView]):
2170         (-[WKFullscreenStackView _setArrangedSubviews:axis:]):
2171         (-[WKFullscreenStackView setBounds:]):
2172         (-[WKFullscreenStackView updateConstraints]):
2173         * WebKit.xcodeproj/project.pbxproj:
2174
2175 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
2176
2177         Media query for default appearance
2178         https://bugs.webkit.org/show_bug.cgi?id=183539
2179         <rdar://problem/38326388>
2180
2181         Reviewed by Tim Horton.
2182
2183         Write a media query to evaluate appearance.
2184
2185         * Shared/WebPageCreationParameters.cpp:
2186         (WebKit::WebPageCreationParameters::encode const):
2187         (WebKit::WebPageCreationParameters::decode):
2188         * Shared/WebPageCreationParameters.h:
2189         * UIProcess/API/Cocoa/WKWebView.mm:
2190         (-[WKWebView _initializeWithConfiguration:]):
2191         (-[WKWebView _setUseSystemAppearance:]):
2192         * UIProcess/WebPageProxy.cpp:
2193         (WebKit::WebPageProxy::creationParameters):
2194         (WebKit::WebPageProxy::setDefaultAppearance):
2195         * UIProcess/WebPageProxy.h:
2196         (WebKit::WebPageProxy::defaultAppearance const):
2197         * WebProcess/WebPage/WebPage.cpp:
2198         (WebKit::m_credentialsMessenger):
2199         (WebKit::WebPage::setDefaultAppearance):
2200         * WebProcess/WebPage/WebPage.h:
2201         * WebProcess/WebPage/WebPage.messages.in:
2202
2203 2018-03-09  Jer Noble  <jer.noble@apple.com>
2204
2205         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
2206         https://bugs.webkit.org/show_bug.cgi?id=183501
2207         <rdar://problem/38312038>
2208
2209         Unreviewed build fix; add correct pragmas to code referencing m_playbackSessionManager.
2210
2211         * UIProcess/WebPageProxy.cpp:
2212         (WebKit::WebPageProxy::hasActiveVideoForControlsManager const):
2213         (WebKit::WebPageProxy::requestControlledElementID const):
2214         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
2215
2216 2018-03-09  Brian Burg  <bburg@apple.com>
2217
2218         Web Inspector: there should only be one way for async backend commands to send failure
2219         https://bugs.webkit.org/show_bug.cgi?id=183524
2220
2221         Reviewed by Timothy Hatcher.
2222
2223         Remove useless ErrorString argument from async commands.
2224
2225         For Automation protocol, introduce sync and async macros for filling
2226         in and sending a failure response. Now that async commands don't have
2227         an ErrorString and sync commands don't have a callback, trying to send
2228         an error with the wrong macro is a compile-time error.
2229
2230         * UIProcess/Automation/WebAutomationSession.cpp:
2231         (WebKit::WebAutomationSession::getBrowsingContexts):
2232         (WebKit::WebAutomationSession::getBrowsingContext):
2233         (WebKit::WebAutomationSession::createBrowsingContext):
2234         (WebKit::WebAutomationSession::closeBrowsingContext):
2235         (WebKit::WebAutomationSession::switchToBrowsingContext):
2236         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
2237         (WebKit::WebAutomationSession::waitForNavigationToComplete):
2238         (WebKit::WebAutomationSession::navigateBrowsingContext):
2239         (WebKit::WebAutomationSession::goBackInBrowsingContext):
2240         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
2241         (WebKit::WebAutomationSession::reloadBrowsingContext):
2242         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
2243         (WebKit::WebAutomationSession::resolveChildFrameHandle):
2244         (WebKit::WebAutomationSession::resolveParentFrameHandle):
2245         (WebKit::WebAutomationSession::computeElementLayout):
2246         (WebKit::WebAutomationSession::selectOptionElement):
2247         (WebKit::WebAutomationSession::isShowingJavaScriptDialog):
2248         (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
2249         (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
2250         (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog):
2251         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
2252         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
2253         (WebKit::WebAutomationSession::getAllCookies):
2254         (WebKit::WebAutomationSession::deleteSingleCookie):
2255         (WebKit::WebAutomationSession::addSingleCookie):
2256         (WebKit::WebAutomationSession::deleteAllCookies):
2257         (WebKit::WebAutomationSession::setSessionPermissions):
2258         (WebKit::WebAutomationSession::performMouseInteraction):
2259         (WebKit::WebAutomationSession::performKeyboardInteractions):
2260         (WebKit::WebAutomationSession::takeScreenshot):
2261         (WebKit::WebAutomationSession::didTakeScreenshot):
2262         * UIProcess/Automation/WebAutomationSession.h:
2263         * UIProcess/Automation/WebAutomationSessionMacros.h:
2264         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2265         (WebKit::WebAutomationSession::inspectBrowsingContext):
2266
2267 2018-03-09  Jer Noble  <jer.noble@apple.com>
2268
2269         Don't pass NULL to the result parameter of SecTrustEvaluate()
2270         https://bugs.webkit.org/show_bug.cgi?id=183495
2271         <rdar://problem/38185688>
2272
2273         Reviewed by Andy Estes.
2274
2275         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2276         (-[WKFullScreenWindowController _EVOrganizationName]):
2277
2278 2018-03-09  Dean Jackson  <dino@apple.com>
2279
2280         Allow NavigationState to intercept requests and send them to SystemPreviewController
2281         https://bugs.webkit.org/show_bug.cgi?id=183526
2282         <rdar://problem/37801140>
2283
2284         Reviewed by Tim Horton.
2285
2286         Implement a bit more of SystemPreviewController, such that it can be used
2287         from NavigationState to identify and handle content that can be previewed.
2288
2289         * UIProcess/Cocoa/NavigationState.mm:
2290         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
2291             If we'd in a download response policy, then check if SystemPreviewController
2292             can show the content. We ignore the download, but pass the original URL onto
2293             the preview. Ultimately, we'd want to avoid the navigation
2294             but use the download destination URL for preview.
2295
2296         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2297         (-[_WKPreviewControllerDataSource initWithURL:]):
2298             Move the URL to property, to help use a single datasource object for all previews.
2299         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2300         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]):
2301             Add a delegate object, so we can detect when the preview is dismissed and return
2302             to the previous page.
2303         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]):
2304         (WebKit::SystemPreviewController::showPreview):
2305             Use single instances of the QLPreviewController, its datasource and delegate.
2306
2307         * UIProcess/SystemPreviewController.cpp:
2308             Add a helper to navigate back.
2309         (WebKit::SystemPreviewController::SystemPreviewController):
2310         (WebKit::SystemPreviewController::sendPageBack):
2311         * UIProcess/SystemPreviewController.h:
2312
2313 2018-03-09  Jer Noble  <jer.noble@apple.com>
2314
2315         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
2316         https://bugs.webkit.org/show_bug.cgi?id=183383
2317         <rdar://problem/38197028>
2318
2319         Reviewed by Eric Carlson.
2320
2321         Follow-up patch: now that the 'fullscreenchange' event is being fired slightly earlier, the
2322         Fullscreen.TopContentInset tests triggers what appears to be an existing behavior: if you
2323         exit in the middle of an enter fullscreen animation, the exit never happens, because the
2324         NSWindow never starts the exit animation. The solution is to store the exit fullscreen
2325         request, and only act upon it when the enter animation completes.
2326
2327         * UIProcess/mac/WKFullScreenWindowController.h:
2328         * UIProcess/mac/WKFullScreenWindowController.mm:
2329         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
2330         (-[WKFullScreenWindowController exitFullScreen]):
2331
2332 2018-03-09  Jer Noble  <jer.noble@apple.com>
2333
2334         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
2335         https://bugs.webkit.org/show_bug.cgi?id=183501
2336
2337         Reviewed by Eric Carlson.
2338
2339         No reason for these methods to be PLATFORM(MAC) only.
2340
2341         * UIProcess/API/Cocoa/WKWebView.mm:
2342         (-[WKWebView _videoControlsManagerDidChange]):
2343         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2344         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2345         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
2346         (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
2347         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2348         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2349         * UIProcess/PageClient.h:
2350         * UIProcess/WebPageProxy.cpp:
2351         (WebKit::WebPageProxy::isPlayingMediaDidChange):
2352         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
2353         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
2354         * UIProcess/WebPageProxy.h:
2355         * UIProcess/ios/PageClientImplIOS.h:
2356         * UIProcess/ios/PageClientImplIOS.mm:
2357         (WebKit::PageClientImpl::videoControlsManagerDidChange):
2358         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
2359         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2360         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
2361         * WebProcess/cocoa/PlaybackSessionManager.mm:
2362         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
2363
2364 2018-03-09  Per Arne Vollan  <pvollan@apple.com>
2365
2366         Create CA layer contexts with +remoteContextWithOptions.
2367         https://bugs.webkit.org/show_bug.cgi?id=182747
2368
2369         Reviewed by Brent Fulgham.
2370
2371         CA layer contexts (CAContext) are currently created with +contextWithCGSConnection, which is
2372         using the main WindowServer connection to create the context. Instead, the contexts can be
2373         created with +remoteContextWithOptions, which does not use the main WindowServer connection.
2374         This is a step towards limiting the access the WebContent process has to the window server.
2375         To make the +remoteContextWithOptions call succeed, the sandbox has to be modified to allow
2376         access to CARenderServer. Also, access to the WindowServer should be denied by calling
2377         CGSSetDenyWindowServerConnections(true) before entering the sandbox. This is planned to do
2378         in a follow-up patch. The call to +remoteContextWithOptions will open up WindowServer
2379         connections, since the WindowServer is the system default CA render server, but these
2380         connections come with limited WindowServer exposure. In addition, we need to open up the
2381         sandbox for accessing some IOKit properties.
2382
2383         * Platform/mac/LayerHostingContext.mm:
2384         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2385         * Shared/mac/HangDetectionDisablerMac.mm:
2386         (WebKit::setClientsMayIgnoreEvents):
2387         * WebProcess/com.apple.WebProcess.sb.in:
2388
2389 2018-03-09  Brent Fulgham  <bfulgham@apple.com>
2390
2391         Remove cookie API access from WebContent Process
2392         https://bugs.webkit.org/show_bug.cgi?id=183519
2393         <rdar://problem/35368802>
2394
2395         Reviewed by Alex Christensen.
2396
2397         All cookie access is now handled in the Network Process. However, there are vestiges of the original logic that used CFNetwork APIs in the WebContent process.
2398
2399         This patch removes CFNetwork calls from the WebProcess code paths, since they serve no purpose in modern WebKit.
2400
2401         No tests because this is a code cleanup with no expected change in behavior.
2402
2403         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2404         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Moved from WebFrameNetworkingContext.
2405         * NetworkProcess/NetworkProcess.h:
2406         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2407         (WebKit::NetworkProcess::setSharedHTTPCookieStorage): Moved from ChildProcess, since this should only be
2408         called in the NetworkProcess.
2409         * Shared/ChildProcess.h:
2410         * Shared/mac/ChildProcessMac.mm:
2411         (WebKit::ChildProcess::setSharedHTTPCookieStorage): Deleted.
2412         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
2413         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
2414         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Remove CFNetwork code. This version of
2415         'ensureWebsiteDataStoreSession' is needed to maintain a dictionary on the WebProcess side so we can refer to
2416         the same network session in both the WebContent and Network processes.
2417         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
2418         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
2419         * WebProcess/cocoa/WebProcessCocoa.mm:
2420         (WebKit::WebProcess::platformInitializeWebProcess): Remove calls to CFNetwork.
2421
2422 2018-03-09  Youenn Fablet  <youenn@apple.com>
2423
2424         ServiceWorkerClientFetch should send data to its resource loader once the didReceiveResponse completion handler is called
2425         https://bugs.webkit.org/show_bug.cgi?id=183110
2426
2427         Reviewed by Chris Dumez.
2428
2429         Buffering data/finish event/fail event until the response completion handler is called.
2430
2431         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2432         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
2433         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2434         (WebKit::ServiceWorkerClientFetch::didFinish):
2435         (WebKit::ServiceWorkerClientFetch::didFail):
2436         (WebKit::ServiceWorkerClientFetch::didNotHandle):
2437         (WebKit::ServiceWorkerClientFetch::cancel):
2438         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
2439         * WebProcess/Storage/ServiceWorkerClientFetch.h:
2440
2441 2018-03-09  Jer Noble  <jer.noble@apple.com>
2442
2443         Add new CSS env constants for use with fullscreen
2444         https://bugs.webkit.org/show_bug.cgi?id=183498
2445
2446         Reviewed by Dean Jackson.
2447
2448         Pass the values given to WebFullScreenManagerProxy through the process boundary and
2449         into WebCore.
2450
2451         * UIProcess/WebFullScreenManagerProxy.cpp:
2452         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop):
2453         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay):
2454         * UIProcess/WebFullScreenManagerProxy.h:
2455         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2456         (WebKit::WebFullScreenManager::didExitFullScreen):
2457         (WebKit::WebFullScreenManager::setFullscreenInsetTop):
2458         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay):
2459         * WebProcess/FullScreen/WebFullScreenManager.h:
2460         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
2461
2462 2018-03-09  Jer Noble  <jer.noble@apple.com>
2463
2464         Add isPictureInPictureActive messaging across WebKit process boundary
2465         https://bugs.webkit.org/show_bug.cgi?id=183499
2466
2467         Reviewed by Eric Carlson.
2468
2469         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
2470         * UIProcess/Cocoa/PlaybackSessionManagerProxy.messages.in:
2471         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
2472         (WebKit::PlaybackSessionModelContext::pictureInPictureActiveChanged):
2473         (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged):
2474
2475 2018-03-09  Stephan Szabo  <stephan.szabo@sony.com>
2476
2477         Add guard for wtf/glib include
2478         https://bugs.webkit.org/show_bug.cgi?id=183521
2479
2480         Reviewed by Alex Christensen.
2481
2482         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
2483
2484 2018-03-09  Andy Estes  <aestes@apple.com>
2485
2486         [Mac] WebKit fails to receive file promises when the embedding app is sandboxed
2487         https://bugs.webkit.org/show_bug.cgi?id=183489
2488         <rdar://problem/38267517>
2489
2490         WebKit calls -[NSFilePromiseReceiver receivePromisedFilesAtDestination:...] with
2491         NSTemporaryDirectory() as the destination for receiving file promise drops. AppKit attempts
2492         to issue a sandbox extension for this directory, but for security reasons App Sandbox
2493         refuses to do so for NSTemporaryDirectory() itself. As a result, AppKit will call our reader
2494         block with a nil error and a valid file URL, but no file will actually exist at that URL.
2495
2496         In order for App Sandbox to grant issuing the sandbox extension needed by AppKit, we need to
2497         use some other destination directory. This patch uses FileSystem::createTemporaryDirectory()
2498         to securely create a unique temporary directory inside NSTemporaryDirectory() for use as the
2499         drop destination.
2500
2501         Reviewed by Wenson Hsieh.
2502
2503         * UIProcess/Cocoa/WebViewImpl.mm:
2504         (WebKit::WebViewImpl::performDragOperation):
2505
2506 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2507
2508         [GTK] Do not use WebKitDOMHTMLFormElement as argument of signal WebKitWebPage::will-submit-form
2509         https://bugs.webkit.org/show_bug.cgi?id=183510
2510
2511         Reviewed by Michael Catanzaro.
2512
2513         In 2.22 WebKitDOMHTMLFormElement will be deprecated in GTK+ port and won't still exist in WPE. The new
2514         JavaScript GLib API will be used to replace most of the DOM API, but a few classes will remain with a minimal
2515         API for things that can't be done with JavaScript. WebKitDOMElement will stay and will be added to WPE as well,
2516         so if we change the signal parameter to WebKitDOMElement we will be able to keep using
2517         WebKitWebPage::will-submit-form without any changes. WPE will gain this signal and the rest of the API that uses
2518         DOM.
2519
2520         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
2521         (webkit_web_page_class_init):
2522
2523 2018-03-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2524
2525         Unreviewed. [GTK][WPE] Bump Since tags of resource load stats API.
2526
2527         The functionality hasn't been properly tested to be released in WebKitGTK+ 2.20.
2528
2529         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
2530         (webkit_website_data_manager_class_init):
2531         * UIProcess/API/gtk/WebKitWebsiteData.h:
2532         * UIProcess/API/wpe/WebKitWebsiteData.h:
2533
2534 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
2535
2536         Unreviewed. Suppress GCC warnings in SystemPreviewController.cpp by
2537         using the cross-platform #include directives for header inclusion,
2538         instead of #import.
2539
2540         * UIProcess/SystemPreviewController.cpp:
2541
2542 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
2543
2544         Allow WebViews to disable system appearance
2545         https://bugs.webkit.org/show_bug.cgi?id=183418
2546         <rdar://problem/36975642>
2547
2548         Reviewed by Tim Horton.
2549         
2550         Allow webviews to choose whether or not to follow the default system appearance.
2551
2552         * Shared/WebPageCreationParameters.cpp:
2553         (WebKit::WebPageCreationParameters::encode const):
2554         (WebKit::WebPageCreationParameters::decode):
2555         * Shared/WebPageCreationParameters.h:
2556         * UIProcess/API/Cocoa/WKWebView.mm:
2557         (-[WKWebView _useSystemAppearance]):
2558         (-[WKWebView _setUseSystemAppearance:]):
2559         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2560         * UIProcess/WebPageProxy.cpp:
2561         (WebKit::WebPageProxy::creationParameters):
2562         (WebKit::WebPageProxy::setUseSystemAppearance):
2563         * UIProcess/WebPageProxy.h:
2564         (WebKit::WebPageProxy::useSystemAppearance const):
2565         * WebProcess/WebPage/WebPage.cpp:
2566         (WebKit::WebPage::setUseSystemAppearance):
2567         * WebProcess/WebPage/WebPage.h:
2568         * WebProcess/WebPage/WebPage.messages.in:
2569
2570 2018-03-08  Michael Catanzaro  <mcatanzaro@igalia.com>
2571
2572         Unreviewed, speculative attempt to fix CMake build after r229426
2573         https://bugs.webkit.org/show_bug.cgi?id=183382
2574         <rdar://problem/38191450>
2575
2576         * CMakeLists.txt:
2577
2578 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2579
2580         [Extra zoom mode] Support resigning first responder status when focusing a form control
2581         https://bugs.webkit.org/show_bug.cgi?id=183477
2582         <rdar://problem/38225994>
2583
2584         Reviewed by Tim Horton.
2585
2586         Currently, when presenting an input view controller in extra zoom mode, if the web view loses first responder
2587         status, we will blur the focused element, which dismisses all focused form control UI. For certain types of form
2588         controls, this prevents the user from using key pieces of functionality.
2589
2590         To address this, disconnect the notion of first responder status from DOM element focus while the form control
2591         overlay is shown. Later, when the active input session ends, if the web content view was first responder before
2592         upon focusing the element, restore first responder status on the web view. This extra tweak is needed to ensure
2593         that certain UI affordances which require first responder status on the web view continue to work after
2594         interacting with a form control that changes the first responder.
2595
2596         * UIProcess/ios/WKContentViewInteraction.h:
2597         * UIProcess/ios/WKContentViewInteraction.mm:
2598         (-[WKContentView presentFocusedFormControlViewController:]):
2599         (-[WKContentView dismissFocusedFormControlViewController:]):
2600
2601 2018-03-08  John Wilander  <wilander@apple.com>
2602
2603         Resource Load Statistics: Revert defaults read of zero values
2604         https://bugs.webkit.org/show_bug.cgi?id=183476
2605
2606         Unreviewed revert of three small changes landed in r229427.
2607
2608         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2609         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2610             Reverted back to strict check of greater than zero for defaults reads.
2611
2612 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2613
2614         Don't have SafariServices in minimal simulator build
2615         https://bugs.webkit.org/show_bug.cgi?id=183436
2616         <rdar://problem/38254778>
2617
2618         Reviewed by Dan Bernstein.
2619
2620         * config.h:
2621
2622 2018-03-08  John Wilander  <wilander@apple.com>
2623
2624         Resource Load Statistics: Make debug mode always partition prevalent resources
2625         https://bugs.webkit.org/show_bug.cgi?id=183468
2626         <rdar://problem/38269437>
2627
2628         Reviewed by Brent Fulgham.
2629
2630         After some testing we decided that a 30 second timeout in ITP debug mode just makes
2631         it confusing. We should instead always partition prevalent resources in debug mode
2632         to make it easy to understand. The partitioned state is what developers want to test
2633         anyway.
2634
2635         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
2636         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
2637             Minor change to include 0 as valid setting.
2638         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2639         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
2640             Now just stores the setting of debug mode instead of changing the timeout.
2641         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
2642             Now does not disable partitioning under debug mode.
2643         (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
2644             Now returns true for prevalent resources with user interaction under debug mode.            
2645         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
2646             Removed duplicate debug logging statement.
2647         * UIProcess/WebResourceLoadStatisticsStore.h:
2648             Added member m_debugModeEnabled.
2649
2650 2018-03-08  Brent Fulgham  <bfulgham@apple.com>
2651
2652         Remove WebCookieManager and messaging from WebContent process.
2653         https://bugs.webkit.org/show_bug.cgi?id=183382
2654         <rdar://problem/38191450>
2655
2656         Reviewed by Alex Christensen.
2657
2658         Networking access was fully removed from the WebContent process in Bug 183192 (and related bugs). The
2659         UIProcess no longer needs to ask the WebContent process about networking-related things, and shouldn't
2660         waste everyone's time doing so.
2661
2662         This bug removes some left-over WebCookieManager API stuff, and is a first step in purging the
2663         WebContent Process from accessing cookie data.
2664
2665         * NetworkProcess/Cookies: Copied from WebProcess/Cookies.
2666         * NetworkProcess/Cookies/WebCookieManager.h:
2667         * WebKit.xcodeproj/project.pbxproj:
2668         * WebProcess/Cookies: Removed.
2669         * WebProcess/Cookies/WebCookieManager.cpp: Removed.
2670         * WebProcess/Cookies/WebCookieManager.h: Removed.
2671         * WebProcess/Cookies/WebCookieManager.messages.in: Removed.
2672         * WebProcess/Cookies/curl: Removed.
2673         * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Removed.
2674         * WebProcess/Cookies/mac: Removed.
2675         * WebProcess/Cookies/mac/WebCookieManagerMac.mm: Removed.
2676         * WebProcess/Cookies/soup: Removed.
2677         * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Removed.
2678         * WebProcess/InjectedBundle/InjectedBundle.cpp: Remove 'WebCookieManager.h" header.
2679         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Ditto.
2680         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Ditto.
2681         * WebProcess/WebProcess.cpp:
2682         (WebKit::WebProcess::WebProcess): Remove call to add WebCookieManager as a
2683         WebProcessSupplement.
2684         * CMakeLists.txt: Revised paths.
2685         * DerivedSources.make: Ditto.
2686         * PlatformMac.cmake: Ditto.
2687         * PlatformWin.cmake: Ditto.
2688         * SourcesGTK.txt: Ditto.
2689         * SourcesWPE.txt: Ditto.
2690
2691 2018-03-08  Youenn Fablet  <youenn@apple.com>
2692
2693         libwebrtc update broke internal builds
2694         https://bugs.webkit.org/show_bug.cgi?id=183454
2695
2696         Reviewed by Eric Carlson.
2697
2698         * Configurations/BaseTarget.xcconfig:
2699
2700 2018-03-08  Youenn Fablet  <youenn@apple.com>
2701
2702         PluginInfoStore::isSupportedPlugin should check for empty mime type
2703         https://bugs.webkit.org/show_bug.cgi?id=183457
2704         <rdar://problem/38159575>
2705
2706         Reviewed by Chris Dumez.
2707
2708         * UIProcess/Plugins/PluginInfoStore.cpp:
2709         (WebKit::PluginInfoStore::isSupportedPlugin):
2710
2711 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2712
2713         [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast
2714         https://bugs.webkit.org/show_bug.cgi?id=183449
2715
2716         Reviewed by Mark Lam.
2717
2718         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2719         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
2720         * WebProcess/WebPage/WebFrame.cpp:
2721         (WebKit::WebFrame::frameForContext):
2722
2723 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2724
2725         [JSC] Add inherits<T>(VM&) leveraging JSCast fast path
2726         https://bugs.webkit.org/show_bug.cgi?id=183429
2727
2728         Reviewed by Mark Lam.
2729
2730         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2731         (WebKit::callMethod):
2732         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2733         (WebKit::callNPJSObject):
2734         (WebKit::constructWithConstructor):
2735         * WebProcess/Plugins/Netscape/NPJSObject.cpp:
2736         (WebKit::NPJSObject::create):
2737         * WebProcess/WebPage/WebFrame.cpp:
2738         (WebKit::WebFrame::counterValue):
2739
2740 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
2741
2742         Remove WebCore::TextureMapperAnimation as a special case in WebKit IPC
2743         generation. Values of this type aren't being transferred across IPC.
2744
2745         Rubber-stamped by Carlos Garcia Campos.
2746
2747         * Scripts/webkit/messages.py:
2748
2749 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2750
2751         Stop linking ApplicationServices directly
2752         https://bugs.webkit.org/show_bug.cgi?id=182867
2753         <rdar://problem/38252142>
2754
2755         Reviewed by Alex Christensen.
2756
2757         The frameworks that we use that live inside ApplicationServices
2758         have mostly moved out, so import them directly.
2759
2760         * Configurations/WebKit.xcconfig:
2761
2762 2018-03-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2763
2764         [Extra zoom mode] Specify password mode as needed when inputting text
2765         https://bugs.webkit.org/show_bug.cgi?id=183428
2766         <rdar://problem/37609386>
2767
2768         Reviewed by Tim Horton.
2769
2770         If the focused element is a password field, or the input delegate has forced secure text entry, set a flag on
2771         the text input view controller to opt in to password text input mode.
2772
2773         * UIProcess/ios/WKContentViewInteraction.mm:
2774         (-[WKContentView presentTextInputViewController:]):
2775
2776 2018-03-07  Tim Horton  <timothy_horton@apple.com>
2777
2778         Sort and separate FeatureDefines.xcconfig
2779         https://bugs.webkit.org/show_bug.cgi?id=183427
2780
2781         Reviewed by Dan Bernstein.
2782
2783         * Configurations/FeatureDefines.xcconfig:
2784         Sort and split FeatureDefines into paragraphs
2785         (to make it easier to sort later).
2786
2787 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2788
2789         REGRESSION(r218089): [GTK] webkit_web_view_get_inspector() needs to be called, otherwise inspector does not close
2790         https://bugs.webkit.org/show_bug.cgi?id=181126
2791
2792         Reviewed by Carlos Alberto Lopez Perez.
2793
2794         Fix the condition to decide whether to detach the inspector view ourselves.
2795
2796         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2797         (WebKit::WebInspectorProxy::platformDetach): Remove the inspector view from its parent if we don't have a client
2798         or the client didn't detach it.
2799
2800 2018-03-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2801
2802         [GTK][WPE] Leak checker is not working in WebKitGLib web process tests
2803         https://bugs.webkit.org/show_bug.cgi?id=183404
2804
2805         Reviewed by Michael Catanzaro.
2806
2807         Add private helper for testing to do a garbage collection when the page is closing.
2808
2809         * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
2810         (webkitWebExtensionSetGarbageCollectOnPageDestroy):
2811         * WebProcess/InjectedBundle/API/glib/WebKitWebExtensionPrivate.h:
2812         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h: Fix annotation of
2813         webkit_dom_client_rect_list_item(), it should be transfer full.
2814
2815 2018-03-07  Youenn Fablet  <youenn@apple.com>
2816
2817         Match unsupported plugins based on domains and not origin
2818         https://bugs.webkit.org/show_bug.cgi?id=183384
2819
2820         Reviewed by Chris Dumez.
2821
2822         Moved from a HashMap of plugins to a Vector of plugins since we cannot match exactly based on the origin.
2823
2824         * Scripts/webkit/messages.py:
2825         * UIProcess/API/C/WKContext.cpp:
2826         (WKContextAddSupportedPlugin):
2827         * UIProcess/API/Cocoa/WKProcessPool.mm:
2828         (-[WKProcessPool _addSupportedPlugin:named:withMimeTypes:withExtensions:]):
2829         * UIProcess/Plugins/PluginInfoStore.cpp:
2830         (WebKit::PluginInfoStore::isSupportedPlugin):
2831         (WebKit::PluginInfoStore::supportedPluginNames):
2832         (WebKit::PluginInfoStore::addSupportedPlugin):
2833         * UIProcess/Plugins/PluginInfoStore.h:
2834         * UIProcess/WebProcessPool.cpp:
2835         (WebKit::WebProcessPool::addSupportedPlugin):
2836         * UIProcess/WebProcessPool.h:
2837         * UIProcess/WebProcessProxy.cpp:
2838         (WebKit::WebProcessProxy::getPlugins):
2839         * UIProcess/WebProcessProxy.h:
2840         * UIProcess/WebProcessProxy.messages.in:
2841         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2842         (WebKit::WebPluginInfoProvider::getPluginInfo):
2843         (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
2844         * WebProcess/Plugins/WebPluginInfoProvider.h:
2845
2846 2018-03-07  Brent Fulgham  <bfulgham@apple.com>
2847
2848         REGRESSION (r229093): Media playback on Facebook and Hulu require mDNSResponder access
2849         https://bugs.webkit.org/show_bug.cgi?id=183421
2850         <rdar://problem/38191574>
2851
2852         Reviewed by Dean Jackson.
2853
2854         CoreMedia fails to properly play back media on Facebook and Hulu if access to the
2855         mDNSResponder is blocked by the sandbox. This Bug unblocks that access while we
2856         investigate the underlying issue.
2857
2858         * WebProcess/com.apple.WebProcess.sb.in:
2859
2860 2018-03-07  Dean Jackson  <dino@apple.com>
2861
2862         Try to fix build for watchOS and tvOS.
2863
2864         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2865         * UIProcess/SystemPreviewController.cpp:
2866
2867 2018-03-07  Dean Jackson  <dino@apple.com>
2868
2869         Add SystemPreviewController for showing system-level views of special file types
2870         https://bugs.webkit.org/show_bug.cgi?id=183413
2871         <rdar://problem/37800834>
2872
2873         Reviewed by Tim Horton.
2874
2875         Add a new controller class that hangs off WebPageProxy, with the goal
2876         of providing system-level viewing of some some file types. Specifically
2877         those that can't be shown by WebKit.
2878
2879         This is the initial implementation which is quite simple. The controller
2880         can be queried about whether it supports a MIME type, then it can be
2881         asked to show a URL.
2882
2883         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Added.
2884         (-[_WKPreviewControllerDataSource initWithURL:]):
2885         (-[_WKPreviewControllerDataSource numberOfPreviewItemsInPreviewController:]):
2886         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
2887         (WebKit::SystemPreviewController::canPreview const):
2888         (WebKit::SystemPreviewController::showPreview):
2889         * UIProcess/SystemPreviewController.cpp: Added.
2890         (WebKit::SystemPreviewController::SystemPreviewController):
2891         (WebKit::SystemPreviewController::canPreview const):
2892         (WebKit::SystemPreviewController::showPreview):
2893         * UIProcess/SystemPreviewController.h: Added.
2894         * UIProcess/WebPageProxy.cpp:
2895         (WebKit::m_configurationPreferenceValues):
2896         (WebKit::WebPageProxy::reattachToWebProcess):
2897         (WebKit::WebPageProxy::resetState):
2898         * UIProcess/WebPageProxy.h:
2899         (WebKit::WebPageProxy::systemPreviewController):
2900         * WebKit.xcodeproj/project.pbxproj:
2901
2902 2018-03-07  Alejandro G. Castro  <alex@igalia.com>
2903
2904         Make NetworkRTCResolver port agnostic
2905         https://bugs.webkit.org/show_bug.cgi?id=178855
2906
2907         Reviewed by Youenn Fablet.
2908
2909         Create a specific Cocoa class to isolate the generic code in the base class, make the base implementation port
2910         agnostic and dependent on DNS API in the platform directory which encapsulates the platform specific details.
2911
2912         * NetworkProcess/webrtc/NetworkRTCProvider.cpp: Create an alias class name defined per platform to instantiate the resolver.
2913         (WebKit::NetworkRTCProvider::createResolver): Used the alias class name and receive a new IPAddress class that is not
2914         dependent on rtc libwebrtc library.
2915         * NetworkProcess/webrtc/NetworkRTCResolver.cpp: Remove the platform specific code. Use the DNS API to implement the
2916         platform specific code in the default start and stop methods. Add the identifier of the resolve operation to the class.
2917         (WebKit::NetworkRTCResolver::NetworkRTCResolver): Add the identifier in the initialization.
2918         (WebKit::NetworkRTCResolver::~NetworkRTCResolver): Remove the platform specific code.
2919         (WebKit::NetworkRTCResolver::completed): Ditto.
2920         (WebKit::NetworkRTCResolver::start): Add a new implementation using the DNS API.
2921         (WebKit::NetworkRTCResolver::stop): Ditto
2922         * NetworkProcess/webrtc/NetworkRTCResolver.h: Remove the platform specific code and use the DNSResolveQueue for a general
2923         solution to implement the platform specific code. Avoid using the IPAddress class that depends on libwertc classes to make
2924         it more general regarding DNS name resolution.
2925         (WebKit::NetworkRTCResolver::start): Make this class virtual.
2926         (WebKit::NetworkRTCResolver::stop): Ditto.
2927         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.cpp.
2928         Now this class overrides the start and stop methods that use DNS, cocoa implementation should use the DNS methods in the future and
2929         remove this class, making sure all the platform specific class is in the platform directory.
2930         * NetworkProcess/webrtc/NetworkRTCResolverCocoa.h: Copied Cocoa code from Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolver.h.
2931         * PlatformGTK.cmake: Add NetworkRTCResolver compilation for GTK.
2932         * WebKit.xcodeproj/project.pbxproj: Add the NetworkRTCResolverCocoa class to the compilation.
2933
2934 2018-03-06  Brent Fulgham  <bfulgham@apple.com>
2935
2936         NetworkDataTask should enable logging for automation clients
2937         https://bugs.webkit.org/show_bug.cgi?id=183378
2938         <rdar://problem/38189556>
2939
2940         Reviewed by Brian Burg.
2941
2942         The NetworkDataTaskCocoa class was only logging if the SessionID object allowed logging.
2943         It should also be considering whether the current session is working on behalf of an
2944         automation client. If so, it should allow logging.
2945
2946         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2947         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2948         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2949         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
2950         (WebKit::NetworkDataTaskCocoa::isAlwaysOnLoggingAllowed const):
2951
2952 2018-03-06  Ryan Haddad  <ryanhaddad@apple.com>
2953
2954         Unreviewed build fix.
2955
2956         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
2957         (-[WKFullScreenWindowController _EVOrganizationName]):
2958
2959 2018-03-06  Antoine Quint  <graouts@apple.com>
2960
2961         [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline
2962         https://bugs.webkit.org/show_bug.cgi?id=183370
2963         <rdar://problem/38180729>
2964
2965         Reviewed by Dean Jackson.
2966
2967         Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath
2968         involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by
2969         default while we bring this feature up.
2970
2971         * Shared/WebPreferences.yaml:
2972         * UIProcess/API/C/WKPreferences.cpp:
2973         (WKPreferencesSetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2974         (WKPreferencesGetCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2975         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2976         * UIProcess/API/Cocoa/WKPreferences.mm:
2977         (-[WKPreferences _setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled:]):
2978         (-[WKPreferences _cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled]):
2979         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2980         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2981         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2982         (WebKit::InjectedBundle::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2983         * WebProcess/InjectedBundle/InjectedBundle.h:
2984
2985 2018-03-06  Ms2ger  <Ms2ger@igalia.com>
2986
2987         [GLib] Implement WebsiteDataStore::defaultServiceWorkerRegistrationDirectory().
2988         https://bugs.webkit.org/show_bug.cgi?id=183364
2989
2990         Reviewed by Michael Catanzaro.
2991
2992         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
2993         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory): implement.
2994
2995 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2996
2997         Unreviewed. Addressing further review feedback for patch landed in r229315.
2998
2999         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3000         (WebKit::CoordinatedGraphicsScene::commitSceneState): There's no need for
3001         explicit calls of the clear() method on both containers in the CommitScope
3002         objects, the destructors invoked for these objects from the CommitScope
3003         destructor will have the same effect.
3004
3005 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
3006
3007         [CoordGraphics] Remove unused scrolling-related code in TextureMapperLayer, CoordinatedGraphics stack
3008         https://bugs.webkit.org/show_bug.cgi?id=183340
3009
3010         Reviewed by Michael Catanzaro.
3011
3012         With most of the scrolling-related code in TextureMapperLayer on the
3013         chopping block, we can now drop the ScrollingClient inheritance and the
3014         commitScrollOffset() virtual method implementation. This enables
3015         removing the whole commitScrollOffset() call chain that ran from
3016         CoordinatedGraphicsScene through CoordinatedLayerTreeHost and
3017         CompositingCoordinator to the affected CoordinatedGraphicsLayer object.
3018
3019         The CoordinatedGraphicsScene::findScrollableContentsLayerAt() method is
3020         also unused and can be deleted.
3021
3022         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3023         (WebKit::CoordinatedGraphicsScene::setLayerState):
3024         (WebKit::CoordinatedGraphicsScene::createLayer):
3025         (WebKit::CoordinatedGraphicsScene::commitScrollOffset): Deleted.
3026         (WebKit::CoordinatedGraphicsScene::findScrollableContentsLayerAt): Deleted.
3027         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3028         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
3029         (WebKit::ThreadedCompositor::commitScrollOffset): Deleted.
3030         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3031         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3032         (WebKit::CompositingCoordinator::commitScrollOffset): Deleted.
3033         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
3034         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3035         (WebKit::CoordinatedLayerTreeHost::commitScrollOffset): Deleted.
3036         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
3037         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3038
3039 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
3040
3041         [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
3042         https://bugs.webkit.org/show_bug.cgi?id=183360
3043
3044         Reviewed by Sergio Villar Senin.
3045
3046         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3047         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
3048         Pass the monotic time value, as returned by MonotonicTime::now(), to the
3049         TextureMapperLayer::applyAnimationsRecursively() call.
3050
3051 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
3052
3053         [CoordGraphics] Clean up CoordinatedImageBacking
3054         https://bugs.webkit.org/show_bug.cgi?id=183332
3055
3056         Reviewed by Carlos Garcia Campos.
3057
3058         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3059         (WebKit::CompositingCoordinator::createImageBackingIfNeeded):
3060         Adjust call to CoordinatedImageBacking::getCoordinatedImageBackingID().
3061
3062 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
3063
3064         CoordinatedGraphicsScene: properly limit data specific to state commit operation
3065         https://bugs.webkit.org/show_bug.cgi?id=183326
3066
3067         Reviewed by Sergio Villar Senin.
3068
3069         In the process of state commit in CoordinatedGraphicsScene, the released
3070         image backings and backing stores with pending updates are stored in
3071         Vector and HashSet objects, respectively. Instead of these two objects
3072         being member variables on the CoordinatedGraphicsScene class, keep them
3073         in the CommitScope structure that's limited to the operations done in
3074         the commitSceneState() method.
3075
3076         The two member variables are dropped, and the CommitScope object is
3077         passed by reference to any helper method that needs to append either
3078         kind of object to the respective container. At the end of the state
3079         commit, backing stores with pending updates have those updates applied,
3080         and the two containers are cleared out as the CommitScope object is
3081         destroyed.
3082
3083         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
3084         (WebKit::CoordinatedGraphicsScene::setLayerState):
3085         (WebKit::CoordinatedGraphicsScene::prepareContentBackingStore):
3086         (WebKit::CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize):
3087         (WebKit::CoordinatedGraphicsScene::removeTilesIfNeeded):
3088         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
3089         (WebKit::CoordinatedGraphicsScene::syncImageBackings):
3090         (WebKit::CoordinatedGraphicsScene::updateImageBacking):
3091         (WebKit::CoordinatedGraphicsScene::clearImageBackingContents):
3092         (WebKit::CoordinatedGraphicsScene::removeImageBacking):
3093         (WebKit::CoordinatedGraphicsScene::commitSceneState):
3094         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
3095         (WebKit::CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded): Deleted.
3096         (WebKit::CoordinatedGraphicsScene::commitPendingBackingStoreOperations): Deleted.
3097         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
3098
3099 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3100
3101         Fix std::make_unique / new[] using system malloc
3102         https://bugs.webkit.org/show_bug.cgi?id=182975
3103
3104         Reviewed by JF Bastien.
3105
3106         Use Vector instead.
3107
3108         * NetworkProcess/win/SystemProxyWin.cpp:
3109         (WindowsSystemProxy::getSystemHttpProxy):
3110         * Platform/IPC/unix/ConnectionUnix.cpp:
3111         (IPC::Connection::processMessage):
3112         (IPC::Connection::sendOutputMessage):
3113         * Platform/win/LoggingWin.cpp:
3114         (WebKit::logLevelString):
3115         * Shared/SandboxExtension.h:
3116         * Shared/mac/SandboxExtensionMac.mm:
3117         (WebKit::SandboxExtension::HandleArray::allocate):
3118         (WebKit::SandboxExtension::HandleArray::operator[]):
3119         (WebKit::SandboxExtension::HandleArray::operator[] const):
3120         (WebKit::SandboxExtension::HandleArray::size const):
3121         (WebKit::SandboxExtension::HandleArray::encode const):
3122
3123 2018-03-05  Andy Estes  <aestes@apple.com>
3124
3125         [Mac] Teach WebCore::Pasteboard about file promise drags
3126         https://bugs.webkit.org/show_bug.cgi?id=183314
3127         <rdar://problem/38105493>
3128
3129         Reviewed by Darin Adler.
3130
3131         Added a FIXME comment.
3132
3133         * UIProcess/Cocoa/WebViewImpl.mm:
3134         (WebKit::WebViewImpl::performDragOperation):
3135
3136 2018-03-05  Jeff Miller  <jeffm@apple.com>
3137
3138         Expose still more WKPreferences SPI to match C SPI
3139         https://bugs.webkit.org/show_bug.cgi?id=183045
3140
3141         Reviewed by Alex Christensen.
3142
3143         * UIProcess/API/Cocoa/WKPreferences.mm:
3144         (-[WKPreferences _setAllowsInlineMediaPlayback:]):
3145         (-[WKPreferences _allowsInlineMediaPlayback]):
3146         (-[WKPreferences _setApplePayEnabled:]):
3147         (-[WKPreferences _applePayEnabled]):
3148         (-[WKPreferences _setDNSPrefetchingEnabled:]):
3149         (-[WKPreferences _dnsPrefetchingEnabled]):
3150         (-[WKPreferences _setInlineMediaPlaybackRequiresPlaysInlineAttribute:]):
3151         (-[WKPreferences _inlineMediaPlaybackRequiresPlaysInlineAttribute]):
3152         (-[WKPreferences _setInvisibleMediaAutoplayNotPermitted:]):
3153         (-[WKPreferences _invisibleMediaAutoplayNotPermitted]):
3154         (-[WKPreferences _setLegacyEncryptedMediaAPIEnabled:]):
3155         (-[WKPreferences _legacyEncryptedMediaAPIEnabled]):
3156         (-[WKPreferences _setMainContentUserGestureOverrideEnabled:]):
3157         (-[WKPreferences _mainContentUserGestureOverrideEnabled]):
3158         (-[WKPreferences _setMediaStreamEnabled:]):
3159         (-[WKPreferences _mediaStreamEnabled]):
3160         (-[WKPreferences _setNeedsStorageAccessFromFileURLsQuirk:]):
3161         (-[WKPreferences _needsStorageAccessFromFileURLsQuirk]):
3162         (-[WKPreferences _setPDFPluginEnabled:]):
3163         (-[WKPreferences _pdfPluginEnabled]):
3164         (-[WKPreferences _setRequiresUserGestureForAudioPlayback:]):
3165         (-[WKPreferences _requiresUserGestureForAudioPlayback]):
3166         (-[WKPreferences _setRequiresUserGestureForVideoPlayback:]):
3167         (-[WKPreferences _requiresUserGestureForVideoPlayback]):
3168         (-[WKPreferences _setServiceControlsEnabled:]):
3169         (-[WKPreferences _serviceControlsEnabled]):
3170         (-[WKPreferences _setShowsToolTipOverTruncatedText:]):
3171         (-[WKPreferences _showsToolTipOverTruncatedText]):
3172         (-[WKPreferences _setTextAreasAreResizable:]):
3173         (-[WKPreferences _textAreasAreResizable]):
3174         (-[WKPreferences _setUseGiantTiles:]):
3175         (-[WKPreferences _useGiantTiles]):
3176         (-[WKPreferences _setWantsBalancedSetDefersLoadingBehavior:]):
3177         (-[WKPreferences _wantsBalancedSetDefersLoadingBehavior]):
3178         (-[WKPreferences _setWebAudioEnabled:]):
3179         (-[WKPreferences _webAudioEnabled]):
3180         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3181
3182 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3183
3184         Automation: clicking on a disabled option element shouldn't produce an error
3185         https://bugs.webkit.org/show_bug.cgi?id=183284
3186
3187         Reviewed by Brian Burg.
3188
3189         This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases.
3190
3191         14.1 Element Click.
3192         https://w3c.github.io/webdriver/webdriver-spec.html#element-click
3193
3194         Fixes: imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled
3195
3196         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3197         (WebKit::WebAutomationSessionProxy::selectOptionElement):
3198
3199 2018-03-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3200
3201         Automation: stale elements not detected when removed from the DOM
3202         https://bugs.webkit.org/show_bug.cgi?id=183278
3203
3204         Reviewed by Brian Burg.
3205
3206         We detect stale elements when the page is reloaded because the maps are recreated, but if an element is removed
3207         from the DOM for the same document we keep the nodes in the maps. We should clear stale elements before
3208         accessing the maps.
3209
3210         Fixes: imported/selenium/py/test/selenium/webdriver/common/webdriverwait_tests.py::testExpectedConditionStalenessOf
3211
3212         * WebProcess/Automation/WebAutomationSessionProxy.js:
3213         (let.AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Call _clearStaleNodes()
3214         (let.AutomationSessionProxy.prototype.nodeForIdentifier): Ditto.
3215         (let.AutomationSessionProxy.prototype._clearStaleNodes): Check if cached nodes are still in document and remove them
3216         from the maps if they aren't.
3217
3218 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
3219
3220         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
3221         https://bugs.webkit.org/show_bug.cgi?id=183312
3222
3223         Reviewed by Mark Lam.
3224
3225         Remove wtf/CurrentTime.h include pragma.
3226
3227         * NetworkProcess/NetworkResourceLoader.cpp:
3228         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3229         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
3230         * Platform/IPC/Connection.cpp:
3231         * Platform/unix/SharedMemoryUnix.cpp:
3232         * PluginProcess/WebProcessConnection.cpp:
3233         * Shared/ios/NativeWebTouchEventIOS.mm:
3234         * UIProcess/DrawingAreaProxyImpl.cpp:
3235         * UIProcess/ios/WKContentView.mm:
3236         * UIProcess/linux/MemoryPressureMonitor.cpp:
3237         * WebProcess/Gamepad/WebGamepad.cpp:
3238         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3239         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3240         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
3241         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3242         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm:
3243         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
3244         * WebProcess/WebProcess.cpp:
3245         * WebProcess/cocoa/WebProcessCocoa.mm:
3246         * WebProcess/gtk/WebProcessMainGtk.cpp:
3247         * WebProcess/win/WebProcessMainWin.cpp:
3248         * WebProcess/wpe/WebProcessMainWPE.cpp:
3249
3250 2018-03-02  Brian Burg  <bburg@apple.com>
3251
3252         Web Automation: script evaluations via WebDriver should have a user gesture indicator
3253         https://bugs.webkit.org/show_bug.cgi?id=183230
3254         <rdar://problem/37959739>
3255
3256         Reviewed by Andy Estes.
3257
3258         APIs that normally require a user gesture should just work when using via WebDriver.
3259         To support cases where tests need to simulate user actions with JavaScript, use a
3260         fake user gesture, similar to how -[WKWebView evaluateJavaScript:] forces a user
3261         gesture when clients evaluate JavaScript in their web view.
3262
3263         No new tests, this is covered by W3C tests that use the Fullscreen API.
3264         This API does nothing if there is no user gesture; with this patch, it just works.
3265
3266         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3267         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
3268
3269 2018-03-04  Tim Horton  <timothy_horton@apple.com>
3270
3271         Make !ENABLE(DATA_DETECTION) iOS build actually succeed
3272         https://bugs.webkit.org/show_bug.cgi?id=183283
3273         <rdar://problem/38062148>
3274
3275         Reviewed by Sam Weinig.
3276
3277         * UIProcess/ios/WKContentViewInteraction.mm:
3278         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
3279         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
3280         Guard some more code with ENABLE(DATA_DETECTION).
3281
3282 2018-03-04  Dan Bernstein  <mitz@apple.com>
3283
3284         Building with ONLY_ACTIVE_ARCH=NO and ARCHS=x86_64 fails
3285         https://bugs.webkit.org/show_bug.cgi?id=183320
3286
3287         Reviewed by Tim Horton.
3288
3289         * Configurations/PluginService.32.xcconfig: If the Apple build tool specifies
3290           RC_ARCHS=x86_64, then let the service build for x86_64, but don’t install it.
3291
3292 2018-03-03  Brent Fulgham  <bfulgham@apple.com>
3293
3294         Notify the NetworkProcess when a session is servicing an automation client
3295         https://bugs.webkit.org/show_bug.cgi?id=183306
3296         <rdar://problem/37835783>
3297
3298         Reviewed by Brian Burg.
3299
3300         Network loads servicing WebDriver are done through an ephemeral session. While this is great
3301         for protecting a developer's machine from sharing state with test runs, it has the unintended
3302         effect of blocking certain logging operations.
3303
3304         We do not log content in ephemeral sessions to protect user privacy. However, ephemeral sessions
3305         generated by WebDriver should participate in logging so that proper testing (with logging) can
3306         be done.
3307
3308         This patch signals the NetworkProcess when an ephemeral session (created for automation purposes)
3309         is created, so that it can allow logging.
3310
3311         * NetworkProcess/NetworkProcess.cpp:
3312         (WebKit::NetworkProcess::destroySession): Remove controlled-by-automation entry.
3313         (WebKit::NetworkProcess::sessionIsControlledByAutomation const): Added.
3314         (WebKit::NetworkProcess::setSessionIsControlledByAutomation): Added.
3315         * NetworkProcess/NetworkProcess.h:
3316         * NetworkProcess/NetworkProcess.messages.in:
3317         * NetworkProcess/NetworkResourceLoader.cpp:
3318         (WebKit::NetworkResourceLoader::isAlwaysOnLoggingAllowed const): Checks if the relevant session
3319         is servicing an automation client, and returns true if it is.
3320         * UIProcess/WebPageProxy.cpp:
3321         (WebKit::WebPageProxy::WebPageProxy): Signal the network process if this page is being created
3322         for an automation client.
3323
3324 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3325
3326         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
3327         https://bugs.webkit.org/show_bug.cgi?id=183293
3328
3329         Reviewed by Alex Christensen.
3330
3331         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
3332         (WebKit::CompositingRunLoop::scheduleUpdate):
3333         (WebKit::CompositingRunLoop::compositionCompleted):
3334         (WebKit::CompositingRunLoop::updateCompleted):
3335         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
3336         (WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback):
3337
3338 2018-03-02  Don Olmstead  <don.olmstead@sony.com>
3339
3340         Share common WebError implementation
3341         https://bugs.webkit.org/show_bug.cgi?id=183303
3342
3343         Reviewed by Ryosuke Niwa.
3344
3345         * Shared/WebErrors.cpp:
3346         (WebKit::cancelledError):
3347         (WebKit::fileDoesNotExistError):
3348         * Shared/glib/WebErrorsGlib.cpp: Removed.
3349         * SourcesGTK.txt:
3350         * SourcesWPE.txt:
3351
3352 2018-03-02  Youenn Fablet  <youenn@apple.com>
3353
3354         LayoutTest imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-within-sw.https.html is a flaky failure
3355         https://bugs.webkit.org/show_bug.cgi?id=179248
3356         <rdar://problem/35377756>
3357
3358         Reviewed by Chris Dumez.
3359
3360         In case we go up to the initializeSize step and Caches was cleared
3361         between the time we stated to initialize and the time we got there,
3362         we need to make as if Caches was not initialized,
3363         thus keeping m_isInitialized to false and m_storage to nullptr.
3364
3365         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3366         (WebKit::CacheStorage::Caches::initializeSize):
3367
3368 2018-03-02  Youenn Fablet  <youenn@apple.com>
3369
3370         Clients should register to StorageProcess with their service worker registration identifier
3371         https://bugs.webkit.org/show_bug.cgi?id=182313
3372         <rdar://problem/38044403>
3373
3374         Reviewed by Chris Dumez.
3375
3376         Relanding.
3377
3378         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3379         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
3380         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
3381         * StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
3382         * WebProcess/Storage/WebSWClientConnection.cpp:
3383         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
3384         * WebProcess/Storage/WebSWClientConnection.h:
3385
3386 2018-03-02  Tim Horton  <timothy_horton@apple.com>
3387
3388         Make it possible to disable WKPDFView
3389         https://bugs.webkit.org/show_bug.cgi?id=183281
3390         <rdar://problem/38060815>
3391
3392         Reviewed by Dan Bates.
3393
3394         * UIProcess/API/Cocoa/WKWebView.mm:
3395         (-[WKWebView _isBackground]):
3396         (-[WKWebView _isDisplayingPDF]):
3397         (-[WKWebView _dataForDisplayedPDF]):
3398         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
3399         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3400         (-[WKWebViewContentProviderRegistry init]):
3401         * UIProcess/ios/WKPDFView.h:
3402         * UIProcess/ios/WKPDFView.mm:
3403
3404 2018-03-02  Youenn Fablet  <youenn@apple.com>
3405
3406         WebProcessProxy should handle its completion handler at destruction time
3407         https://bugs.webkit.org/show_bug.cgi?id=183224
3408
3409         Reviewed by Brady Eidson.
3410
3411         * UIProcess/WebProcessProxy.cpp:
3412         (WebKit::WebProcessProxy::~WebProcessProxy):
3413         * UIProcess/WebProcessProxy.h:
3414
3415 2018-03-02  Brent Fulgham  <bfulgham@apple.com>
3416
3417         Update WebContent process sandbox IOKit properties
3418         https://bugs.webkit.org/show_bug.cgi?id=183269
3419         <rdar://problem/37853282>
3420
3421         Reviewed by Eric Carlson.
3422
3423         * WebProcess/com.apple.WebProcess.sb.in:
3424
3425 2018-03-01  Yusuke Suzuki  <utatane.tea@gmail.com>
3426
3427         Remove monotonicallyIncreasingTime
3428         https://bugs.webkit.org/show_bug.cgi?id=182911
3429
3430         Reviewed by Michael Catanzaro.
3431
3432         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3433         (WebKit::CacheStorage::Cache::toRecordInformation):
3434         * Platform/IPC/ArgumentCoders.cpp:
3435         (IPC::ArgumentCoder<Seconds>::encode):
3436         (IPC::ArgumentCoder<Seconds>::decode):
3437         (IPC::ArgumentCoder<MonotonicTime>::encode):
3438         (IPC::ArgumentCoder<MonotonicTime>::decode):
3439         * Platform/IPC/ArgumentCoders.h:
3440         * Shared/Gamepad/GamepadData.cpp:
3441         (WebKit::GamepadData::GamepadData):
3442         * Shared/Gamepad/Gamepa