Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-06-29  John Wilander  <wilander@apple.com>
2
3         Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral sessions
4         https://bugs.webkit.org/show_bug.cgi?id=187154
5         <rdar://problem/41487250>
6
7         Reviewed by Brent Fulgham and Chris Dumez.
8
9         Most of the changes in this patch remove the boolean parameter for tracking
10         ephemeral sessions and the IsReadOnly enum.
11
12         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
13         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
14             Now returns early for ephemeral sessions.
15         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
16         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
17         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
18         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
19         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
20         * UIProcess/WebResourceLoadStatisticsStore.cpp:
21         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
22         * UIProcess/WebResourceLoadStatisticsStore.h:
23         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
24         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
25             Now returns early for ephemeral sessions.
26         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
27
28 2018-06-29  Chris Dumez  <cdumez@apple.com>
29
30         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore
31         https://bugs.webkit.org/show_bug.cgi?id=187165
32
33         Reviewed by Brent Fulgham.
34
35         Stop using lambdas for WebResourceLoadStatisticsStore to interact with its WebsiteDataStore. Instead,
36         WebResourceLoadStatisticsStore now holds a weak pointer to its WebsiteDataStore and is able to call
37         methods on it directly. Reducing the indirection makes the code less complex and more understandable.
38
39         * UIProcess/WebResourceLoadStatisticsStore.cpp:
40         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
41         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
42         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
43         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
44         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
45         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
46         * UIProcess/WebResourceLoadStatisticsStore.h:
47         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
48         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
49
50 2018-06-29  Miguel Gomez  <magomez@igalia.com>
51
52         [WPE] Some frames are dropped when using rAF to animate an element
53         https://bugs.webkit.org/show_bug.cgi?id=187175
54
55         Always call renderNextFrame in ThreadedCompositor::requestDisplayRefreshMonitorUpdate()
56         so we have to process any pending layer flush request.
57
58         Reviewed by Žan Doberšek.
59
60         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
61         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate):
62
63 2018-06-28  Chris Dumez  <cdumez@apple.com>
64
65         Make sure the WebResourceLoadStatisticsStore gets destroyed on the main thread
66         https://bugs.webkit.org/show_bug.cgi?id=187143
67
68         Reviewed by Youenn Fablet.
69
70         Have WebResourceLoadStatisticsStore subclass ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>
71         instead of IPC::Connection::WorkQueueMessageReceiver. This makes sure that the WebResourceLoadStatisticsStore
72         objects get destroyed on the main thread, even if the last ref was held by a background thread.
73
74         Also, methods called by IPC are now called on the main thread instead of the background queue. I think it is clearer for all
75         of WebResourceLoadStatisticsStore usage to be on the main thread. Expensive work is still done on the background queue, inside
76         the persistent / memory store classes.
77
78         * UIProcess/WebResourceLoadStatisticsStore.cpp:
79         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
80         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
81         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
82         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
83         (WebKit::WebResourceLoadStatisticsStore::processWillOpenConnection):
84         (WebKit::WebResourceLoadStatisticsStore::processDidCloseConnection):
85         * UIProcess/WebResourceLoadStatisticsStore.h:
86
87 2018-06-28  Jiewen Tan  <jiewen_tan@apple.com>
88
89         Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
90         https://bugs.webkit.org/show_bug.cgi?id=187110
91         <rdar://problem/41536815>
92
93         Reviewed by Brent Fulgham.
94
95         In some rare cases as shown by crash tracers that the passed xpc_connection_t object could be nullptr,
96         and xpc_connection_set_event_handler won't do the nullptr check on its parameters. Therefore, we should
97         do it by ourselves.
98
99         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
100         (WebKit::AuthenticationManager::initializeConnection):
101         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
102         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc const):
103
104 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
105
106         [iOS] DataTransfer.getData always returns the empty string when dropping text
107         https://bugs.webkit.org/show_bug.cgi?id=187130
108         <rdar://problem/41014117>
109
110         Reviewed by Ryosuke Niwa.
111
112         Add plumbing to grab information for each item in the pasteboard. See WebCore ChangeLog for more detail.
113
114         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
115         (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
116         * UIProcess/WebPasteboardProxy.h:
117         * UIProcess/WebPasteboardProxy.messages.in:
118         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
119         (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
120         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
121
122 2018-06-28  Youenn Fablet  <youenn@apple.com>
123
124         Early return when handling fetch event in case service worker origin does not match origin of a subresource load
125         https://bugs.webkit.org/show_bug.cgi?id=187153
126         <rdar://problem/41329832>
127
128         Reviewed by Chris Dumez.
129
130         Stop crashing the service worker process in case a subresource load origin is not matching a service worker origin.
131         Instead, just return early so that the load will be handled by the network process.
132
133         Keep crashing in case a navigation load is not matching its service worker origin.
134         Add more logging to help with the debugging.
135
136         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
137         (WebKit::logValidFetchError):
138         (WebKit::isValidFetch):
139         (WebKit::WebSWContextManagerConnection::startFetch):
140
141 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
142
143         Fullscreen exits when placeholder is removed then added during a single runloop.
144         https://bugs.webkit.org/show_bug.cgi?id=187079
145
146         Reviewed by Jer Noble.
147
148         Instead of closing fullscreen as soon as the placeholder is removed from the view hierarchy,
149         give the placeholder until the next runloop to be re-added to the view hierarchy.
150
151         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
152         (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]):
153
154 2018-06-28  Youenn Fablet  <youenn@apple.com>
155
156         Handle the case of registerMDNSNameCallback called several times
157         https://bugs.webkit.org/show_bug.cgi?id=187150
158         <rdar://problem/41329832>
159
160         Reviewed by Eric Carlson.
161
162         This is a speculative fix on the basis that registerMDNSNameCallback may be called several times.
163         In that case, we would have freed the context after the first call and would reuse it for the second call.
164
165         Instead, keep a map of pending requests and pass to registerMDNSNameCallback an identifier to that map.
166         If the map has no value for that identifier, return early.
167
168         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
169         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
170         (WebKit::pendingRegistrationRequests):
171         (WebKit::registerMDNSNameCallback):
172         (WebKit::NetworkMDNSRegister::clearPendingRequests):
173         (WebKit::NetworkMDNSRegister::registerMDNSName):
174         * NetworkProcess/webrtc/NetworkMDNSRegister.h:
175         (): Deleted.
176
177 2018-06-28  Chris Dumez  <cdumez@apple.com>
178
179         Unreviewed attempt to fix Win Cairo build after r233310.
180
181         * UIProcess/WebResourceLoadStatisticsStore.h:
182
183 2018-06-28  Chris Dumez  <cdumez@apple.com>
184
185         Unreviewed attempt to fix Win Cairo build after r233310.
186
187         * UIProcess/WebResourceLoadStatisticsStore.h:
188
189 2018-06-28  Chris Dumez  <cdumez@apple.com>
190
191         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
192         https://bugs.webkit.org/show_bug.cgi?id=187055
193         <rdar://problem/41584026>
194
195         Unreviewed, temporarily disable main thread assertion added to flushAndDestroyPersistentStore()
196         in r233310, until Bug 187143 is fixed.
197
198         * UIProcess/WebResourceLoadStatisticsStore.cpp:
199         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
200
201 2018-06-28  Youenn Fablet  <youenn@apple.com>
202
203         Add sandbox to microdone plugin
204         https://bugs.webkit.org/show_bug.cgi?id=187149
205         rdar://problem/41538057
206
207         Reviewed by Brent Fulgham.
208
209         * Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari: Added.
210         * WebKit.xcodeproj/project.pbxproj:
211
212 2018-06-28  Brian Burg  <bburg@apple.com>
213
214         Web Inspector: REGRESSION(r223770): "Open Link" context menu action on a linkified URL doesn't work
215         https://bugs.webkit.org/show_bug.cgi?id=187146
216         <rdar://problem/41369591>
217
218         Reviewed by Joseph Pecoraro.
219
220         When Web Inspector's page receives a navigation request, it's supposed to redirect any
221         non-Inspector navigations to be loaded in the inspected page. When I refactored to use
222         modern a policy delegate, the one line that redirects the loads was left out.
223
224         No new tests, because inspector tests can't navigate the inspector or inspected pages.
225
226         * UIProcess/mac/WKInspectorViewController.mm:
227         (-[WKInspectorViewController webView:decidePolicyForNavigationAction:decisionHandler:]):
228
229 2018-06-28  Jeremy Jones  <jeremyj@apple.com>
230
231         Crash when _topConstraint is null in element fullscreen.
232         https://bugs.webkit.org/show_bug.cgi?id=187075
233
234         Reviewed by Eric Carlson.
235
236         NSArray can't contain a null pointer, so check for null before creating an array from a pointer.
237         Use the recommended +deactivateConstraints: instead of -removeConstraints:.
238
239         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
240         (-[WKFullScreenViewController showUI]):
241         (-[WKFullScreenViewController hideUI]):
242
243 2018-06-28  Chris Dumez  <cdumez@apple.com>
244
245         Split memory store logic out of WebResourceLoadStatisticsStore to clarify threading model
246         https://bugs.webkit.org/show_bug.cgi?id=187055
247         <rdar://problem/41584026>
248
249         Reviewed by Brent Fulgham.
250
251         Split memory store logic out of WebResourceLoadStatisticsStore and into a ResourceLoadStatisticsMemoryStore class
252         to clarify the threading model. Previously, some of the methods of the WebResourceLoadStatisticsStore had to be
253         called on the main thread and some of them on the background queue, which was confusing and error prone. Now,
254         all WebResourceLoadStatisticsStore methods (except for IPC ones which will be addressed in a follow-up) are called
255         on the main thread. The ResourceLoadStatisticsMemoryStore objects is constructed / used and destroyed on the
256         background queue, similarly to the ResourceLoadStatisticsPersistentStore. The WebResourceLoadStatisticsStore
257         objects merely proxies calls from WebKit to those persistent / memory stores and takes care of hopping back and
258         forth between the background thread and the work queue.
259
260         While spliting code code, I found several instances where we were calling completion handlers on the wrong thread.
261         I fixed those in this patch now that the model is clearer.
262
263         We can likely clean up (organize the code a bit better) in a follow-up). This patch takes care of splitting the
264         code as it was. Code that was called on the background queue was moved to ResourceLoadStatisticsMemoryStore class
265         and code that was called on the main thread stays in WebResourceLoadStatisticsStore.
266
267         * CMakeLists.txt:
268         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm: Renamed from Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm.
269         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
270         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: Added.
271         (WebKit::appendWithDelimiter):
272         (WebKit::OperatingDate::fromWallTime):
273         (WebKit::OperatingDate::today):
274         (WebKit::OperatingDate::secondsSinceEpoch const):
275         (WebKit::OperatingDate::operator== const):
276         (WebKit::OperatingDate::operator< const):
277         (WebKit::OperatingDate::operator<= const):
278         (WebKit::OperatingDate::OperatingDate):
279         (WebKit::mergeOperatingDates):
280         (WebKit::pruneResources):
281         (WebKit::computeImportance):
282         (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
283         (WebKit::ResourceLoadStatisticsMemoryStore::~ResourceLoadStatisticsMemoryStore):
284         (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage):
285         (WebKit::ResourceLoadStatisticsMemoryStore::calculateAndSubmitTelemetry):
286         (WebKit::ResourceLoadStatisticsMemoryStore::setNotifyPagesWhenDataRecordsWereScanned):
287         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
288         (WebKit::ResourceLoadStatisticsMemoryStore::setShouldSubmitTelemetry):
289         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
290         (WebKit::ResourceLoadStatisticsMemoryStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain):
291         (WebKit::ResourceLoadStatisticsMemoryStore::markAsPrevalentIfHasRedirectedToPrevalent):
292         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
293         (WebKit::ResourceLoadStatisticsMemoryStore::hasStorageAccess):
294         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccess):
295         (WebKit::ResourceLoadStatisticsMemoryStore::requestStorageAccessUnderOpener):
296         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccess):
297         (WebKit::ResourceLoadStatisticsMemoryStore::grantStorageAccessInternal):
298         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
299         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
300         (WebKit::ResourceLoadStatisticsMemoryStore::scheduleStatisticsProcessingRequestIfNecessary):
301         (WebKit::ResourceLoadStatisticsMemoryStore::cancelPendingStatisticsProcessingRequest):
302         (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
303         (WebKit::ResourceLoadStatisticsMemoryStore::logUserInteraction):
304         (WebKit::ResourceLoadStatisticsMemoryStore::logNonRecentUserInteraction):
305         (WebKit::ResourceLoadStatisticsMemoryStore::clearUserInteraction):
306         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUserInteraction):
307         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
308         (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
309         (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
310         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsSubFrameUnder):
311         (WebKit::ResourceLoadStatisticsMemoryStore::isRegisteredAsRedirectingTo):
312         (WebKit::ResourceLoadStatisticsMemoryStore::clearPrevalentResource):
313         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfathered):
314         (WebKit::ResourceLoadStatisticsMemoryStore::isGrandfathered const):
315         (WebKit::ResourceLoadStatisticsMemoryStore::setSubframeUnderTopFrameOrigin):
316         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUnderTopFrameOrigin):
317         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectTo):
318         (WebKit::ResourceLoadStatisticsMemoryStore::setSubresourceUniqueRedirectFrom):
319         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectTo):
320         (WebKit::ResourceLoadStatisticsMemoryStore::setTopFrameUniqueRedirectFrom):
321         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveUserInteraction):
322         (WebKit::ResourceLoadStatisticsMemoryStore::setTimeToLiveCookiePartitionFree):
323         (WebKit::ResourceLoadStatisticsMemoryStore::setMinimumTimeBetweenDataRecordsRemoval):
324         (WebKit::ResourceLoadStatisticsMemoryStore::setGrandfatheringTime):
325         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
326         (WebKit::ResourceLoadStatisticsMemoryStore::setDataRecordsBeingRemoved):
327         (WebKit::ResourceLoadStatisticsMemoryStore::ensureResourceStatisticsForPrimaryDomain):
328         (WebKit::ResourceLoadStatisticsMemoryStore::createEncoderFromData const):
329         (WebKit::ResourceLoadStatisticsMemoryStore::mergeWithDataFromDecoder):
330         (WebKit::ResourceLoadStatisticsMemoryStore::clear):
331         (WebKit::ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction):
332         (WebKit::ResourceLoadStatisticsMemoryStore::mergeStatistics):
333         (WebKit::ResourceLoadStatisticsMemoryStore::shouldPartitionCookies):
334         (WebKit::ResourceLoadStatisticsMemoryStore::shouldBlockCookies):
335         (WebKit::ResourceLoadStatisticsMemoryStore::hasUserGrantedStorageAccessThroughPrompt):
336         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
337         (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioningForDomains):
338         (WebKit::ResourceLoadStatisticsMemoryStore::clearPartitioningStateForDomains):
339         (WebKit::ResourceLoadStatisticsMemoryStore::resetCookiePartitioningState):
340         (WebKit::ResourceLoadStatisticsMemoryStore::processStatistics const):
341         (WebKit::ResourceLoadStatisticsMemoryStore::hasHadUnexpiredRecentUserInteraction const):
342         (WebKit::ResourceLoadStatisticsMemoryStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor):
343         (WebKit::ResourceLoadStatisticsMemoryStore::includeTodayAsOperatingDateIfNecessary):
344         (WebKit::ResourceLoadStatisticsMemoryStore::hasStatisticsExpired const):
345         (WebKit::ResourceLoadStatisticsMemoryStore::setMaxStatisticsEntries):
346         (WebKit::ResourceLoadStatisticsMemoryStore::setPruneEntriesDownTo):
347         (WebKit::ResourceLoadStatisticsMemoryStore::pruneStatisticsIfNeeded):
348         (WebKit::ResourceLoadStatisticsMemoryStore::resetParametersToDefaultValues):
349         (WebKit::ResourceLoadStatisticsMemoryStore::logTestingEvent):
350         (WebKit::ResourceLoadStatisticsMemoryStore::setLastSeen):
351         (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
352         (WebKit::ResourceLoadStatisticsMemoryStore::removeAllStorageAccess):
353         * UIProcess/ResourceLoadStatisticsMemoryStore.h: Added.
354         (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const):
355         (WebKit::ResourceLoadStatisticsMemoryStore::setStorageAccessPromptsEnabled):
356         (WebKit::ResourceLoadStatisticsMemoryStore::setDebugLogggingEnabled):
357         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
358         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
359         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
360         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
361         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
362         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
363         * UIProcess/WebResourceLoadStatisticsStore.cpp:
364         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
365         (WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
366         (WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
367         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
368         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
369         (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
370         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
371         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
372         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
373         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
374         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
375         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
376         (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler):
377         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
378         (WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
379         (WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
380         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
381         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
382         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
383         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
384         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
385         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
386         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
387         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
388         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
389         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
390         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
391         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
392         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
393         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
394         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
395         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
396         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
397         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
398         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
399         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
400         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
401         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
402         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
403         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
404         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
405         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
406         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
407         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
408         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
409         (WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
410         (WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
411         (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler):
412         (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler):
413         (WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
414         (WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
415         (WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
416         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
417         * UIProcess/WebResourceLoadStatisticsStore.h:
418         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
419         (WebKit::sortedPrevalentResourceTelemetry):
420         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
421         * UIProcess/WebResourceLoadStatisticsTelemetry.h:
422         * WebKit.xcodeproj/project.pbxproj:
423
424 2018-06-28  Michael Catanzaro  <mcatanzaro@igalia.com>
425
426         [GTK] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) when dragging file into webview
427         https://bugs.webkit.org/show_bug.cgi?id=175602
428
429         Reviewed by Carlos Garcia Campos.
430
431         We check using the GdkDragContext to ensure the DroppingContext is still alive (present in
432         m_droppingContexts), but access it via the pointer to the DroppingContext that could be
433         dangling. This happens on every drag. I can't actually reproduce the original assertion
434         since I'm currently working with an asan build, but I imagine it's probably the same issue
435         that I'm fixing here.
436
437         * UIProcess/gtk/DragAndDropHandler.cpp:
438         (WebKit::DragAndDropHandler::dragLeave):
439
440 2018-06-27  Timothy Hatcher  <timothy@apple.com>
441
442         Don't expose new semantic -apple-system color keywords on iOS.
443         https://bugs.webkit.org/show_bug.cgi?id=187080
444         rdar://problem/41505699
445
446         Reviewed by Tim Horton.
447
448         * DerivedSources.make: Use gnu++14, since gnu++17 is giving errors on macOS 10.12.
449
450 2018-06-27  Megan Gardner  <megan_gardner@apple.com>
451
452         Fix IBeam issues with iPad apps on Mac
453         https://bugs.webkit.org/show_bug.cgi?id=186900
454
455         Reviewed by Wenson Hsieh.
456
457         * Shared/ios/InteractionInformationAtPosition.h:
458         * Shared/ios/InteractionInformationAtPosition.mm:
459         (WebKit::InteractionInformationAtPosition::encode const):
460         (WebKit::InteractionInformationAtPosition::decode):
461
462         Add functionality to determine what a caret rect should be, but as it is
463         expensive, it should only be done for this platform.
464         
465         * Shared/ios/InteractionInformationRequest.cpp:
466         (WebKit::InteractionInformationRequest::isApproximateForRequest):
467         * Shared/ios/InteractionInformationRequest.h:
468
469         As there is no way to premptively request information on hover, we need to use 
470         the last cached information, but only if it is close to the point we are about
471         to request information for. So having a way to determine if a point is very close
472         to a previous point is a good idea.
473
474         * UIProcess/ios/WKContentViewInteraction.mm:
475         (-[WKContentView _currentPositionInformationIsApproximateForRequest:]):
476         (-[WKContentView closestPositionToPoint:]):
477
478         UIKit is using this function to determine if we should show an Ibeam or not.
479         So we need to implement it, at least for this platform. 
480
481         * WebProcess/WebPage/ios/WebPageIOS.mm:
482         (WebKit::WebPage::getPositionInformation):
483
484         Pass up the calculated caret rect, but only for iPad apps on Mac.
485
486 2018-06-27  Yusuke Suzuki  <utatane.tea@gmail.com>
487
488         [GTK][WPE] Use LazyNeverDestroyed<XErrorTrapper> to remove static initializers
489         https://bugs.webkit.org/show_bug.cgi?id=187089
490
491         Reviewed by Michael Catanzaro.
492
493         Use LazyNeverDestroyed<XErrorTrapper> instead of global std::unique_ptr<XErrorTrapper>.
494         Since this variable's exit time destructor is not important in this code, using
495         LazyNeverDestroyed<XErrorTrapper> is fine. This removes the last static initializer
496         of libwebkit2gtk.so.
497
498         * PluginProcess/unix/PluginProcessMainUnix.cpp:
499
500 2018-06-27  Youenn Fablet  <youenn@apple.com>
501
502         Add a sandbox profile for some additional bank plugins
503         https://bugs.webkit.org/show_bug.cgi?id=187105
504
505         Reviewed by Brent Fulgham.
506
507         * Resources/PlugInSandboxProfiles/cfca.com.npCryptoKit.CGB.MAC.sb: Added.
508         * Resources/PlugInSandboxProfiles/cfca.com.npP11CertEnroll.MAC.CGB.sb: Added.
509         * Resources/PlugInSandboxProfiles/com.apple.BocomSubmitCtrl.sb: Added.
510         * Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb: Added.
511         * Resources/PlugInSandboxProfiles/com.apple.NPSafeSubmit.sb: Added.
512         * Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb: Added.
513         * Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb: Added.
514         * Resources/PlugInSandboxProfiles/com.ftsafe.NPAPI-Core-Safe-SoftKeybaord.plugin.rfc1034identifier.sb: Added.
515         * WebKit.xcodeproj/project.pbxproj:
516
517 2018-06-27  Youenn Fablet  <youenn@apple.com>
518
519         NetworkLoadChecker should not need to hard ref NetworkConnectionToWebProcess
520         https://bugs.webkit.org/show_bug.cgi?id=186551
521
522         Reviewed by Daniel Bates.
523
524         Removed the need for NetworkLoadChecker to reference a NetworkConnectionToWebProcess.
525         Instead a CSP client is given to NetworkLoadChecker when needed.
526
527         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
528         (WebKit::NetworkConnectionToWebProcess::loadPing):
529         * NetworkProcess/NetworkLoadChecker.cpp:
530         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
531         (WebKit::NetworkLoadChecker::check):
532         (WebKit::NetworkLoadChecker::checkRedirection):
533         (WebKit::NetworkLoadChecker::checkRequest):
534         (WebKit::NetworkLoadChecker::contentSecurityPolicy):
535         (WebKit::NetworkLoadChecker::addConsoleMessage): Deleted.
536         (WebKit::NetworkLoadChecker::sendCSPViolationReport): Deleted.
537         (WebKit::NetworkLoadChecker::enqueueSecurityPolicyViolationEvent): Deleted.
538         * NetworkProcess/NetworkLoadChecker.h:
539         * NetworkProcess/NetworkResourceLoader.cpp:
540         (WebKit::NetworkResourceLoader::start):
541         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
542         * NetworkProcess/PingLoad.cpp:
543         (WebKit::PingLoad::PingLoad):
544         (WebKit::PingLoad::willPerformHTTPRedirection):
545         * NetworkProcess/PingLoad.h:
546
547 2018-06-27  Stephan Szabo  <stephan.szabo@sony.com>
548
549         [Wincairo] Add support for context menus to non-legacy minibrowser
550         https://bugs.webkit.org/show_bug.cgi?id=186815.
551
552         Reviewed by Ryosuke Niwa.
553
554         * UIProcess/WebPageProxy.h:
555         * UIProcess/win/PageClientImpl.cpp:
556         (WebKit::PageClientImpl::viewWidget):
557         * UIProcess/win/PageClientImpl.h:
558         * UIProcess/win/WebContextMenuProxyWin.cpp:
559         (WebKit::WebContextMenuProxyWin::show):
560         (WebKit::createMenu):
561         (WebKit::createMenuItem):
562         (WebKit::populate):
563         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
564         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
565         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
566         * UIProcess/win/WebContextMenuProxyWin.h:
567         * UIProcess/win/WebPageProxyWin.cpp:
568         (WebKit::WebPageProxy::viewWidget):
569         * UIProcess/win/WebView.cpp:
570         (WebKit::WebView::wndProc):
571         (WebKit::WebView::onMenuCommand):
572         * UIProcess/win/WebView.h:
573
574 2018-06-27  Youenn Fablet  <youenn@apple.com>
575
576         Disable content blockers in NetworkLoadChecker except for ping loads
577         https://bugs.webkit.org/show_bug.cgi?id=187083
578         <rdar://problem/41440083>
579
580         Reviewed by Chris Dumez.
581
582         * NetworkProcess/NetworkLoadChecker.cpp:
583         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
584         * NetworkProcess/NetworkLoadChecker.h:
585         (WebKit::NetworkLoadChecker::enableContentExtensionsCheck):
586         * NetworkProcess/PingLoad.cpp:
587
588 2018-06-27  Simon Fraser  <simon.fraser@apple.com>
589
590         https://hackernoon.com/ uses lots of layer backing store
591         https://bugs.webkit.org/show_bug.cgi?id=186909
592         rdar://problem/40257540
593
594         Reviewed by Tim Horton.
595         
596         PlatformCALayerRemote was actually holding onto backing stores for layers with
597         backing store detached, which could increase memory use. When told that backing stores
598         are not attached, explicitly throw away the backing, and re-create it (via setNeedsDisplay)
599         when attached. This is now similar to what PlatformLayerCACocoa does.
600
601         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
602         (WebKit::PlatformCALayerRemote::setNeedsDisplayInRect):
603         (WebKit::PlatformCALayerRemote::setNeedsDisplay):
604         (WebKit::PlatformCALayerRemote::hasContents const):
605         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
606
607 2018-06-27  Jonathan Bedard  <jbedard@apple.com>
608
609         Enable WebKit iOS 12 build
610         https://bugs.webkit.org/show_bug.cgi?id=187024
611         <rdar://problem/39759057>
612
613         Reviewed by David Kilzer.
614
615         * Platform/spi/ios/PDFKitSPI.h: Added PDFKit SPI.
616         * Platform/spi/ios/UIKitSPI.h: Add new UIKit SPI and UICompositingMode enumeration.
617         * UIProcess/ios/WKPDFView.mm: Use PDFKitSPI header.
618         * UIProcess/ios/WKSystemPreviewView.mm: Use CoreGraphicsSPI.h.
619         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Use QuartzCoreSPI.h.
620
621 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
622
623         CSS Animation Triggers is not an experimental feature, should be globally off by default
624
625         Reviewed by Dean Jackson.
626
627         * Shared/WebPreferences.yaml:
628
629 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
630
631         Promote the Secure Context API feature from experimental-yet-on-by-default to always-on
632
633         Reviewed by Dan Bates.
634
635         * Shared/WebPreferences.yaml:
636         Secure Context API is on by default, it's not experimental anymore.
637
638 2018-06-27  Timothy Horton  <timothy_horton@apple.com>
639
640         Make Link Preload an on-by-default feature
641         https://bugs.webkit.org/show_bug.cgi?id=187104
642
643         Reviewed by Ryosuke Niwa.
644
645         * Shared/WebPreferences.yaml:
646         This should be on, not experimental. It already shipped on in the past.
647
648 2018-06-27  Chris Dumez  <cdumez@apple.com>
649
650         Regression(r233208): Completion handler does not get called on GTK port
651         https://bugs.webkit.org/show_bug.cgi?id=187099
652
653         Reviewed by Antti Koivisto.
654
655         Make sure UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler's completion handler
656         gets called on non-COCOA ports.
657
658         * UIProcess/WebResourceLoadStatisticsStore.h:
659
660 2018-06-27  Tim Horton  <timothy_horton@apple.com>
661
662         When trying to print a very long email on iOS, the print preview is blank
663         https://bugs.webkit.org/show_bug.cgi?id=187077
664         <rdar://problem/41107013>
665
666         Reviewed by Timothy Hatcher.
667
668         * UIProcess/ios/WebPageProxyIOS.mm:
669         (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
670         ChildProcessProxy::sendSync has a (surprising) default timeout of 1 second,
671         (as opposed to Connection::sendSync's default timeout of ∞ seconds).
672         The printing path already waits ∞ seconds for the final PDF, but currently
673         uses the default 1 second timeout for page count computation. If page
674         count computation takes more than 1 second, the preview will be blank.
675         Since the print preview is generated asynchronously, we really want
676         to wait until it's done, and not give up after 1 second.
677
678 2018-06-26  Wenson Hsieh  <wenson_hsieh@apple.com>
679
680         [iPad apps on macOS] Unable to interact with video elements that have started playing
681         https://bugs.webkit.org/show_bug.cgi?id=187073
682         <rdar://problem/40591107>
683
684         Reviewed by Tim Horton.
685
686         On iOS, we currently force remote hosting contexts to be non-interactive by passing in `kCAContextIgnoresHitTest`
687         when creating the CAContext. However, this flag is not respected by CoreAnimation when running iOS apps on macOS.
688         This means all HID events dispatched over a video that has been played (which causes WebKit to insert a
689         CALayerHost-backed WKRemoteView in the view hierarchy) will be routed to the context ID of the video's CAContext
690         rather than the context ID of the key window containing the WKWebView.
691
692         This subsequently causes all gesture recognizers (hover, touch, tap, long press) to fail recognition when
693         running iOS apps on macOS. To address this, we set a flag on WKRemoteView's CALayerHost to prevent hit-testing
694         to the remote layer. This allows us to avoid routing HID events to the wrong context, and instead target the
695         main UIWindow.
696
697         Manually verified that click, touch, and mouseenter/mouseleave events are dispatched when interacting over a
698         video element.
699
700         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
701         (-[WKRemoteView initWithFrame:contextID:]):
702
703 2018-06-26  Commit Queue  <commit-queue@webkit.org>
704
705         Unreviewed, rolling out r233232.
706         https://bugs.webkit.org/show_bug.cgi?id=187081
707
708         "This is breaking launching some plugins" (Requested by youenn
709         on #webkit).
710
711         Reverted changeset:
712
713         "Remove quarantine for Webex plugin"
714         https://bugs.webkit.org/show_bug.cgi?id=187050
715         https://trac.webkit.org/changeset/233232
716
717 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
718
719         Rearrange some WebPreferences; move two experimental prefs into the experimental section
720
721         * Shared/WebPreferences.yaml:
722
723 2018-06-26  Chris Dumez  <cdumez@apple.com>
724
725         Deal better with the network process crashing on startup
726         https://bugs.webkit.org/show_bug.cgi?id=187065
727         <rdar://problem/41451622>
728
729         Reviewed by Geoffrey Garen.
730
731         When a network process crashes on startup, we would not attempt to relaunch it. If there were web
732         processes waiting for a connection to this network process, we would send them an invalid connection
733         identifier which would cause them to forcefully crash.
734
735         Instead, we now apply the same policy whether a network process crashes on startup or later:
736         - We attempt to relaunch the network process
737         - If there were pending connections from WebContent processes, we ask the new Network process instead.
738
739         As a result, WebContent processes no longer crash in this case. Instead, they wait for a valid
740         connection to the network process.
741
742         * UIProcess/API/Cocoa/WKProcessPool.mm:
743         (-[WKProcessPool _makeNextNetworkProcessLaunchFailForTesting]):
744         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
745         * UIProcess/Network/NetworkProcessProxy.cpp:
746         (WebKit::NetworkProcessProxy::getLaunchOptions):
747         (WebKit::NetworkProcessProxy::didFinishLaunching):
748         * UIProcess/Network/NetworkProcessProxy.h:
749         * UIProcess/WebProcessPool.cpp:
750         (WebKit::WebProcessPool::networkProcessCrashed):
751         * UIProcess/WebProcessPool.h:
752
753 2018-06-26  Daniel Bates  <dabates@apple.com>
754
755         REGRESSION (r231479): Unable to buy Odeon cinema tickets in STP (bogus 'X-Frame-Options' to 'SAMEORIGIN')
756         https://bugs.webkit.org/show_bug.cgi?id=186090
757         <rdar://problem/40692595>
758
759         Reviewed by Andy Estes.
760
761         Fixes an issue where a page P delivered with "X-Frame-Options: SAMEORIGIN" loaded in a sub-
762         frame would be blocked if we were redirected to it in response to the cross-origin POST
763         request regardless of whether P is same-origin with its parent document.
764
765         * NetworkProcess/NetworkResourceLoader.cpp:
766         (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): Compare the origin
767         of the top frame's document as opposed to the source origin. The latter represents the
768         origin of the document that initiated the navigation, which can be cross-origin, and
769         should not be considered when applying "X-Frame-Options: SAMEORIGIN". This check exists
770         as a performance optimization to avoid traversing over all frame ancestors only to find
771         out that the innermost frame (the one that made this request) is cross-origin with the
772         top-most frame.
773         * NetworkProcess/NetworkResourceLoader.h:
774         * WebProcess/Network/WebLoaderStrategy.cpp:
775         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): Exclude the origin of the
776         frame that is making the load request from the list of ancestor origins. This makes the
777         X-Frame-Options algorithm in WebKit2 match the logic we do in FrameLoader::shouldInterruptLoadForXFrameOptions().
778
779 2018-06-26  Youenn Fablet  <youenn@apple.com>
780
781         Remove quarantine for Webex plugin
782         https://bugs.webkit.org/show_bug.cgi?id=187050
783         rdar://problem/41478189
784
785         Reviewed by Brent Fulgham.
786
787         Update the Plugin Info.plist to not do quarantine of downloaded files by default.
788         Update PluginProcess implementation to reenable quarantine for all plug-ins except cisco webex plug-in.
789
790         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
791         * PluginProcess/PluginProcess.h:
792         * PluginProcess/mac/PluginProcessMac.mm:
793         (WebKit::PluginProcess::shouldOverrideQuarantine):
794         * Shared/ChildProcess.h:
795         (WebKit::ChildProcess::shouldOverrideQuarantine):
796         * Shared/mac/ChildProcessMac.mm:
797         (WebKit::ChildProcess::initializeSandbox):
798
799 2018-06-26  Jeremy Jones  <jeremyj@apple.com>
800
801         Ensure element fullscreen animation is always visible.
802         https://bugs.webkit.org/show_bug.cgi?id=187068
803         rdar://problem/36187369
804
805         Reviewed by Eric Carlson.
806
807         The fullscreen animation is important for communicating to users that they are no longer in inline mode.
808         If fullscreen animation's inline rect is not visible, animate from a point in the middle of the screen.
809
810         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
811         (WebKit::safeInlineRect):
812         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
813         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
814
815 2018-06-26  Youenn Fablet  <youenn@apple.com>
816
817         Add a sandbox profile for com.google.o1dbrowserplugin plugin
818         https://bugs.webkit.org/show_bug.cgi?id=187067
819
820         Reviewed by Brent Fulgham.
821
822         * Resources/PlugInSandboxProfiles/com.google.o1dbrowserplugin.sb: Added.
823         * WebKit.xcodeproj/project.pbxproj:
824
825 2018-06-26  Tim Horton  <timothy_horton@apple.com>
826
827         Promote two more experimental features to traditional features
828         https://bugs.webkit.org/show_bug.cgi?id=187063
829
830         Reviewed by Dean Jackson.
831
832         * Shared/WebPreferences.yaml:
833         Promote some shipped/default-on features to non-experimental.
834
835 2018-06-26  Jiewen Tan  <jiewen_tan@apple.com>
836
837         Rollout macOS sandbox change in r232276
838         https://bugs.webkit.org/show_bug.cgi?id=186904
839         <rdar://problem/41350969>
840
841         Reviewed by Brent Fulgham.
842
843         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
844
845 2018-06-26  Aditya Keerthi  <akeerthi@apple.com>
846
847         Tap highlight displayed when tapping a field that is already focussed
848         https://bugs.webkit.org/show_bug.cgi?id=187004
849         <rdar://problem/41428008>
850         Reviewed by Tim Horton.
851
852         In the case where fast-clicking is enabled, _singleTapCommited: could be invoked
853         before the tap highlight request, causing _potentialTapInProgress to be set to NO.
854         This results in the early return for preventing multiple tap highlights on an
855         assisted node to be skipped. Since a tap highlight should never be shown for an
856         input field that is already focussed, _potentialTapInProgress can be removed from
857         the early return condition.
858
859         * UIProcess/ios/WKContentViewInteraction.mm:
860         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
861
862 2018-06-26  Timothy Horton  <timothy_horton@apple.com>
863
864         Rearrange some WebPreferences; move two non-experimental prefs out of the experimental section
865
866         * Shared/WebPreferences.yaml:
867
868 2018-06-26  Tim Horton  <timothy_horton@apple.com>
869
870         Promote some experimental features to traditional features
871         https://bugs.webkit.org/show_bug.cgi?id=187047
872
873         Reviewed by Simon Fraser.
874
875         * Shared/WebPreferences.yaml:
876         Reindent.
877         Promote some shipped/default-on features to non-experimental.
878
879 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
880
881         [Mac] AirPlay picker uses incorrect theme in Dark mode
882         https://bugs.webkit.org/show_bug.cgi?id=187054
883         <rdar://problem/41291093>
884
885         Reviewed by Timothy Hatcher.
886
887         * UIProcess/WebPageProxy.cpp:
888         (WebKit::WebPageProxy::showPlaybackTargetPicker): Pass m_defaultAppearance.
889
890 2018-06-26  Chris Dumez  <cdumez@apple.com>
891
892         Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback
893         https://bugs.webkit.org/show_bug.cgi?id=186903
894         <rdar://problem/41350182>
895
896         Reviewed by Brady Eidson.
897
898         Follow-up fix after r233180 to address an API test crash. We need to keep the
899         NetworkProcessProxy alive during the async updatePrevalentDomainsToPartitionOrBlockCookies
900         request to make sure it completes.
901
902         * UIProcess/Network/NetworkProcessProxy.cpp:
903         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies):
904
905 2018-06-26  Brent Fulgham  <bfulgham@apple.com>
906
907         Provide a way for Injected Bundles to indicate classes approved for NSSecureCoding
908         https://bugs.webkit.org/show_bug.cgi?id=186788
909         <rdar://problem/41094167>
910
911         Reviewed by Chris Dumez.
912
913         InjectedBundles support a mechanism to serialize data between the UIProcess and the
914         WebContent process hosting the bundle. In some cases, we want to be able to serialize
915         a custom data object that is not part of WebKit's native data types.
916
917         After switching to strict NSSecureCoding, WebKit clients attempting to serialize these
918         custom objects trigger a failure.
919
920         This patch makes it possible for the InjectedBundle author to specify one (or more) data
921         classes that are allowed to be serialized between the two processes.
922         
923         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
924         (WKBundleExtendClassesForParameterCoder): Added.
925         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
926         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
927         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm:
928         (createWKArray): Added.
929         (-[WKWebProcessPlugInController extendClassesForParameterCoder:]): Added.
930         * WebProcess/InjectedBundle/InjectedBundle.h:
931         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
932         (WebKit::InjectedBundle::extendClassesForParameterCoder): Added.
933         (WebKit::InjectedBundle::classesForCoder): New helper function.
934         (WebKit::InjectedBundle::setBundleParameter): Modified to use the new set of valid
935         classes for NSSecureCoding.
936
937 2018-06-26  Eric Carlson  <eric.carlson@apple.com>
938
939         Enable mock capture devices on the iOS simulator
940         https://bugs.webkit.org/show_bug.cgi?id=186846
941         <rdar://problem/41289134>
942
943         Reviewed by Youenn Fablet.
944
945         * Shared/WebPreferences.yaml: Use DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED.
946         * Shared/WebPreferencesDefaultValues.h: Define DEFAULT_MOCK_CAPTURE_DEVICES_ENABLED, set to
947         true in the iOS simulator only.
948
949 2018-06-26  Fujii Hironori  <Hironori.Fujii@sony.com>
950
951         [Win] 'deref': is not a member of 'WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains::<lambda_9d761a6dc12d95db7fa2d6f3f5aa26fa>'
952         https://bugs.webkit.org/show_bug.cgi?id=187035
953
954         Unreviewed build fix.
955
956         MSVC can't compile the code using `this` in a generalized lambda
957         capture in another lambda.
958
959         In this case, there is no need to copy `protectedThis` for the
960         inner lambda. Move `protectedThis` of the outer lambda to the
961         inner as well as `completionHandler`.
962
963         * UIProcess/WebResourceLoadStatisticsStore.cpp:
964         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
965         Moved `protectedThis` from the outer lambda to the inner.
966         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
967         Ditto.
968
969 2018-06-26  Miguel Gomez  <magomez@igalia.com>
970
971         [GTK] Many webpages can crash the browser in WebCore::CoordinatedGraphicsLayer::transformedVisibleRect
972         https://bugs.webkit.org/show_bug.cgi?id=179304
973
974         Reviewed by Michael Catanzaro.
975
976         Add a way to attach to the CompositingCoordinator layers that were not created by it.
977
978         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
979         (WebKit::CompositingCoordinator::attachLayer):
980         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
981
982 2018-06-25  Tim Horton  <timothy_horton@apple.com>
983
984         WKThumbnailView fallback background is blindingly bright in Dark Mode
985         https://bugs.webkit.org/show_bug.cgi?id=187017
986         <rdar://problem/41036209>
987
988         Reviewed by Simon Fraser.
989
990         * UIProcess/API/Cocoa/_WKThumbnailView.mm:
991         (-[_WKThumbnailView initWithFrame:]):
992         (-[_WKThumbnailView wantsUpdateLayer]):
993         (-[_WKThumbnailView updateLayer]):
994         Use a semantic color for the WKThumbnailView background color
995         instead of flat white.
996
997 2018-06-25  John Wilander  <wilander@apple.com>
998
999         Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback
1000         https://bugs.webkit.org/show_bug.cgi?id=186903
1001         <rdar://problem/41350182>
1002
1003         Reviewed by Chris Dumez.
1004
1005         This patch stores the callback sent to
1006         WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(),
1007         sets up a context ID, and sends that ID to the network process when
1008         asking it to update cookie partitioning and blocking. The network
1009         process then tells the UI process when it's done, at which point the
1010         callback is called.
1011
1012         This change is meant to address layout test flakiness.
1013
1014         * NetworkProcess/NetworkProcess.cpp:
1015         (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies):
1016         * NetworkProcess/NetworkProcess.h:
1017         * NetworkProcess/NetworkProcess.messages.in:
1018         * UIProcess/Network/NetworkProcessProxy.cpp:
1019         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies):
1020         (WebKit::NetworkProcessProxy::didUpdatePartitionOrBlockCookies):
1021         * UIProcess/Network/NetworkProcessProxy.h:
1022         * UIProcess/Network/NetworkProcessProxy.messages.in:
1023         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1024         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
1025         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains):
1026         * UIProcess/WebResourceLoadStatisticsStore.h:
1027         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1028         (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
1029         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
1030         * UIProcess/WebsiteData/WebsiteDataStore.h:
1031
1032 2018-06-25  Brent Fulgham  <bfulgham@apple.com>
1033
1034         Allow access to APTDevice in iOS WebContent process
1035         https://bugs.webkit.org/show_bug.cgi?id=187021
1036         <rdar://problem/41339769>
1037
1038         Reviewed by Youenn Fablet.
1039
1040         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1041
1042 2018-06-25  Keith Rollin  <krollin@apple.com>
1043         Unreviewed, rolling out r233087.
1044
1045         Causes 5% Mac PLT regression.
1046
1047         Reverted changeset:
1048
1049         "Recalc styles every time defaultAppearance changes."
1050         https://bugs.webkit.org/show_bug.cgi?id=186866
1051         https://trac.webkit.org/changeset/233087
1052
1053 2018-06-25  Youenn Fablet  <youenn@apple.com>
1054
1055         Add a sandbox profile to Hangout plug-in
1056         https://bugs.webkit.org/show_bug.cgi?id=187005
1057         <rdar://problem/41428391>
1058
1059         Reviewed by Brent Fulgham.
1060
1061         Add a sandbox profile so that this plug-in can be run when UIProcess is sandboxed.
1062
1063         * Resources/PlugInSandboxProfiles/com.google.googletalkbrowserplugin.sb: Added.
1064         * WebKit.xcodeproj/project.pbxproj:
1065
1066 2018-06-25  Youenn Fablet  <youenn@apple.com>
1067
1068         NetworkLoadChecker should not check CORS for 304 responses triggered by WebProcess revalidation
1069         https://bugs.webkit.org/show_bug.cgi?id=186939
1070         <rdar://problem/40941725>
1071
1072         Reviewed by Chris Dumez.
1073
1074         * NetworkProcess/NetworkLoadChecker.cpp:
1075         (WebKit::NetworkLoadChecker::validateResponse):
1076
1077 2018-06-25  Keith Rollin  <krollin@apple.com>
1078
1079         Adjust UNEXPORTED_SYMBOL_LDFLAGS for LTO
1080         https://bugs.webkit.org/show_bug.cgi?id=186949
1081         <rdar://problem/41386438>
1082
1083         Reviewed by David Kilzer.
1084
1085         When building with LTO, WebKit's
1086         'check-for-weak-vtables-and-externals' script reports weak external
1087         symbols:
1088
1089         ERROR: WebKit has a weak external symbol in it (.../OpenSource/WebKitBuild/Release/WebKit.framework/Versions/A/WebKit)
1090         ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
1091         ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
1092         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE
1093         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE
1094         ERROR: symbol __ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE
1095         ERROR: symbol __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
1096         ERROR: symbol __ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE
1097         ERROR: symbol __ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
1098         Command /bin/sh failed with exit code 1
1099
1100         Address these by adding those symbols to UNEXPORTED_SYMBOL_LDFLAGS in
1101         WebKit.xcconfig.
1102
1103         * Configurations/WebKit.xcconfig:
1104
1105 2018-06-25  Chris Dumez  <cdumez@apple.com>
1106
1107         Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called
1108         https://bugs.webkit.org/show_bug.cgi?id=187007
1109         <rdar://problem/41293989>
1110
1111         Reviewed by Brady Eidson.
1112
1113         Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called by
1114         switching its type to WTF::CompletionHandler instead of WTF::Function. This also has the benefit
1115         of destroying our captured objects when the completion handler gets called by the client on the
1116         main thread instead of whatever thread the ObjC block gets released on.
1117
1118         * UIProcess/API/APIIconLoadingClient.h:
1119         (API::IconLoadingClient::getLoadDecisionForIcon):
1120         * UIProcess/API/glib/WebKitIconLoadingClient.cpp:
1121         * UIProcess/API/mac/WKView.mm:
1122         (-[WKView maybeInstallIconLoadingClient]):
1123         * UIProcess/Cocoa/IconLoadingDelegate.h:
1124         * UIProcess/Cocoa/IconLoadingDelegate.mm:
1125         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
1126
1127 2018-06-25  Youenn Fablet  <youenn@apple.com>
1128
1129         Add API to control mock media devices
1130         https://bugs.webkit.org/show_bug.cgi?id=186958
1131
1132         Reviewed by Eric Carlson.
1133
1134         Add API to clear, set, remove and reset mock media devices.
1135         The mock media center of UIProcess and all WebProcesses are updated.
1136
1137         * CMakeLists.txt:
1138         * UIProcess/API/C/WKMockMediaDevice.cpp: Added.
1139         (typeFromString):
1140         (WKAddMockMediaDevice):
1141         (WKClearMockMediaDevices):
1142         (WKRemoveMockMediaDevice):
1143         (WKResetMockMediaDevices):
1144         * UIProcess/API/C/WKMockMediaDevice.h: Added.
1145         * UIProcess/WebProcessPool.cpp:
1146         (WebKit::WebProcessPool::addMockMediaDevice):
1147         (WebKit::WebProcessPool::clearMockMediaDevices):
1148         (WebKit::WebProcessPool::removeMockMediaDevice):
1149         (WebKit::WebProcessPool::resetMockMediaDevices):
1150         * UIProcess/WebProcessPool.h:
1151         * WebKit.xcodeproj/project.pbxproj:
1152         * WebProcess/WebProcess.cpp:
1153         (WebKit::WebProcess::addMockMediaDevice):
1154         (WebKit::WebProcess::clearMockMediaDevices):
1155         (WebKit::WebProcess::removeMockMediaDevice):
1156         (WebKit::WebProcess::resetMockMediaDevices):
1157         * WebProcess/WebProcess.h:
1158         * WebProcess/WebProcess.messages.in:
1159
1160 2018-06-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1161
1162         [iPad apps on macOS] Click events are broken in WKWebView
1163         https://bugs.webkit.org/show_bug.cgi?id=186964
1164         <rdar://problem/41369145>
1165
1166         Reviewed by Tim Horton.
1167
1168         Tapping in WKWebView currently does not dispatch click events to the page. This is because the long press loupe
1169         gesture (in the text interaction assistant) has a delay of 0 when running iOS apps on macOS, but on iOS, it's
1170         0.5. The zero delay on macOS means that the loupe gesture will be recognized before the synthetic click gesture;
1171         this, in turn, causes the synthetic click gesture to be excluded by the loupe gesture. To address this, we
1172         simply allow the click and loupe gesture to recognize simultaneously.
1173
1174         Additionally, a new hover gesture was added recently to handle macOS cursor types when hovering over selectable
1175         text. This patch also allows other gestures to recognize alongside hover gestures, which matches macOS behavior.
1176
1177         We don't have the capacity to write automated tests for this yet; I manually tested text selection, editing in
1178         some text form controls, as well as clicking on links, buttons, and other elements with click event handlers.
1179
1180         * UIProcess/ios/WKContentViewInteraction.mm:
1181         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1182
1183 2018-06-23  Brian Burg  <bburg@apple.com>
1184
1185         [Mac] Web Automation: include correct key code with synthesized NSEvents used for keystrokes
1186         https://bugs.webkit.org/show_bug.cgi?id=186937
1187
1188         Reviewed by Timothy Hatcher.
1189
1190         In some cases, a missing keyCode for an ASCII letter/number can cause synthesized
1191         NSEvents to not be converted into a key equivalent action like copy: or paste:.
1192
1193         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1194         Drive by, always initialize keyCode.
1195
1196         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1197         (WebKit::keyCodeForCharKey): Compute the keyCode as defined by HLTB headers.
1198         This only needs to be computed for characters with physical keys, excluding the
1199         number pad and some traditional virtual keys that do not usually have glyphs.
1200
1201 2018-06-24  Michael Catanzaro  <mcatanzaro@igalia.com>
1202
1203         Unreviewed, fix GTK debug build after r233131
1204         https://bugs.webkit.org/show_bug.cgi?id=186899
1205         <rdar://problem/38222248>
1206
1207         This assertion was intended to be removed.
1208
1209         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1210         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1211
1212 2018-06-21  Brian Burg  <bburg@apple.com>
1213
1214         Web Automation: key actions should support multiple pressed virtual keys
1215         https://bugs.webkit.org/show_bug.cgi?id=186899
1216         <rdar://problem/38222248>
1217
1218         Reviewed by Timothy Hatcher.
1219
1220         This patch changes the protocol to allow multiple virtual keys per input source state.
1221         Chords like Cmd-Shift-A and Shift-F12 must be represented this way as they are encoded
1222         in the VirtualKey enum rather than as an ASCII char.
1223
1224         * UIProcess/Automation/Automation.json:
1225         * UIProcess/Automation/SimulatedInputDispatcher.h:
1226         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1227         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1228         * UIProcess/Automation/WebAutomationSession.cpp:
1229         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
1230         (WebKit::WebAutomationSession::performKeyboardInteractions):
1231         (WebKit::WebAutomationSession::performInteractionSequence):
1232
1233         * UIProcess/Automation/WebAutomationSession.h:
1234         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
1235         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1236         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
1237         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1238         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
1239         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
1240         Also clean up the signature of WebAutomationSession::platformSimulateKeyboardInteraction
1241         to use a variant instead of mutually exclusive optional values with different types.
1242
1243 2018-06-23  Yusuke Suzuki  <utatane.tea@gmail.com>
1244
1245         [WTF] Add user-defined literal for ASCIILiteral
1246         https://bugs.webkit.org/show_bug.cgi?id=186839
1247
1248         Reviewed by Darin Adler.
1249
1250         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1251         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
1252         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
1253         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
1254         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
1255         * NetworkProcess/NetworkDataTaskBlob.cpp:
1256         (WebKit::NetworkDataTaskBlob::suggestedFilename const):
1257         * NetworkProcess/NetworkLoadChecker.cpp:
1258         (WebKit::NetworkLoadChecker::checkRedirection):
1259         (WebKit::NetworkLoadChecker::checkRequest):
1260         * NetworkProcess/NetworkResourceLoader.cpp:
1261         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1262         * NetworkProcess/PingLoad.cpp:
1263         (WebKit::PingLoad::willPerformHTTPRedirection):
1264         (WebKit::PingLoad::didReceiveChallenge):
1265         (WebKit::PingLoad::timeoutTimerFired):
1266         * NetworkProcess/PreconnectTask.cpp:
1267         (WebKit::PreconnectTask::PreconnectTask):
1268         * NetworkProcess/cache/CacheStorageEngine.cpp:
1269         (WebKit::CacheStorage::Engine::initialize):
1270         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
1271         (WebKit::CacheStorage::Cache::toRecordInformation):
1272         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1273         (WebKit::CacheStorage::cachesListFilename):
1274         (WebKit::CacheStorage::cachesOriginFilename):
1275         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
1276         (WebKit::NetworkCache::Statistics::initialize):
1277         (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache):
1278         (WebKit::NetworkCache::Statistics::queryWasEverRequested):
1279         (WebKit::NetworkCache::Statistics::clear):
1280         (WebKit::NetworkCache::Statistics::addHashesToDatabase):
1281         (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase):
1282         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1283         (WebKit::XPCServiceInitializer):
1284         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1285         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1286         * Shared/Plugins/Netscape/PluginInformation.cpp:
1287         (WebKit::pluginInformationBundleIdentifierKey):
1288         (WebKit::pluginInformationBundleVersionKey):
1289         (WebKit::pluginInformationBundleShortVersionKey):
1290         (WebKit::pluginInformationPathKey):
1291         (WebKit::pluginInformationDisplayNameKey):
1292         (WebKit::pluginInformationDefaultLoadPolicyKey):
1293         (WebKit::pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey):
1294         (WebKit::pluginInformationHasSandboxProfileKey):
1295         (WebKit::pluginInformationFrameURLKey):
1296         (WebKit::pluginInformationMIMETypeKey):
1297         (WebKit::pluginInformationPageURLKey):
1298         (WebKit::pluginInformationPluginspageAttributeURLKey):
1299         (WebKit::pluginInformationPluginURLKey):
1300         (WebKit::plugInInformationReplacementObscuredKey):
1301         * Shared/ios/WebIOSEventFactory.mm:
1302         (WebIOSEventFactory::createWebKeyboardEvent):
1303         * Shared/linux/WebMemorySamplerLinux.cpp:
1304         (WebKit::WebMemorySampler::sampleWebKit const):
1305         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
1306         (debuggableTypeString):
1307         * UIProcess/API/glib/WebKitWebContext.cpp:
1308         (webkit_web_context_set_preferred_languages):
1309         * UIProcess/Automation/WebAutomationSession.cpp:
1310         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
1311         (WebKit::WebAutomationSession::addSingleCookie):
1312         (WebKit::WebAutomationSession::setSessionPermissions):
1313         (WebKit::WebAutomationSession::performMouseInteraction):
1314         (WebKit::WebAutomationSession::performKeyboardInteractions):
1315         (WebKit::WebAutomationSession::performInteractionSequence):
1316         * UIProcess/Automation/WebAutomationSession.h:
1317         * UIProcess/ChildProcessProxy.cpp:
1318         (WebKit::ChildProcessProxy::getLaunchOptions):
1319         * UIProcess/Cocoa/DownloadClient.mm:
1320         (WebKit::DownloadClient::didStart):
1321         * UIProcess/Cocoa/WebViewImpl.mm:
1322         (WebKit::selectorExceptionMap):
1323         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
1324         (WebKit::WebCredentialsMessengerProxy::makeCredential):
1325         (WebKit::WebCredentialsMessengerProxy::getAssertion):
1326         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
1327         (WebKit::PluginInfoStore::pluginsDirectories):
1328         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1329         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1330         * UIProcess/ServiceWorkerProcessProxy.cpp:
1331         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1332         (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge):
1333         * UIProcess/UserMediaProcessManager.cpp:
1334         (WebKit::UserMediaProcessManager::willCreateMediaStream):
1335         (WebKit::UserMediaProcessManager::endedCaptureSession):
1336         * UIProcess/WebBackForwardList.cpp:
1337         (WebKit::WebBackForwardList::goToItem):
1338         * UIProcess/WebPageProxy.cpp:
1339         (WebKit::WebPageProxy::loadFile):
1340         (WebKit::WebPageProxy::loadHTMLString):
1341         (WebKit::WebPageProxy::loadPlainTextString):
1342         (WebKit::WebPageProxy::loadWebArchiveData):
1343         (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
1344         * UIProcess/WebProcessProxy.cpp:
1345         (WebKit::WebProcessProxy::getLaunchOptions):
1346         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1347         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1348         * UIProcess/WebResourceLoadStatisticsTelemetry.cpp:
1349         (WebKit::notifyPages):
1350         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1351         * UIProcess/ios/WKContentViewInteraction.mm:
1352         (-[WKContentView copyForWebView:]):
1353         (-[WKContentView cutForWebView:]):
1354         (-[WKContentView pasteForWebView:]):
1355         (-[WKContentView selectAllForWebView:]):
1356         (-[WKContentView deleteBackward]):
1357         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1358         * UIProcess/ios/WKLegacyPDFView.mm:
1359         (-[WKLegacyPDFView _URLForLinkAnnotation:]):
1360         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1361         (WebKit::WebAutomationSessionProxy::elementForNodeHandle):
1362         (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
1363         (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
1364         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
1365         (WebKit::WebIDBConnectionToServer::connectionToServerLost):
1366         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
1367         (webkit_dom_document_get_ready_state):
1368         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
1369         (WebKit::uniqueWorldName):
1370         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1371         (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins):
1372         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1373         (WebKit::PDFPlugin::pluginInfo):
1374         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
1375         (WebKit::ServiceWorkerClientFetch::validateResponse):
1376         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
1377         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
1378         (WebKit::WebContextMenuClient::searchWithGoogle):
1379         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1380         (WebKit::WebInspectorClient::showPaintRect):
1381         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1382         (WebKit::RemoteWebInspectorUI::initialize):
1383         (WebKit::RemoteWebInspectorUI::didSave):
1384         (WebKit::RemoteWebInspectorUI::didAppend):
1385         (WebKit::RemoteWebInspectorUI::frontendLoaded):
1386         * WebProcess/WebPage/WebInspector.cpp:
1387         (WebKit::WebInspector::openInNewTab):
1388         * WebProcess/WebPage/WebInspectorUI.cpp:
1389         (WebKit::WebInspectorUI::setDockSide):
1390         (WebKit::WebInspectorUI::setDockingUnavailable):
1391         (WebKit::WebInspectorUI::setIsVisible):
1392         (WebKit::WebInspectorUI::showConsole):
1393         (WebKit::WebInspectorUI::showResources):
1394         (WebKit::WebInspectorUI::showTimelines):
1395         (WebKit::WebInspectorUI::showMainResourceForFrame):
1396         (WebKit::WebInspectorUI::startPageProfiling):
1397         (WebKit::WebInspectorUI::stopPageProfiling):
1398         (WebKit::WebInspectorUI::startElementSelection):
1399         (WebKit::WebInspectorUI::stopElementSelection):
1400         (WebKit::WebInspectorUI::didSave):
1401         (WebKit::WebInspectorUI::didAppend):
1402         * WebProcess/WebPage/WebPage.cpp:
1403         (WebKit::WebPage::loadStringImpl):
1404         (WebKit::WebPage::loadAlternateHTMLString):
1405         * WebProcess/WebPage/ios/WebPageIOS.mm:
1406         (WebKit::computeAutocorrectionContext):
1407         * WebProcess/WebProcess.cpp:
1408         (WebKit::getWebCoreMemoryCacheStatistics):
1409         (WebKit::WebProcess::getWebCoreStatistics):
1410         * WebProcess/cocoa/WebProcessCocoa.mm:
1411         (WebKit::WebProcess::initializeProcessName):
1412
1413 2018-06-22  Chris Dumez  <cdumez@apple.com>
1414
1415         Regression(r230211): Crash under WebInspectorClient::~WebInspectorClient()
1416         https://bugs.webkit.org/show_bug.cgi?id=186950
1417         <rdar://problem/40602069>
1418
1419         Reviewed by Darin Adler.
1420
1421         Re-introduce null-check that was accidentally dropped in r230211.
1422
1423         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1424         (WebKit::WebInspectorClient::~WebInspectorClient):
1425
1426 2018-06-22  Timothy Hatcher  <timothy@apple.com>
1427
1428         Corner of two scroll bars is white with dark mode enabled.
1429         https://bugs.webkit.org/show_bug.cgi?id=186819
1430         rdar://problem/40434350
1431
1432         Reviewed by Tim Horton.
1433
1434         * UIProcess/mac/WKPrintingView.mm:
1435         (-[WKPrintingView drawRect:]): Added LocalDefaultSystemAppearance.
1436         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1437         (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
1438         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1439         (WebKit::PDFPlugin::paintControlForLayerInContext): Ditto. Dropped ScrollView argument.
1440         * WebProcess/WebPage/WebPage.cpp:
1441         (WebKit::WebPage::drawRect): Added LocalDefaultSystemAppearance.
1442
1443 2018-06-22  Tim Horton  <timothy_horton@apple.com>
1444
1445         Make it possible to add a border around loading or failed-to-load images
1446         https://bugs.webkit.org/show_bug.cgi?id=186614
1447         <rdar://problem/39050152>
1448
1449         Reviewed by Zalan Bujtas.
1450
1451         * Shared/WebPreferences.yaml:
1452         * UIProcess/API/Cocoa/WKWebView.mm:
1453         (-[WKWebView _initializeWithConfiguration:]):
1454         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1455         (-[WKWebViewConfiguration init]):
1456         (-[WKWebViewConfiguration copyWithZone:]):
1457         (-[WKWebViewConfiguration _setColorFilterEnabled:]):
1458         (-[WKWebViewConfiguration _incompleteImageBorderEnabled]):
1459         (-[WKWebViewConfiguration _setIncompleteImageBorderEnabled:]):
1460         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
1461         Plumb the setting to WebKit2.
1462
1463 2018-06-22  Brady Eidson  <beidson@apple.com>
1464
1465         WKURLSchemeHandler doesn't handle sync XHR.
1466         <rdar://problem/40955884> and https://bugs.webkit.org/show_bug.cgi?id=186902
1467
1468         Reviewed by Chris Dumez.
1469
1470         This patch allows WebProcesses to block on sync loads to a custom scheme,
1471         and teaches WebURLSchemeTasks how to buffer up data and the response if 
1472         operating synchronously.
1473
1474         * Shared/WebErrors.cpp:
1475         (WebKit::failedCustomProtocolSyncLoad):
1476         * Shared/WebErrors.h:
1477
1478         * UIProcess/WebPageProxy.cpp:
1479         (WebKit::WebPageProxy::startURLSchemeTask):
1480         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
1481         * UIProcess/WebPageProxy.h:
1482         * UIProcess/WebPageProxy.messages.in:
1483
1484         * UIProcess/WebURLSchemeHandler.cpp:
1485         (WebKit::WebURLSchemeHandler::startTask):
1486         * UIProcess/WebURLSchemeHandler.h:
1487
1488         * UIProcess/WebURLSchemeTask.cpp:
1489         (WebKit::WebURLSchemeTask::create):
1490         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
1491         (WebKit::WebURLSchemeTask::didPerformRedirection):
1492         (WebKit::WebURLSchemeTask::didReceiveResponse):
1493         (WebKit::WebURLSchemeTask::didReceiveData):
1494         (WebKit::WebURLSchemeTask::didComplete):
1495         (WebKit::WebURLSchemeTask::pageDestroyed):
1496         (WebKit::WebURLSchemeTask::stop):
1497         * UIProcess/WebURLSchemeTask.h:
1498         (WebKit::WebURLSchemeTask::isSync const):
1499
1500         * WebProcess/Network/WebLoaderStrategy.cpp:
1501         (WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
1502         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1503         * WebProcess/Network/WebLoaderStrategy.h:
1504
1505         * WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
1506         (WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
1507         * WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
1508
1509 2018-06-22  Chris Dumez  <cdumez@apple.com>
1510
1511         Implement IPC throttling to keep the main thread responsive when a process misbehaves
1512         https://bugs.webkit.org/show_bug.cgi?id=186607
1513         <rdar://problem/41073205>
1514
1515         Reviewed by Geoff Garen and Brady Eidson.
1516
1517         Implement IPC throttling to keep the main thread responsive when a process misbehaves.
1518         Instead of doing one main runloop dispatch per incoming message, we now do a single
1519         runloop dispatch and process incoming messages in batch. We put a limit on the number
1520         of messages to be processed in a batch (600). If the queue is larger that this limit,
1521         we'll schedule a 0-timer to process remaining messages, giving the main runloop a chance
1522         to process other events. Additionally, if an IPC connection keeps hitting this maximum
1523         batch size limit, we implement back off and we'll further decrease the number of messages
1524         we process in each batch (going as low as 60). This keeps Safari responsive enough to
1525         allow the user to close the bad tab (even on older devices such as iPhone 5s).
1526
1527         Finally, if the incoming message queue becomes too large (50000), we go one step further
1528         and kill the IPC connection in order to maintain performance / battery life.
1529
1530         Every time we apply throttling or terminate a connection due to throttling, we do a
1531         RELEASE_LOG_ERROR() with useful information in order to help diagnose potential issues
1532         in the future.
1533
1534         For now, incoming IPC messages throttling is only enabled on the UIProcess' connections
1535         to the WebProcesses.
1536
1537         * Platform/IPC/Connection.cpp:
1538         (IPC::Connection::Connection):
1539         (IPC::Connection::enqueueIncomingMessage):
1540         (IPC::Connection::MessagesThrottler::MessagesThrottler):
1541         (IPC::Connection::MessagesThrottler::scheduleMessagesDispatch):
1542         (IPC::Connection::MessagesThrottler::numberOfMessagesToProcess):
1543         (IPC::Connection::dispatchIncomingMessages):
1544         * Platform/IPC/Connection.h:
1545         * Platform/IPC/mac/ConnectionMac.mm:
1546         (IPC::Connection::kill):
1547
1548 2018-06-22  Sihui Liu  <sihui_liu@apple.com>
1549
1550         REGRESSION (r231850): Cookie file cannot be read or written by network process
1551         https://bugs.webkit.org/show_bug.cgi?id=186806
1552         <rdar://problem/41113791>
1553
1554         Unreviewed. Fix failure after r233084 by adding missing initialization.
1555
1556         * UIProcess/WebProcessPool.cpp:
1557         (WebKit::WebProcessPool::ensureNetworkProcess):
1558
1559 2018-06-22  Jer Noble  <jer.noble@apple.com>
1560
1561         [Fullscreen] Home indicator should show and hide with status bar
1562         https://bugs.webkit.org/show_bug.cgi?id=186942
1563         <rdar://problem/41302190>
1564
1565         Reviewed by Tim Horton.
1566
1567         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1568         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1569         (-[WKFullScreenViewController showUI]):
1570         (-[WKFullScreenViewController hideUI]):
1571         (-[WKFullScreenViewController setPrefersHomeIndicatorAutoHidden:]):
1572
1573 2018-06-22  Jer Noble  <jer.noble@apple.com>
1574
1575         [Fullscreen] Add a pinch-to-exit gesture
1576         https://bugs.webkit.org/show_bug.cgi?id=186821
1577
1578         Reviewed by Tim Horton.
1579
1580         Add a pinch gesture recognizer that overrides the pan gesture recognizer when active. Hide the
1581         WKFullscreenViewController's controls while a dismiss gesture is active.
1582
1583         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
1584         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1585         (-[WKFullScreenViewController setAnimating:]):
1586         (-[WKFullScreenViewController prefersStatusBarHidden]):
1587         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
1588         (-[WKFullScreenViewController _touchDetected:]):
1589         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1590         (-[WKFullscreenAnimationController context]):
1591         (-[WKFullscreenAnimationController updateWithProgress:scale:translation:anchor:]):
1592         (-[WKFullScreenInteractiveTransition animator]):
1593         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withScale:andTranslation:]):
1594         (-[WKFullScreenWindowController enterFullScreen]):
1595         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1596         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
1597         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
1598         (-[WKFullScreenWindowController _dismissFullscreenViewController]):
1599         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
1600         (-[WKFullScreenWindowController _interactivePinchDismissChanged:]):
1601
1602 2018-06-22  Brian Burg  <bburg@apple.com>
1603
1604         [Cocoa] REGRESSION(W3C): actions for key equivalents are not respected
1605         https://bugs.webkit.org/show_bug.cgi?id=186936
1606
1607         Reviewed by Timothy Hatcher.
1608
1609         * UIProcess/Automation/WebAutomationSession.cpp:
1610         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
1611         This erroneously reported false unless there was both a mouse and key interaction
1612         being dispatched, which is not possible in the current serial event simulation model.
1613         As a result, Safari could not tell whether the action came from a simulated event
1614         or the user, and thus rejected all key equivalents like Cmd-A,V,C,X.
1615
1616 2018-06-22  Jer Noble  <jer.noble@apple.com>
1617
1618         [Fullscreen] Exit fullscreen when opening a new tab
1619         https://bugs.webkit.org/show_bug.cgi?id=186826
1620         <rdar://problem/40853211>
1621
1622         Reviewed by Brent Fulgham.
1623
1624         Make the fullscreen placeholder view a custom UIView, and exit fullscreen when the
1625         placeholder is removed from its superview.
1626
1627         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1628         (-[WKFullScreenPlaceholderView willMoveToSuperview:]):
1629         (-[WKFullScreenWindowController enterFullScreen]):
1630         (-[WKFullScreenWindowController _completedExitFullScreen]):
1631         (-[WKFullScreenWindowController placeholderWillMoveToSuperview:]):
1632         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
1633
1634 2018-06-22  Timothy Horton  <timothy_horton@apple.com>
1635
1636         Fix the build after r233089
1637
1638         * UIProcess/API/Cocoa/WKPreferences.mm:
1639         (-[WKPreferences _setColorFilterEnabled:]):
1640         (-[WKPreferences _colorFilterEnabled]):
1641
1642 2018-06-22  Chris Dumez  <cdumez@apple.com>
1643
1644         Crash under WebResourceLoadStatisticsStore::mergeStatistics(WTF::Vector<WebCore::ResourceLoadStatistics, 0ul, WTF::CrashOnOverflow, 16ul>&&)
1645         https://bugs.webkit.org/show_bug.cgi?id=186905
1646         <rdar://problem/41266775>
1647
1648         Reviewed by Brent Fulgham.
1649
1650         I believe the crash was caused by the WebResourceLoadStatisticsStore object being dead
1651         when mergeStatistics() is called. In particular, the crash was happening when the
1652         ResourceLoadStatisticsPersistentStorage's FileMonitor would detect a file change and
1653         we would re-sync statistics from the disk. The FileMonitor's lambda function was
1654         capturing |this| without ref'ing it, and the FileMonitor monitors the disk and
1655         calls the lambda on the background queue, while it gets destroyed on the main thread.
1656
1657         To make lifetime management less complex, the following changes were made:
1658         - The ResourceLoadStatisticsPersistentStorage object is now always constructed / used
1659           and destroyed on the background queue. We no longer have to worry about being on
1660           the right thread in a given method.
1661         - Now that ResourceLoadStatisticsPersistentStorage is always used from the background
1662           queue and no longer needs to be thread-safe, drop its ref() / deref() methods and
1663           use weak pointers instead to make sure the ResourceLoadStatisticsPersistentStorage
1664           is still alive when a lamdba gets called on the background queue.
1665         - For write scheduling use WorkQueue::dispatchAfter() and a WeakPtr instead of a
1666           RunLoop::Timer. This is more convenient to use as the RunLoop::Timer has to be used
1667           on the main thread.
1668
1669         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
1670         (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage):
1671         (WebKit::ResourceLoadStatisticsPersistentStorage::~ResourceLoadStatisticsPersistentStorage):
1672         (WebKit::ResourceLoadStatisticsPersistentStorage::startMonitoringDisk):
1673         (WebKit::ResourceLoadStatisticsPersistentStorage::monitorDirectoryForNewStatistics):
1674         (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore):
1675         * UIProcess/ResourceLoadStatisticsPersistentStorage.h:
1676         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1677         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1678         (WebKit::WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore):
1679         (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
1680         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
1681         (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
1682         (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
1683         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1684         * UIProcess/WebResourceLoadStatisticsStore.h:
1685
1686 2018-06-21  Jer Noble  <jer.noble@apple.com>
1687
1688         CRASH in WebCore::VideoFullscreenInterfaceMac::~VideoFullscreenInterfaceMac()
1689         https://bugs.webkit.org/show_bug.cgi?id=186892
1690
1691         Reviewed by Eric Carlson.
1692
1693         Protect against m_contentMap being mutated while its contents are being invalidated
1694         by moving the map into a local variable and iterating over it instead.
1695
1696         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1697         (WebKit::PlaybackSessionManagerProxy::invalidate):
1698         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1699         (WebKit::VideoFullscreenManagerProxy::invalidate):
1700
1701 2018-06-22  Luming Yin  <luming_yin@apple.com>
1702
1703         Expose colorFilterEnabled SPI in WKPreferencesPrivate.h
1704         https://bugs.webkit.org/show_bug.cgi?id=186935
1705         <rdar://problem/41109387>
1706
1707         Reviewed by Tim Horton.
1708
1709         * UIProcess/API/Cocoa/WKPreferences.mm:
1710         (-[WKPreferences _setColorFilterEnabled:]):
1711         (-[WKPreferences _colorFilterEnabled]):
1712         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
1713
1714 2018-06-22  Timothy Hatcher  <timothy@apple.com>
1715
1716         Recalc styles every time defaultAppearance changes.
1717         https://bugs.webkit.org/show_bug.cgi?id=186866
1718         rdar://problem/41309805
1719
1720         Reviewed by Tim Horton.
1721
1722         * UIProcess/WebPageProxy.cpp:
1723         (WebKit::WebPageProxy::setDefaultAppearance):
1724         * WebProcess/WebPage/WebPage.cpp:
1725         (WebKit::WebPage::setDefaultAppearance):
1726
1727 2018-06-22  Sihui Liu  <sihui_liu@apple.com>
1728
1729         REGRESSION (r231850): Cookie file cannot be read or written by network process
1730         https://bugs.webkit.org/show_bug.cgi?id=186806
1731         <rdar://problem/41113791>
1732
1733         Reviewed by Geoffrey Garen.
1734
1735         Add defaultSessionPendingCookies to NetworkProcessCreationParameters, so pending cookies of default session 
1736         can be added right after default session is set. This improves the fix r231850 as it does not send additional 
1737         message and avoids the regression.
1738
1739         * NetworkProcess/NetworkProcess.cpp:
1740         (WebKit::NetworkProcess::initializeNetworkProcess):
1741         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1742         (WebKit::NetworkProcessCreationParameters::encode const):
1743         (WebKit::NetworkProcessCreationParameters::decode):
1744         * NetworkProcess/NetworkProcessCreationParameters.h:
1745         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1746         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1747         * UIProcess/Network/NetworkProcessProxy.cpp:
1748         (WebKit::NetworkProcessProxy::NetworkProcessProxy):
1749         * UIProcess/WebProcessPool.cpp:
1750         (WebKit::WebProcessPool::ensureNetworkProcess):
1751
1752 2018-06-22  Brent Fulgham  <bfulgham@apple.com>
1753
1754         [iOS Debug] Multiple resourceLoadStatistics redirect tests are flaky timeouts
1755         https://bugs.webkit.org/show_bug.cgi?id=183216
1756         <rdar://problem/37992317>
1757
1758         Reviewed by Chris Dumez.
1759
1760         Improve consistency of test results by make sure that completion handlers written to run
1761         on the main thread are only called on the main thread. Add additional assertions to help
1762         catch any cases where this invariant is not being honored.
1763
1764         * UIProcess/WebResourceLoadStatisticsStore.cpp:
1765         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Use Completion handler and assert
1766         we are on the right thread.
1767         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Ditto.
1768         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): Ditto.
1769         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto.
1770         (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Ditto.
1771         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto.
1772         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Ditto.
1773         (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Ditto.
1774         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto.
1775         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto.
1776         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto.
1777         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto.
1778         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto.
1779         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto.
1780         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto.
1781         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto.
1782         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto.
1783         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto.
1784         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto.
1785         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto.
1786         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto.
1787         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto.
1788         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): 
1789         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
1790         (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
1791         (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
1792         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Update to perform callbacks
1793         on the main thread (as intended). This function was doing them on a work queue.
1794         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Ditto.
1795         (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Ditto.
1796         (WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains): Ditto.
1797         * UIProcess/WebResourceLoadStatisticsStore.h:
1798
1799 2018-06-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1800
1801         REGRESSION(r230950): [GTK] WebKit::CoordinatedBackingStoreTile::setBackBuffer(): WebKitWebProcess killed by SIGSEGV (ASSERTION FAILED: it != m_tiles.end())
1802         https://bugs.webkit.org/show_bug.cgi?id=186206
1803
1804         Unreviewed manual rollout of r230950
1805
1806         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1807         (WebKit::layerShouldHaveBackingStore):
1808
1809 2018-06-20  Darin Adler  <darin@apple.com>
1810
1811         [Cocoa] Use the isDirectory: variants of NSURL methods more to eliminate unnecessary file system activity
1812         https://bugs.webkit.org/show_bug.cgi?id=186875
1813
1814         Reviewed by Anders Carlsson.
1815
1816         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
1817         (API::WebsiteDataStore::tempDirectoryFileSystemRepresentation): Use isDirectory:YES to create a URL
1818         to the temporary directory.
1819         * UIProcess/Cocoa/WebViewImpl.mm:
1820         (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination): Use isDirectory:NO to create a URL
1821         pointing to the write location.
1822         * UIProcess/WebStorage/ios/LocalStorageDatabaseTrackerIOS.mm:
1823         (WebKit::LocalStorageDatabaseTracker::platformMaybeExcludeFromBackup const): Use isDirectory:YES to
1824         create a URL for the local storage directory.
1825         * UIProcess/ios/ResourceLoadStatisticsPersistentStorageIOS.mm:
1826         (WebKit::ResourceLoadStatisticsPersistentStorage::excludeFromBackup const): Use isDirectory:NO to
1827         create a URL for the storage directory.
1828         * UIProcess/ios/WKContentViewInteraction.mm:
1829         (-[WKContentView _prepareToDragPromisedBlob:]): Use isDirectory:NO to create a URL for the temporary
1830         file location.
1831         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1832         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]): Use isDirectory:NO
1833         to create a URL for the image file to upload.
1834         * UIProcess/mac/WebInspectorProxyMac.mm:
1835         (WebKit::WebInspectorProxy::inspectorPageURL): Use isDirectory:NO to create a URL for the HTML file.
1836         (WebKit::WebInspectorProxy::inspectorTestPageURL): Ditto.
1837         (WebKit::WebInspectorProxy::inspectorBaseURL): Ditto.
1838         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1839         (WebKit::WebChromeClient::createIconForFiles): Use isDirectory:NO to create a URL for the image file.
1840         * WebProcess/WebPage/mac/WebInspectorUIMac.mm:
1841         (WebKit::webInspectorUILocalizedStringsURL): Use isDirectory:NO to create a URL for the localized
1842         strings file.
1843
1844 2018-06-21  Chris Dumez  <cdumez@apple.com>
1845
1846         Unreviewed, rolling out r232995.
1847
1848         Seems to have caused flakiness
1849
1850         Reverted changeset:
1851
1852         "Implement IPC throttling to keep the main thread responsive
1853         when a process misbehaves"
1854         https://bugs.webkit.org/show_bug.cgi?id=186607
1855         https://trac.webkit.org/changeset/232995
1856
1857 2018-06-15  Jer Noble  <jer.noble@apple.com>
1858
1859         Address fullscreen api CSS env feedback
1860         https://bugs.webkit.org/show_bug.cgi?id=186684
1861
1862         Reviewed by Simon Fraser.
1863
1864         + Update the phishing alert text to be more explicit about the specific threats
1865           phishing sites represent.
1866         + Make the top inset static, rather than dynamic.
1867         + Add bottom, left, and right insets for completeness.
1868         + Set the fullscreen animation duration as well as delay.
1869         + Notify the page when the controls show and hide.
1870
1871         * UIProcess/WebFullScreenManagerProxy.cpp:
1872         (WebKit::WebFullScreenManagerProxy::setFullscreenInsets):
1873         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideTiming):
1874         (WebKit::WebFullScreenManagerProxy::setFullscreenControlsHidden):
1875         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop): Deleted.
1876         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay): Deleted.
1877         * UIProcess/WebFullScreenManagerProxy.h:
1878         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1879         (-[WKFullScreenViewController showUI]):
1880         (-[WKFullScreenViewController hideUI]):
1881         (-[WKFullScreenViewController viewWillAppear:]):
1882         (-[WKFullScreenViewController _effectiveFullscreenInsets]):
1883         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
1884         (-[WKFullScreenViewController _showPhishingAlert]):
1885         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]): Deleted.
1886         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1887         (WebKit::WebFullScreenManager::didExitFullScreen):
1888         (WebKit::WebFullScreenManager::setFullscreenInsets):
1889         (WebKit::WebFullScreenManager::setFullscreenAutoHideTiming):
1890         (WebKit::WebFullScreenManager::setFullscreenControlsHidden):
1891         (WebKit::WebFullScreenManager::setFullscreenInsetTop): Deleted.
1892         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay): Deleted.
1893         * WebProcess/FullScreen/WebFullScreenManager.h:
1894         * WebProcess/FullScreen/WebFullScreenManager.messages.in:
1895
1896 2018-06-21  Commit Queue  <commit-queue@webkit.org>
1897
1898         Unreviewed, rolling out r232884.
1899         https://bugs.webkit.org/show_bug.cgi?id=186891
1900
1901         "Introduced assertion failure in ~DisplayRefreshMonitorMac()."
1902         (Requested by perarne on #webkit).
1903
1904         Reverted changeset:
1905
1906         "DisplayRefreshMonitorMac should hold a weak pointer to
1907         WebPage."
1908         https://bugs.webkit.org/show_bug.cgi?id=186683
1909         https://trac.webkit.org/changeset/232884
1910
1911 2018-06-21  Jer Noble  <jer.noble@apple.com>
1912
1913         [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen
1914         https://bugs.webkit.org/show_bug.cgi?id=186822
1915
1916         Reviewed by Simon Fraser.
1917
1918         Set the minimum zoom, maximum zoom, zoom bouncing, and user scalability settings of the
1919         WKWebView's UIScrollView upon entering fullscreen, and restore those same settings upon
1920         exit. Override the viewport arguments upon entering fullscreen, restore them upon exit.
1921
1922         * Platform/IPC/ArgumentCoder.h:
1923         * Shared/WebCoreArgumentCoders.cpp:
1924         (IPC::ArgumentCoder<ViewportArguments>::decode):
1925         * Shared/WebCoreArgumentCoders.h:
1926         * UIProcess/WebPageProxy.h:
1927         (WebKit::WebPageProxy::forceAlwaysUserScalable const):
1928         * UIProcess/ios/WebPageProxyIOS.mm:
1929         (WebKit::WebPageProxy::setOverrideViewportArguments):
1930         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1931         (WebKit::WKWebViewState::applyTo):
1932         (WebKit::WKWebViewState::store):
1933         (-[WKFullScreenWindowController enterFullScreen]):
1934         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
1935         * WebProcess/WebPage/WebPage.h:
1936         (WebKit::WebPage::forceAlwaysUserScalable const):
1937         * WebProcess/WebPage/WebPage.messages.in:
1938         * WebProcess/WebPage/ios/WebPageIOS.mm:
1939         (WebKit::WebPage::setOverrideViewportArguments):
1940
1941 2018-06-21  Jer Noble  <jer.noble@apple.com>
1942
1943         [Fullscreen] Use secondary glyph style for fullscreen controls
1944         https://bugs.webkit.org/show_bug.cgi?id=186862
1945         <rdar://problem/41212210>
1946
1947         Reviewed by Tim Horton.
1948
1949         Adopt AVBackgroundView, and use its predefined enums to set the material and tint styles for
1950         the fullscreen controls.
1951
1952         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1953         (-[WKFullScreenViewController loadView]):
1954         * UIProcess/ios/fullscreen/WKFullscreenStackView.h:
1955         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm:
1956         (-[WKFullscreenStackView init]):
1957         (-[WKFullscreenStackView dealloc]):
1958         (-[WKFullscreenStackView addArrangedSubview:applyingMaterialStyle:tintEffectStyle:]):
1959         (-[WKFullscreenStackView layoutSubviews]):
1960         (+[WKFullscreenStackView baseEffects]): Deleted.
1961         (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]): Deleted.
1962         (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]): Deleted.
1963         (+[WKFullscreenStackView secondaryMaterialOverlayView]): Deleted.
1964         (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]): Deleted.
1965         (+[WKFullscreenStackView applySecondaryGlyphTintToView:]): Deleted.
1966         (-[WKFullscreenStackView initWithArrangedSubviews:axis:]): Deleted.
1967         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]): Deleted.
1968         (-[WKFullscreenStackView contentView]): Deleted.
1969         (-[WKFullscreenStackView _setArrangedSubviews:axis:]): Deleted.
1970         (-[WKFullscreenStackView setBounds:]): Deleted.
1971         (-[WKFullscreenStackView updateConstraints]): Deleted.
1972
1973 2018-06-21  Jer Noble  <jer.noble@apple.com>
1974
1975         [Fullscreen] Suspend page (and pause video) while phishing warning is presented
1976         https://bugs.webkit.org/show_bug.cgi?id=186856
1977         <rdar://problem/41212444>
1978
1979         Reviewed by Tim Horton.
1980
1981         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1982         (-[WKFullScreenViewController _showPhishingAlert]):
1983
1984 2018-06-21  David Fenton  <david_fenton@apple.com>
1985
1986         Unreviewed, rolling out r232989.
1987
1988         Causes API regressions on macOS
1989
1990         Reverted changeset:
1991
1992         "REGRESSION (r231850): Cookie file cannot be read or written
1993         by network process"
1994         https://bugs.webkit.org/show_bug.cgi?id=186806
1995         https://trac.webkit.org/changeset/232989
1996
1997 2018-06-21  Zan Dobersek  <zdobersek@igalia.com>
1998
1999         [GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions
2000         https://bugs.webkit.org/show_bug.cgi?id=186884
2001
2002         Reviewed by Carlos Garcia Campos.
2003
2004         * UIProcess/API/glib/WebKitAutomationSession.cpp:
2005         (webkitAutomationSessionCreate): Handle any host-certificate pair that's
2006         been set for this session, creating a GTlsCertificate object through
2007         loading from the specified certificate path and marking that certificate
2008         as allowed for the specified host through the
2009         webkit_web_context_allow_tls_certificate_for_host() API.
2010
2011 2018-06-21  Chris Dumez  <cdumez@apple.com>
2012
2013         Regression(r226990) : Crash under WebCore::Page::applicationWillResignActive
2014         https://bugs.webkit.org/show_bug.cgi?id=186850
2015         <rdar://problem/37394469>
2016
2017         Reviewed by Eric Carlson.
2018
2019         Make sure m_page is not null before calling applicationWillResignActive(). m_page
2020         gets nulled out when WebPage::close() is called. The crash trace seems to indicate
2021         we're calling applicationWillResignActive() on a Page that is dead since we crash
2022         accessing Page::mainFrame().
2023
2024         * WebProcess/WebPage/ios/WebPageIOS.mm:
2025         (WebKit::WebPage::applicationWillResignActive):
2026
2027 2018-06-21  Fujii Hironori  <Hironori.Fujii@sony.com>
2028
2029         [GTK] http/tests/misc/bubble-drag-events.html crashes
2030         https://bugs.webkit.org/show_bug.cgi?id=182352
2031
2032         Reviewed by Carlos Garcia Campos.
2033
2034         PingLoad::didFinish was called twice if it is used with
2035         NetworkDataTaskSoup. PingLoad is not a ref-counted object. It is
2036         destructed when PingLoad::didFinish is called.
2037
2038         PingLoad::didReceiveChallenge calls the ChallengeCompletionHandler
2039         with AuthenticationChallengeDisposition::Cancel to cancel the
2040         challenge and calls PingLoad::didFinish.
2041
2042         NetworkDataTaskSoup::continueAuthenticate calls
2043         didReceiveChallenge with a ChallengeCompletionHandler which calls
2044         didCompleteWithError. PingLoad::didCompleteWithError calls
2045         PingLoad::didFinish.
2046
2047         didCompleteWithError callback should not be called in the
2048         ChallengeCompletionHandler.
2049
2050         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2051         (WebKit::NetworkDataTaskSoup::continueAuthenticate): Do not call
2052         didFail() in the ChallengeCompletionHandler. Call
2053         invalidateAndCancel() instead.
2054
2055 2018-06-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2056
2057         [WebKit on watchOS] Fixed position elements sometimes flicker when scrolling
2058         https://bugs.webkit.org/show_bug.cgi?id=186860
2059         <rdar://problem/39953563>
2060
2061         Reviewed by Tim Horton.
2062
2063         Remove conditional guards that are no longer necessary, now that the oldest iOS version our builders support is
2064         iOS 11. Conditionalizing this logic only for iOS 11+ meant that on watchOS, we're always falling down the path
2065         where we don't schedule a visible content rect update until the next runloop, which makes it possible for a
2066         remote layer tree transaction to arrive and cause us to update the scrolling tree with stale viewport geometry.
2067
2068         Test: WKScrollViewTests.PositionFixedLayerAfterScrolling
2069
2070         * UIProcess/API/Cocoa/WKWebView.mm:
2071         (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
2072
2073 2018-06-20  Megan Gardner  <megan_gardner@apple.com>
2074
2075         Restrict Selection in contenteditable the extent of that contenteditable
2076         https://bugs.webkit.org/show_bug.cgi?id=186792
2077
2078         Reviewed by Wenson Hsieh.
2079
2080         We have not been checking to make sure that when we make a selection that it is restricted to 
2081         a single content editable on iOS. There is functionality to ensure this on mac, so it has been
2082         exposed and utilized for restricting the extent of a selection.
2083
2084         * WebProcess/WebPage/ios/WebPageIOS.mm:
2085         (WebKit::WebPage::updateSelectionWithTouches):
2086
2087 2018-06-19  Dean Jackson  <dino@apple.com>
2088
2089         Blank viewer comes up and then auto-dismisses when device is not connected to Internet
2090         https://bugs.webkit.org/show_bug.cgi?id=186825
2091         <rdar://problem/40294170>
2092
2093         Reviewed by Tim Horton.
2094
2095         Handle the case where the network load fails, and send that
2096         error onto QuickLook.
2097
2098         * UIProcess/Cocoa/DownloadClient.mm:
2099         (WebKit::DownloadClient::didReceiveResponse): Check for success.
2100         (WebKit::DownloadClient::processDidCrash): Cancel in the case of a crash.
2101         (WebKit::DownloadClient::didFail): Propagate the error onto QuickLook.
2102         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
2103         (-[_WKPreviewControllerDataSource failWithError:]): New method that calls
2104         the completion handler with the error data.
2105         (WebKit::SystemPreviewController::fail): New API method.
2106         * UIProcess/SystemPreviewController.h:
2107
2108 2018-06-19  Chris Dumez  <cdumez@apple.com>
2109
2110         Implement IPC throttling to keep the main thread responsive when a process misbehaves
2111         https://bugs.webkit.org/show_bug.cgi?id=186607
2112         <rdar://problem/41073205>
2113
2114         Reviewed by Geoffrey Garen.
2115
2116         Implement IPC throttling to keep the main thread responsive when a process misbehaves.
2117         Instead of doing one main runloop dispatch per incoming message, we now do a single
2118         runloop dispatch and process incoming messages in batch. We put a limit on the number
2119         of messages to be processed in a batch (600). If the queue is larger that this limit,
2120         we'll schedule a 0-timer to process remaining messages, giving the main runloop a chance
2121         to process other events. Additionally, if an IPC connection keeps hitting this maximum
2122         batch size limit, we implement back off and we'll further decrease the number of messages
2123         we process in each batch (going as low as 60). This keeps Safari responsive enough to
2124         allow the user to close the bad tab (even on older devices such as iPhone 5s).
2125
2126         Finally, if the incoming message queue becomes too large (50000), we go one step further
2127         and kill the IPC connection in order to maintain performance / battery life.
2128
2129         Every time we apply throttling or terminate a connection due to throttling, we do a
2130         RELEASE_LOG_ERROR() with useful information in order to help diagnose potential issues
2131         in the future.
2132
2133         * Platform/IPC/Connection.cpp:
2134         (IPC::Connection::Connection):
2135         (IPC::Connection::enqueueIncomingMessage):
2136         (IPC::Connection::MessagesThrottler::MessagesThrottler):
2137         (IPC::Connection::MessagesThrottler::scheduleMessagesDispatch):
2138         (IPC::Connection::MessagesThrottler::numberOfMessagesToProcess):
2139         (IPC::Connection::dispatchIncomingMessages):
2140         * Platform/IPC/Connection.h:
2141         * Platform/IPC/mac/ConnectionMac.mm:
2142         (IPC::Connection::kill):
2143
2144 2018-06-18  Jiewen Tan  <jiewen_tan@apple.com>
2145
2146         Make SecItemShim to not send return value for SecItemAdd
2147         https://bugs.webkit.org/show_bug.cgi?id=186789
2148         <rdar://problem/40892596>
2149
2150         Reviewed by Brent Fulgham.
2151
2152         Return value of SecItemAdd is often ignored. Even if it isn't, we don't have the ability to serialize SecKeychainItemRef.
2153         Otherwise, it would go through the weird route of serializing SecKeychainItemRef by asking Keychain for its persistent
2154         reference. This route contradicts the purpose of SecItemShim, which is to proxy all Keychain operations to UIProcess.
2155
2156         Also, this patch removes the release assertion on encode(Encoder&, SecAccessControlRef) and decode(Decoder&, RetainPtr<SecAccessControlRef>&)
2157         as they don't query Keychain.
2158
2159         * Shared/cf/ArgumentCodersCF.cpp:
2160         (IPC::encode):
2161         (IPC::decode):
2162         * Shared/mac/SecItemShim.cpp:
2163         (WebKit::sendSecItemRequest):
2164         (WebKit::webSecItemAdd):
2165         * UIProcess/mac/SecItemShimProxy.cpp:
2166         (WebKit::SecItemShimProxy::secItemRequest):
2167         * UIProcess/mac/SecItemShimProxy.h:
2168         * UIProcess/mac/SecItemShimProxy.messages.in:
2169
2170 2018-06-19  Sihui Liu  <sihui_liu@apple.com>
2171
2172         REGRESSION (r231850): Cookie file cannot be read or written by network process
2173         https://bugs.webkit.org/show_bug.cgi?id=186806
2174         <rdar://problem/41113791>
2175
2176         Reviewed by Geoffrey Garen.
2177
2178         Default websiteDataStore may be added wrongly to network process before default session was 
2179         set, as messages were asynchronous, so the cookie storage could be improperly set.   
2180
2181         * NetworkProcess/NetworkProcess.cpp:
2182         (WebKit::NetworkProcess::initializeNetworkProcess):
2183         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2184         (WebKit::NetworkProcessCreationParameters::encode const):
2185         (WebKit::NetworkProcessCreationParameters::decode):
2186         * NetworkProcess/NetworkProcessCreationParameters.h:
2187         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2188         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2189         * UIProcess/WebProcessPool.cpp:
2190         (WebKit::WebProcessPool::ensureNetworkProcess):
2191
2192 2018-06-19  Don Olmstead  <don.olmstead@sony.com>
2193
2194         Use getCurrentProcessID over getpid
2195         https://bugs.webkit.org/show_bug.cgi?id=186813
2196
2197         Reviewed by Alex Christensen.
2198
2199         * Shared/WebMemorySampler.cpp:
2200         (WebKit::WebMemorySampler::initializeTimers):
2201         (WebKit::WebMemorySampler::stop):
2202         (WebKit::WebMemorySampler::writeHeaders):
2203         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2204         (WebKit::WebSWContextManagerConnection::installServiceWorker):
2205
2206 2018-06-19  Don Olmstead  <don.olmstead@sony.com>
2207
2208         WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations does not invoke callback when Service Workers disabled
2209         https://bugs.webkit.org/show_bug.cgi?id=186809
2210
2211         Reviewed by Chris Dumez.
2212
2213         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2214         (WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations):
2215
2216 2018-06-19  Wenson Hsieh  <wenson_hsieh@apple.com>
2217
2218         [WebKit on watchOS] Vend username text content type when using scribble in login fields
2219         https://bugs.webkit.org/show_bug.cgi?id=186791
2220         <rdar://problem/41226935>
2221
2222         Reviewed by Beth Dakin.
2223
2224         Vend additional context to Quickboard when focusing an element that is likely to be a username field.
2225
2226         Test: fast/forms/watchos/username-text-content-type.html
2227
2228         * Shared/AssistedNodeInformation.cpp:
2229         (WebKit::AssistedNodeInformation::encode const):
2230         (WebKit::AssistedNodeInformation::decode):
2231         * Shared/AssistedNodeInformation.h:
2232
2233         Add a new flag to tell the UI process when the currently focused element is an autofillable username input
2234         field (using existing app autofill heuristics).
2235
2236         * UIProcess/API/Cocoa/WKWebView.mm:
2237         (-[WKWebView textContentTypeForTesting]):
2238         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2239
2240         Add new testing SPI to grab the computed text content type for the focused element.
2241
2242         * UIProcess/ios/WKContentViewInteraction.h:
2243         * UIProcess/ios/WKContentViewInteraction.mm:
2244         (contentTypeFromFieldName):
2245
2246         If `autocomplete="username"` is specified, return a username text content type. This was not originally added in
2247         r197626 because UITextContentTypeUsername was only introduced later, in iOS 11.
2248
2249         (-[WKContentView textContentTypeForListViewController:]):
2250         (-[WKContentView textContentTypeForTesting]):
2251         * WebProcess/WebPage/ios/WebPageIOS.mm:
2252         (WebKit::WebPage::getAssistedNodeInformation):
2253
2254 2018-06-19  Chris Dumez  <cdumez@apple.com>
2255
2256         Unreviewed, rolling out r232947.
2257
2258         Caused an API test to time out
2259
2260         Reverted changeset:
2261
2262         "Implement IPC throttling to keep the main thread responsive
2263         when a process misbehaves"
2264         https://bugs.webkit.org/show_bug.cgi?id=186607
2265         https://trac.webkit.org/changeset/232947
2266
2267 2018-06-19  Chris Dumez  <cdumez@apple.com>
2268
2269         HTTPHeaderMap wastes 226KB of HashTable capacity on cnn.com
2270         https://bugs.webkit.org/show_bug.cgi?id=186735
2271         <rdar://problem/41189164>
2272
2273         Reviewed by Geoffrey Garen.
2274
2275         * NetworkProcess/cache/NetworkCacheCoders.cpp:
2276         (WTF::Persistence::Coder<WebCore::HTTPHeaderMap>::decode):
2277
2278 2018-06-19  Youenn Fablet  <youenn@apple.com>
2279
2280         Network Preflights do not show in WebInspector after moving CORS checks to NetworkProcess
2281         https://bugs.webkit.org/show_bug.cgi?id=186312
2282         <rdar://problem/40495434>
2283
2284         Reviewed by Chris Dumez.
2285
2286         Add buffering of all request/response of a given load, including redirections and preflights.
2287         This buffering is switched on/off by a boolean which is switched on in case Web Inspector is launched.
2288
2289         Buffering is done in NetworkLoadChecker.
2290         We add ways to retrieve preflight information from NetworkCORSPreflightChecker.
2291
2292         Implement LoaderStrategy new methods through sync IPC.
2293
2294         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2295         (WebKit::NetworkCORSPreflightChecker::NetworkCORSPreflightChecker):
2296         (WebKit::NetworkCORSPreflightChecker::startPreflight):
2297         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
2298         (WebKit::NetworkCORSPreflightChecker::didReceiveResponseNetworkSession):
2299         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
2300         (WebKit::NetworkCORSPreflightChecker::takeInformation):
2301         * NetworkProcess/NetworkCORSPreflightChecker.h:
2302         * NetworkProcess/NetworkConnectionToWebProcess.h:
2303         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationRequest):
2304         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadIntermediateInformation):
2305         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformation):
2306         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
2307         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationResponse): Deleted.
2308         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2309         * NetworkProcess/NetworkLoadChecker.cpp:
2310         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2311         (WebKit::NetworkLoadChecker::check):
2312         (WebKit::NetworkLoadChecker::checkRedirection):
2313         (WebKit::NetworkLoadChecker::checkResponse):
2314         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2315         (WebKit::NetworkLoadChecker::storeRedirection):
2316         * NetworkProcess/NetworkLoadChecker.h:
2317         (WebKit::NetworkLoadChecker::takeNetworkLoadInformation):
2318         * NetworkProcess/NetworkResourceLoader.cpp:
2319         (WebKit::NetworkResourceLoader::didReceiveResponse):
2320         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2321         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2322         * NetworkProcess/PingLoad.cpp:
2323         (WebKit::PingLoad::PingLoad):
2324         * Scripts/webkit/messages.py:
2325         * WebProcess/Network/WebLoaderStrategy.cpp:
2326         (WebKit::WebLoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
2327         * WebProcess/Network/WebLoaderStrategy.h:
2328
2329 2018-06-19  Brent Fulgham  <bfulgham@apple.com>
2330
2331         MAP_JIT is not present for minimal simulator builds
2332         https://bugs.webkit.org/show_bug.cgi?id=186608
2333
2334         Reviewed by Darin Adler.
2335
2336         * Configurations/WebContent-iOS-minimalsimulator.entitlements:
2337
2338 2018-06-18  John Wilander  <wilander@apple.com>
2339
2340         Resource Load Statistics: Make sure to call callbacks even if there is no store (test infrastructure)
2341         https://bugs.webkit.org/show_bug.cgi?id=186777
2342         <rdar://problem/41216181>
2343
2344         Reviewed by Chris Dumez.
2345
2346         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2347         (WKWebsiteDataStoreStatisticsUpdateCookiePartitioning):
2348         (WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost):
2349         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2350         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2351
2352 2018-06-18  Chris Dumez  <cdumez@apple.com>
2353
2354         Crash under WebProcessPool::networkProcessFailedToLaunch():
2355         https://bugs.webkit.org/show_bug.cgi?id=186784
2356         <rdar://problem/33535377>
2357
2358         Reviewed by Brady Eidson.
2359
2360         * UIProcess/API/Cocoa/WKProcessPool.mm:
2361         (+[WKProcessPool _allProcessPoolsForTesting]):
2362         Add SPI to retrieve all WebProcessPool for testing purposes.
2363
2364         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2365         * UIProcess/Network/NetworkProcessProxy.cpp:
2366         (WebKit::NetworkProcessProxy::clearCallbackStates):
2367         Make iteration over completion handlers robust against completion handlers
2368         getting removed while we iterate.
2369
2370         (WebKit::NetworkProcessProxy::didClose):
2371         Ref the WebProcessPool (which keeps the NetworkProcessProxy alive too)
2372         as several calls within this method might cause the WebProcessPool /
2373         NetworkProcessProxy to get destroyed.
2374
2375 2018-06-18  Chris Dumez  <cdumez@apple.com>
2376
2377         Implement IPC throttling to keep the main thread responsive when a process misbehaves
2378         https://bugs.webkit.org/show_bug.cgi?id=186607
2379
2380         Reviewed by Geoffrey Garen.
2381
2382         Implement IPC throttling to keep the main thread responsive when a process misbehaves.
2383         Instead of doing one main runloop dispatch per incoming message, we now do a single
2384         runloop dispatch and process incoming messages in batch. We put a limit on the number
2385         of messages to be processed in a batch (600). If the queue is larger that this limit,
2386         we'll schedule a 0-timer to process remaining messages, giving the main runloop a chance
2387         to process other events. Additionally, if an IPC connection keeps hitting this maximum
2388         batch size limit, we implement back off and we'll further decrease the number of messages
2389         we process in each batch (going as low as 60). This keeps Safari responsive enough to
2390         allow the user to close the bad tab (even on older devices such as iPhone 5s).
2391
2392         Finally, if the incoming message queue becomes too large (50000), we go one step further
2393         and kill the IPC connection in order to maintain performance / battery life.
2394
2395         Every time we apply throttling or terminate a connection due to throttling, we do a
2396         RELEASE_LOG_ERROR() with useful information in order to help diagnose potential issues
2397         in the future.
2398
2399         * Platform/IPC/Connection.cpp:
2400         (IPC::Connection::Connection):
2401         (IPC::Connection::enqueueIncomingMessage):
2402         (IPC::Connection::MessagesThrottler::MessagesThrottler):
2403         (IPC::Connection::MessagesThrottler::scheduleMessagesDispatch):
2404         (IPC::Connection::MessagesThrottler::numberOfMessagesToProcess):
2405         (IPC::Connection::dispatchIncomingMessages):
2406         * Platform/IPC/Connection.h:
2407         * Platform/IPC/mac/ConnectionMac.mm:
2408         (IPC::Connection::kill):
2409
2410 2018-06-18  Jiewen Tan  <jiewen_tan@apple.com>
2411
2412         Add a graceful exit for AuthenticationManager::initializeConnection
2413         https://bugs.webkit.org/show_bug.cgi?id=186632
2414         <rdar://problem/41041033>
2415
2416         Reviewed by Brent Fulgham.
2417
2418         Add a graceful exit for AuthenticationManager::initializeConnection when the provided IPC connection
2419         is null or the underlying xpc connection is null.
2420
2421         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
2422         (WebKit::AuthenticationManager::initializeConnection):
2423
2424 2018-06-18  Youenn Fablet  <youenn@apple.com>
2425
2426         Validate Cross-Origin-Resource-Policy for resources cached in the MemoryCache
2427         https://bugs.webkit.org/show_bug.cgi?id=186639
2428         <rdar://problem/41106984>
2429
2430         Reviewed by Geoffrey Garen.
2431
2432         Make use of WebCore method to check CORP.
2433
2434         * NetworkProcess/NetworkLoadChecker.cpp:
2435         (WebKit::NetworkLoadChecker::validateResponse):
2436         * NetworkProcess/NetworkLoadChecker.h:
2437
2438 2018-06-18  Karl Leplat  <karl.leplat_ext@softathome.com>
2439
2440         [Threaded paintingEngine] Fix rendering glitches
2441         https://bugs.webkit.org/show_bug.cgi?id=186764
2442
2443         Reviewed by Žan Doberšek.
2444
2445         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
2446         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
2447         We call Nicosia::Buffer function waitUntilPaintingComplete()
2448         in order to synchronize of using Nicosia:buffer between MainThread
2449         and ThreadedCompositor.
2450
2451
2452 2018-06-17  Chris Dumez  <cdumez@apple.com>
2453
2454         Crash under SuspendedPageProxy::~SuspendedPageProxy()
2455         https://bugs.webkit.org/show_bug.cgi?id=186688
2456         <rdar://problem/41060769>
2457
2458         Reviewed by Darin Adler.
2459
2460         Ref the WebProcessProxy before calling suspendedPageWasDestroyed() on it as this
2461         might cause the WebProcessProxy / WebProcessPool to get destroyed otherwise, and
2462         we would crash trying to call unregisterSuspendedPageProxy() on the WebProcessPool
2463         on the next line.
2464
2465         * UIProcess/SuspendedPageProxy.cpp:
2466         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2467
2468 2018-06-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2469
2470         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 3)
2471         https://bugs.webkit.org/show_bug.cgi?id=186442
2472         <rdar://problem/40879364>
2473
2474         Reviewed by Darin Adler.
2475
2476         Rename a category referencing "Extra zoom mode".
2477
2478         * UIProcess/ios/WKContentViewInteraction.mm:
2479
2480 2018-06-12  Darin Adler  <darin@apple.com>
2481
2482         [Cocoa] Make some RetainPtr refinements to get more ready for ARC
2483         https://bugs.webkit.org/show_bug.cgi?id=186526
2484
2485         Reviewed by Anders Carlsson.
2486
2487         * Platform/cf/ModuleCF.cpp:
2488         (WebKit::Module::load): Use move assignment instead of adoptCF/leakRef.
2489
2490         * Shared/Cocoa/WKNSURLExtras.mm:
2491         (+[NSURL _web_URLWithWTFString:]): Cast to NSURL * instead of doing the autorelease
2492         here, since the NSURL * operator already does what we want.
2493         (+[NSURL _web_URLWithWTFString:relativeToURL:]): Ditto.
2494
2495         * UIProcess/ios/WKContentView.mm:
2496         (-[WKContentView _wk_printedDocument]): Get rid of incorrect use of
2497         RetainPtr::autorelease. We don't want to null out _printedDocument each time this
2498         function is called.
2499
2500         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
2501         (collectIcons): Get rid of unnecessary use of RetainPtr::autorelease in a function
2502         that returns a RetainPtr.
2503
2504 2018-06-15  Chris Dumez  <cdumez@apple.com>
2505
2506         Add API test coverage for SW RegistrationDatabase destruction and fix issues found by the test
2507         https://bugs.webkit.org/show_bug.cgi?id=186681
2508
2509         Reviewed by Brady Eidson.
2510
2511         Make sure StorageProcess::unregisterSWServerConnection() does not unnecessarily
2512         create a SWServer. Otherwise, we were in quick session destroying the SWServer
2513         and then re-constructing it for the same sessionID, merely to try ot unregister
2514         a SWServerConnection.
2515
2516         * StorageProcess/StorageProcess.cpp:
2517         (WebKit::StorageProcess::existingSWOriginStoreForSession const):
2518         (WebKit::StorageProcess::unregisterSWServerConnection):
2519         * StorageProcess/StorageProcess.h:
2520
2521 2018-06-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2522
2523         [WinCairo] Move unrelated features of WorkQueueWin into IPC::Connection
2524         https://bugs.webkit.org/show_bug.cgi?id=186582
2525
2526         Add EventListener private class to handle signaled tasks for I/O.
2527         Originally they were in WTF::WorkQueueWin, but those features were not related
2528         to WorkQueue and only used in IPC::ConnectionWin. Moved logic is more specialized
2529         than old generalized logic. That was unneeded generalization.
2530
2531         Reviewed by Brent Fulgham.
2532
2533         * Platform/IPC/Connection.h:
2534         (IPC::Connection::EventListener::state):
2535         * Platform/IPC/win/ConnectionWin.cpp:
2536         (IPC::Connection::platformInitialize):
2537         (IPC::Connection::platformInvalidate):
2538         (IPC::Connection::readEventHandler):
2539         (IPC::Connection::writeEventHandler):
2540         (IPC::Connection::invokeReadEventHandler):
2541         (IPC::Connection::invokeWriteEventHandler):
2542         (IPC::Connection::open):
2543         (IPC::Connection::sendOutgoingMessage):
2544         (IPC::Connection::EventListener::open):
2545         (IPC::Connection::EventListener::callback):
2546         (IPC::Connection::EventListener::close):
2547
2548 2018-06-15  Brady Eidson  <beidson@apple.com>
2549
2550         Crash in both StorageProcess and UIProcess when using custom WKWebsiteDataStores for data management.
2551         <rdar://problem/41019893> and https://bugs.webkit.org/show_bug.cgi?id=186682
2552
2553         Reviewed by Chris Dumez.
2554
2555         * UIProcess/Storage/StorageProcessProxy.cpp:
2556         (WebKit::StorageProcessProxy::didClose): Protect this and the process pool as the cleanup that follows
2557           might cause either to get destroyed.
2558
2559         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2560         (WebKit::WebsiteDataStore::fetchDataAndApply): Protect the operating WebsiteDataStore while async operations
2561           are in flight. Otherwise if the data store is destroyed, the SessionIDs for those operations will get
2562           destroyed before they complete.
2563         (WebKit::WebsiteDataStore::removeData): Ditto.
2564
2565 2018-06-15  Per Arne Vollan  <pvollan@apple.com>
2566
2567         Unreviewed build fix after r232634.
2568
2569         * WebProcess/WebPage/DrawingArea.h:
2570         * WebProcess/WebPage/DrawingArea.messages.in:
2571
2572 2018-06-15  Per Arne Vollan  <pvollan@apple.com>
2573
2574         DisplayRefreshMonitorMac should hold a weak pointer to WebPage.
2575         https://bugs.webkit.org/show_bug.cgi?id=186683
2576
2577         Reviewed by Brent Fulgham.
2578
2579         Instead of DisplayRefreshMonitorMac having a RefPtr to WebPage, it should have a weak pointer.
2580         Having a RefPtr could in theory create reference cycles. This potential problem has not been
2581         observed in practice, but it is safer to use a weak pointer.
2582
2583         * WebProcess/WebPage/WebPage.h:
2584         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
2585         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
2586         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
2587         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
2588
2589 2018-06-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2590
2591         [GTK][WKE] Disable memory pressure handling when running layout tests (WTR)
2592         https://bugs.webkit.org/show_bug.cgi?id=186663
2593
2594         Reviewed by Michael Catanzaro.
2595
2596         r196943 added a mechanism to disable the memory pressure handling
2597         on Mac. This patch enables using that mechanism also for GTK/WPE.
2598         To do that the environment variable WEBKIT_DISABLE_MEMORY_PRESSURE_MONITOR
2599         should bet set to 1.
2600         We want to use this on the layout tests to avoid flaky tests caused
2601         by accumulated leaks on the WebProcess by different tests.
2602
2603         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2604         (WebKit::WebProcessPool::platformInitializeWebProcess):
2605         * UIProcess/wpe/WebProcessPoolWPE.cpp:
2606         (WebKit::WebProcessPool::platformInitializeWebProcess):
2607
2608 2018-06-15  Per Arne Vollan  <pvollan@apple.com>
2609
2610         Rollout r231818, as it introduced regression on tickets.com.
2611         https://bugs.webkit.org/show_bug.cgi?id=186675
2612
2613         Unreviewed, rolling out.
2614
2615         * UIProcess/WebPageProxy.cpp:
2616         (WebKit::WebPageProxy::dispatchActivityStateChange):
2617         * UIProcess/mac/DisplayLink.cpp:
2618         (WebKit::DisplayLink::pause): Deleted.
2619         (WebKit::DisplayLink::resume): Deleted.
2620         * UIProcess/mac/DisplayLink.h:
2621
2622 2018-06-15  Thibault Saunier  <tsaunier@igalia.com>
2623
2624         [GTK][WPE]: Avoid using uninitialized launchOptions in getLaunchOptions
2625         https://bugs.webkit.org/show_bug.cgi?id=185611
2626
2627         Reviewed by Chris Dumez.
2628
2629         Otherwise we might segfault.
2630
2631         * UIProcess/Plugins/PluginProcessProxy.cpp:
2632         (WebKit::PluginProcessProxy::getLaunchOptions):
2633
2634 2018-06-14  Youenn Fablet  <youenn@apple.com>
2635
2636         Make NetworkProcess get cache storage parameters at creation of the CacheStorage engine
2637         https://bugs.webkit.org/show_bug.cgi?id=186166
2638
2639         Reviewed by Alex Christensen.
2640
2641         Make CacheStorage::Engine creation asynchronous.
2642         Update Engine public methods be static methods taking a SessionID, which will be used to create the engine.
2643
2644         Add IPC methods to retrieve cache storage parameters from NetworkProcess to UIProcess.
2645
2646         Add NetworkProcessProxy ability to compute the cache storage parameters based on the SessionID.
2647         For that purpose, make NetworkProcessProxy store a map of SessionID-to-WebsiteDataStore.
2648
2649         * NetworkProcess/NetworkProcess.cpp:
2650         (WebKit::NetworkProcess::deleteWebsiteData):
2651         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
2652         (WebKit::NetworkProcess::cacheStorageParameters):
2653         (WebKit::NetworkProcess::setCacheStorageParameters):
2654         (WebKit::NetworkProcess::cacheStorageDirectory const): Deleted.
2655         (WebKit::NetworkProcess::cacheStoragePerOriginQuota const): Deleted.
2656         * NetworkProcess/NetworkProcess.h:
2657         * NetworkProcess/NetworkProcess.messages.in:
2658         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2659         (WebKit::NetworkProcessCreationParameters::encode const):
2660         (WebKit::NetworkProcessCreationParameters::decode):
2661         * NetworkProcess/NetworkProcessCreationParameters.h:
2662         * NetworkProcess/cache/CacheStorageEngine.cpp:
2663         (WebKit::CacheStorage::Engine::from):
2664         (WebKit::CacheStorage::Engine::fetchEntries):
2665         (WebKit::CacheStorage::Engine::open):
2666         (WebKit::CacheStorage::Engine::remove):
2667         (WebKit::CacheStorage::Engine::retrieveCaches):
2668         (WebKit::CacheStorage::Engine::retrieveRecords):
2669         (WebKit::CacheStorage::Engine::putRecords):
2670         (WebKit::CacheStorage::Engine::deleteMatchingRecords):
2671         (WebKit::CacheStorage::Engine::lock):
2672         (WebKit::CacheStorage::Engine::unlock):
2673         (WebKit::CacheStorage::Engine::clearMemoryRepresentation):
2674         (WebKit::CacheStorage::Engine::representation):
2675         (WebKit::CacheStorage::Engine::clearAllCaches):
2676         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2677         (WebKit::CacheStorage::Engine::Engine):
2678         (WebKit::CacheStorage::Engine::readCachesFromDisk):
2679         (WebKit::CacheStorage::Engine::defaultEngine): Deleted.
2680         * NetworkProcess/cache/CacheStorageEngine.h:
2681         (WebKit::CacheStorage::Engine::shouldPersist const):
2682         (WebKit::CacheStorage::Engine::weakPtrFactory):
2683         (WebKit::CacheStorage::Engine::create): Deleted.
2684         * NetworkProcess/cache/CacheStorageEngineConnection.cpp:
2685         (WebKit::CacheStorageEngineConnection::~CacheStorageEngineConnection):
2686         (WebKit::CacheStorageEngineConnection::open):
2687         (WebKit::CacheStorageEngineConnection::remove):
2688         (WebKit::CacheStorageEngineConnection::caches):
2689         (WebKit::CacheStorageEngineConnection::retrieveRecords):
2690         (WebKit::CacheStorageEngineConnection::deleteMatchingRecords):
2691         (WebKit::CacheStorageEngineConnection::putRecords):
2692         (WebKit::CacheStorageEngineConnection::reference):
2693         (WebKit::CacheStorageEngineConnection::dereference):
2694         (WebKit::CacheStorageEngineConnection::clearMemoryRepresentation):
2695         (WebKit::CacheStorageEngineConnection::engineRepresentation):
2696         * NetworkProcess/cache/CacheStorageEngineConnection.h:
2697         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2698         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2699         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2700         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2701         * Shared/WebsiteDataStoreParameters.cpp:
2702         (WebKit::WebsiteDataStoreParameters::encode const):
2703         (WebKit::WebsiteDataStoreParameters::decode):
2704         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
2705         * Shared/WebsiteDataStoreParameters.h:
2706         (): Deleted.
2707         * UIProcess/Network/NetworkProcessProxy.cpp:
2708         (WebKit::NetworkProcessProxy::addSession):
2709         (WebKit::NetworkProcessProxy::removeSession):
2710         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
2711         * UIProcess/Network/NetworkProcessProxy.h:
2712         * UIProcess/Network/NetworkProcessProxy.messages.in:
2713         * UIProcess/WebProcessPool.cpp:
2714         (WebKit::WebProcessPool::ensureNetworkProcess):
2715         (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
2716         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2717         (WebKit::WebProcessPool::pageEndUsingWebsiteDataStore):
2718         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2719         (WebKit::WebsiteDataStore::parameters):
2720         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2721         (WebKit::WebsiteDataStore::~WebsiteDataStore):
2722
2723 2018-06-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2724
2725         [Win] Add IPC error case for broken pipe
2726         https://bugs.webkit.org/show_bug.cgi?id=186445
2727
2728         Add error handling for ERROR_BROKEN_PIPE on IPC::Connection::readEventHandler.
2729
2730         Reviewed by Ryosuke Niwa.
2731
2732         * Platform/IPC/win/ConnectionWin.cpp:
2733         (IPC::Connection::readEventHandler):
2734
2735 2018-06-14  John Wilander  <wilander@apple.com>
2736
2737         Resource Load Statistics: Shortcut classification for redirect to prevalent resource
2738         https://bugs.webkit.org/show_bug.cgi?id=186627
2739         <rdar://problem/41132308>
2740
2741         Reviewed by Brent Fulgham.
2742
2743         This patch shortcuts classification of redirect collusion so that we more seldom
2744         have to rely on the recursive backtrace of the redirect graph. The initial
2745         implementation of Resource Load Statistics actually had this classification method.
2746
2747         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2748         (WebKit::WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent):
2749             Iterates through a non-classified resource's data for where it has redirected
2750             and classifies it as prevalent if has redirected to 
2751         (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
2752             Now calls WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent()
2753             before regular classification steps. 
2754         * UIProcess/WebResourceLoadStatisticsStore.h:
2755
2756 2018-06-14  Youenn Fablet  <youenn@apple.com>
2757
2758         Apply CSP checks before Content blocker checks in NetworkLoadChecker as done by CachedResourceLoader
2759         https://bugs.webkit.org/show_bug.cgi?id=186550
2760
2761         Reviewed by Alex Christensen.
2762
2763         Do CSP checks and URL upgrade before content blocker checks.
2764
2765         * NetworkProcess/NetworkLoadChecker.cpp:
2766         (WebKit::NetworkLoadChecker::checkRequest):
2767         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2768
2769 2018-06-14  Brent Fulgham  <bfulgham@apple.com>
2770
2771         Plug-in Process crashing on Mojave (affects Flash, others)
2772         https://bugs.webkit.org/show_bug.cgi?id=186628
2773         <rdar://problem/41120462>
2774
2775         Reviewed by Eric Carlson.
2776
2777         Add the missing “com.apple.security.cs.allow-unsigned-executable-memory” entitlement. Also alphabetize
2778         the entitlements file to make it easier to read.
2779
2780         * Configurations/PluginService.entitlements:
2781
2782 2018-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2783
2784         [GTK][WPE] WebDriver: handle acceptInsecureCertificates capability
2785         https://bugs.webkit.org/show_bug.cgi?id=186560
2786
2787         Reviewed by Brian Burg.
2788
2789         * UIProcess/API/glib/WebKitAutomationSession.cpp:
2790         (webkitAutomationSessionCreate): Check the acceptInsecureCertificates capability and set the TLS error policy in
2791         the WebContext accordingly if needed.
2792         * UIProcess/API/glib/WebKitAutomationSessionPrivate.h:
2793         * UIProcess/API/glib/WebKitWebContext.cpp:
2794         * UIProcess/Cocoa/AutomationClient.h:
2795         * UIProcess/Cocoa/AutomationClient.mm:
2796         (WebKit::AutomationClient::requestAutomationSession): Use SessionCapabilities to fill the session configuration.
2797         (WebKit::AutomationClient::requestAutomationSessionWithCapabilities): Deleted.
2798
2799 2018-06-13  Adrian Perez de Castro  <aperez@igalia.com>
2800
2801         [WPE] Trying to access the remote inspector hits an assertion in the UIProcess
2802         https://bugs.webkit.org/show_bug.cgi?id=186588
2803
2804         Reviewed by Carlos Garcia Campos.
2805
2806         Make both the WPE and GTK+ ports use /org/webkit/inspector as base prefix
2807         for resource paths, which avoids needing a switcheroo depending on the port.
2808
2809         * UIProcess/API/wpe/WebKit2InspectorGResourceBundle.xml:
2810         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
2811         (WebKit::WebInspectorProxy::inspectorPageURL):
2812         (WebKit::WebInspectorProxy::inspectorTestPageURL):
2813         (WebKit::WebInspectorProxy::inspectorBaseURL):
2814         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
2815         (WebKit::WebInspectorProxy::inspectorPageURL):
2816         (WebKit::WebInspectorProxy::inspectorTestPageURL):
2817         (WebKit::WebInspectorProxy::inspectorBaseURL):
2818         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
2819         (WebKit::WebInspectorUI::localizedStringsURL):
2820         (WebKit::RemoteWebInspectorUI::localizedStringsURL):
2821
2822 2018-06-13  Chris Dumez  <cdumez@apple.com>
2823
2824         Crash under SWServer::unregisterConnection(Connection&)
2825         https://bugs.webkit.org/show_bug.cgi?id=186584
2826         <rdar://problem/40931680>
2827
2828         Reviewed by Youenn Fablet.
2829
2830         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2831         * StorageProcess/ServiceWorker/WebSWServerConnection.h:
2832         * StorageProcess/StorageToWebProcessConnection.cpp:
2833         (WebKit::StorageToWebProcessConnection::~StorageToWebProcessConnection):
2834         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2835         (WebKit::StorageToWebProcessConnection::didReceiveSyncMessage):
2836         (WebKit::StorageToWebProcessConnection::didClose):
2837         (WebKit::StorageToWebProcessConnection::unregisterSWConnections):
2838         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
2839         * StorageProcess/StorageToWebProcessConnection.h:
2840
2841 2018-06-13  Dean Jackson  <dino@apple.com>
2842
2843         Disable AR support in WKWebView clients
2844         https://bugs.webkit.org/show_bug.cgi?id=186611
2845         <rdar://problem/39544684>
2846
2847         Reviewed by Jon Lee.
2848
2849         Since it hasn't been adequately tested, System Preview (AR) should
2850         be disabled by default for WKWebViews.
2851
2852         Add a new WebPreference, and SPI into WKWebViewConfiguration. Also
2853         don't register the WebViewContentProvider if the feature is
2854         disabled.
2855
2856         * Shared/WebPreferences.yaml:
2857         * UIProcess/API/Cocoa/WKWebView.mm:
2858         (-[WKWebView _initializeWithConfiguration:]):
2859         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2860         (-[WKWebViewConfiguration init]):
2861         (-[WKWebViewConfiguration encodeWithCoder:]):
2862         (-[WKWebViewConfiguration initWithCoder:]):
2863         (-[WKWebViewConfiguration copyWithZone:]):
2864         (-[WKWebViewConfiguration _contentProviderRegistry]):
2865         (-[WKWebViewConfiguration _systemPreviewEnabled]):
2866         (-[WKWebViewConfiguration _setSystemPreviewEnabled:]):
2867         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2868         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.h:
2869         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2870         (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
2871         (-[WKWebViewContentProviderRegistry init]): Deleted.
2872
2873 2018-06-13  Youenn Fablet  <youenn@apple.com>
2874
2875         Supported plugin check should be based on plugin identifier
2876         https://bugs.webkit.org/show_bug.cgi?id=186578
2877         <rdar://problem/40523828>
2878
2879         Reviewed by Darin Adler.
2880
2881         Refactoring to move from Plugin name to Plugin identifier.
2882         Set built-in pdf plugin identifier.
2883         This allows making sure that the PDF plug-in check might not change according localization.
2884
2885         * Scripts/webkit/messages.py:
2886         * Shared/WebCoreArgumentCoders.cpp:
2887         (IPC::ArgumentCoder<PluginInfo>::encode):
2888         (IPC::ArgumentCoder<PluginInfo>::decode):
2889         * UIProcess/Plugins/PluginInfoStore.cpp:
2890         (WebKit::PluginInfoStore::supportedPluginIdentifiers):
2891         (WebKit::PluginInfoStore::addSupportedPlugin):
2892         (WebKit::PluginInfoStore::supportedPluginNames): Deleted.
2893         * UIProcess/Plugins/PluginInfoStore.h:
2894         * UIProcess/WebProcessProxy.cpp:
2895         (WebKit::WebProcessProxy::getPlugins):
2896         * UIProcess/WebProcessProxy.h:
2897         * UIProcess/WebProcessProxy.messages.in:
2898         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2899         (WebKit::PDFPlugin::pluginInfo):
2900         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
2901         (WebKit::WebPluginInfoProvider::pluginInfo):
2902         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
2903         (WebKit::WebPluginInfoProvider::populatePluginCache):
2904         * WebProcess/Plugins/WebPluginInfoProvider.h:
2905
2906 2018-06-13  Chris Dumez  <cdumez@apple.com>
2907
2908         PSON: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html ASSERTS with process swap enabled
2909         https://bugs.webkit.org/show_bug.cgi?id=186545
2910
2911         Reviewed by Brady Eidson.
2912
2913         Move frame navigation logging for ITP purposes from the WebProcess to the UIProcess.
2914         This information was previously logged in DocumentLoader::willSendRequest() and was getting
2915         sync'd to the UIProcess at regular intervals or when the layout tests call testRunner's
2916         statisticsNotifyObserver(). We now do the logging directly in the UIProcess, in
2917         WebPageProxy::decidePolicyForNavigationAction (which was getting called via IPC from
2918         DocumentLoader::willSendRequest()).
2919
2920         This is more efficient and will also be needed soon due to the way process swap on navigation 
2921         deals with cross-origin redirects. On cross-origin redirect of the main frame, PSON cancels
2922         the load and started a new load to the redirected to URL in the new WebProcess. As a result,
2923         the new WebProcess is not aware that the load is a redirect, which is information that ITP
2924         requires. By moving the ITP logging to the UIProcess, we still have access to this
2925         information.
2926
2927         * UIProcess/WebPageProxy.cpp:
2928         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2929         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2930         * UIProcess/WebPageProxy.h:
2931         * UIProcess/WebPageProxy.messages.in:
2932         - We now pass the full redirect response the the delegate method instead of a simple
2933         isRedirect boolean.
2934         - Log the navigation in the WebResourceLoadStatisticsStore for ITP purposes.
2935
2936         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2937         (WebKit::areDomainsAssociated):
2938         Equivalent of ResourceLoadObserver's areDomainsAssociated(). Most of the logic was moved
2939         to ResourceLoadStatistics::areDomainsAssociated() to avoid code duplication.
2940
2941         (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
2942         This is called whenever a WebProcess sends new resource load statistics to the UIProcess.
2943         Whenever this happens, we call processStatisticsAndDataRecords() right away, which is
2944         sometimes the tests currently rely on. As a result, we can cancels any pending statistics
2945         processing request that was scheduled by logFrameNavigation().
2946
2947         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsProcessingRequestIfNecessary):
2948         (WebKit::WebResourceLoadStatisticsStore::cancelPendingStatisticsProcessingRequest):
2949         Whenever a navigation is logged and statistics have been updated, we need to make sure we
2950         schedule a "timer" to process the new data. We do this at most every 5 seconds for performance
2951         reasons. This 5 second interval matches what the ResourceLoadObserver is using in the WebProcess
2952         to notify the UIProcess of new data.
2953
2954         (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
2955         This code was moved from ResourceLoadObserver to WebResourceLoadStatisticsStore now that we
2956         do this logging in the UIProcess instead of the WebProcess. One difference with WebCore is
2957         that we use WebPageProxy::pageLoadState().url() as mainFrameURL instead of
2958         WebPageProxy::mainFrame().url(). The reason for that is that WebPageProxy::mainFrame().url()
2959         becomes empty in case of process swap but ITP still needs the actual main frame URL when the
2960         navigation was triggered. WebPageProxy::pageLoadState().url() gives us this information.
2961
2962         * UIProcess/WebResourceLoadStatisticsStore.h:
2963
2964         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2965         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2966         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2967         We now pass the full redirect response the the delegate method instead of a simple
2968         isRedirect boolean.
2969
2970 2018-06-13  Brent Fulgham  <bfulgham@apple.com>
2971
2972         Crash during interrupted process termination
2973         https://bugs.webkit.org/show_bug.cgi?id=185373
2974         <rdar://problem/40019480>
2975
2976         Reviewed by Alex Christensen.
2977
2978         It's possible to encounter a crash if a user agent feature (such as Safari's responsiveness timer) decides
2979         to kill a Web Process around the same time that a user decides to trigger a new page load. One of the two
2980         termination operations may attempt to call methods on a nulled process pointer.
2981
2982         We can avoid this by holding our own reference to the terminating process until the termination steps have
2983         been completed.
2984
2985         * UIProcess/API/C/WKPage.cpp:
2986         (WKPageTerminate): Ref<> the active process while the termination call is performed.
2987         * UIProcess/API/Cocoa/WKWebView.mm:
2988         ([WKWebView _killWebContentProcessAndResetState]): Ditto.
2989
2990 2018-06-13  Brian Burg  <bburg@apple.com>
2991
2992         [Cocoa] Web Automation: wrong modifiers sent for 'Help' virtual key
2993         https://bugs.webkit.org/show_bug.cgi?id=186600
2994         <rdar://problem/41088912>
2995
2996         Reviewed by Timothy Hatcher.
2997
2998         This fixes a hang when running W3C test:
2999
3000             special_keys.py::test_webdriver_special_key_sends_keydown[HELP-expected2]
3001
3002         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3003         (WebKit::eventModifierFlagsForVirtualKey):
3004         The help modifier doesn't seem to be used when pressing the Help key.
3005         I verified this using the Help key on the Keyboard Viewer, since no
3006         keyboards from the past decade actually have this physical button.
3007
3008 2018-06-13  Thibault Saunier  <tsaunier@igalia.com>
3009
3010         [WPE] Build getUserMedia support
3011         https://bugs.webkit.org/show_bug.cgi?id=186547
3012
3013         Reviewed by Alejandro G. Castro.
3014
3015         * SourcesWPE.txt: Compile files necessary for MediaStream/webrtc.
3016
3017 2018-06-13  Andy Estes  <aestes@apple.com>
3018
3019         [iOS] Synchronize PDF resizing with device rotation
3020         https://bugs.webkit.org/show_bug.cgi?id=186587
3021         <rdar://problem/40922462>
3022
3023         Reviewed by Darin Adler.
3024
3025         Both -beginPDFViewRotation and -endPDFViewRotation need to be called as part of
3026         the transition coordinator's -animateAlongsideTransition: block to be synchronized
3027         with rotation. Additionally, updateBlock needs to be invoked between the two calls
3028         so that PDFKit can capture the frame geometry before and after the update.
3029
3030         * UIProcess/API/Cocoa/WKWebView.mm:
3031         (-[WKWebView _beginAnimatedResizeWithUpdates:]):
3032         * UIProcess/Cocoa/WKWebViewContentProvider.h:
3033         * UIProcess/ios/WKPDFView.mm:
3034         (-[WKPDFView web_beginAnimatedResizeWithUpdates:]):
3035         (-[WKPDFView web_beginAnimatedResize]): Renamed to web_beginAnimatedResizeWithUpdates:.
3036         (-[WKPDFView web_endAnimatedResize]): Deleted.
3037
3038 2018-06-12  Brent Fulgham  <bfulgham@apple.com>
3039
3040         Turn CSS Spring Animations and Link Preload off by default for production builds.
3041         https://bugs.webkit.org/show_bug.cgi?id=186548
3042         <rdar://problem/41023774>
3043
3044         Reviewed by Eric Carlson.
3045
3046         * Shared/WebPreferences.yaml: Switch these features from 'on' to
3047         DEFAULT_EXPERIMENTAL_FEATURES_ENABLED.
3048
3049 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3050
3051         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 2)
3052         https://bugs.webkit.org/show_bug.cgi?id=186442
3053         <rdar://problem/40879364>
3054
3055         Reviewed by Tim Horton.
3056
3057         Upstream most of the work around form controls on watchOS. Also, rename WKFormControlListViewController.* to
3058         its intended name, WKQuickboardListViewController.*.
3059
3060         * UIProcess/ios/WKContentViewInteraction.mm:
3061         * UIProcess/ios/forms/WKDatePickerViewController.h:
3062         * UIProcess/ios/forms/WKDatePickerViewController.mm:
3063         (datePickerSetButtonHeight):
3064         (datePickerVerticalMargin):
3065         (-[WKDatePickerWheelLabel initWithFrame:]):
3066         (-[WKDatePickerWheelLabel lastSelectedDate]):
3067         (-[WKDatePickerWheelLabel setLastSelectedDate:]):
3068         (-[WKDatePickerWheelLabel needsUpdateForIndex:selectedDate:]):
3069         (-[WKDatePickerWheel initWithStyle:]):
3070         (-[WKDatePickerWheel initWithController:style:]):
3071         (-[WKDatePickerWheel gestureRecognized:]):
3072         (-[WKDatePickerWheel setDrawsFocusOutline:]):
3073         (-[WKDatePickerWheel drawsFocusOutline]):
3074         (-[WKDatePickerWheel gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3075         (-[WKDatePickerViewController initWithDelegate:]):
3076         (-[WKDatePickerViewController viewDidLoad]):
3077         (-[WKDatePickerViewController prefersStatusBarHidden]):
3078         (-[WKDatePickerViewController viewWillAppear:]):
3079         (-[WKDatePickerViewController viewDidAppear:]):
3080         (-[WKDatePickerViewController viewDidDisappear:]):
3081         (-[WKDatePickerViewController _handleStatusBarNavigation]):
3082         (-[WKDatePickerViewController viewWillLayoutSubviews]):
3083         (-[WKDatePickerViewController becomeFirstResponder]):
3084         (-[WKDatePickerViewController defaultMinimumDate]):
3085         (-[WKDatePickerViewController defaultMaximumDate]):
3086         (-[WKDatePickerViewController _valueForInput]):
3087         (-[WKDatePickerViewController _dateFromInitialText]):
3088         (-[WKDatePickerViewController _setButtonPressed]):
3089         (-[WKDatePickerViewController _updateSelectedPickerViewIndices]):
3090         (-[WKDatePickerViewController _configurePickerView:]):
3091         (-[WKDatePickerViewController setMinimumDate:]):
3092         (-[WKDatePickerViewController minimumDate]):
3093         (-[WKDatePickerViewController setMaximumDate:]):
3094         (-[WKDatePickerViewController maximumDate]):
3095         (-[WKDatePickerViewController setDate:]):
3096         (-[WKDatePickerViewController setDateFromComponents:]):
3097         (-[WKDatePickerViewController setDay:month:year:era:]):
3098         (-[WKDatePickerViewController date]):
3099         (-[WKDatePickerViewController _dateComponentForDay:month:year:era:]):
3100         (-[WKDatePickerViewController _adjustDateToValidDateIfNecessary]):
3101         (-[WKDatePickerViewController _createAndConfigureGranularityLabelWithText:]):
3102         (-[WKDatePickerViewController _canonicalizeAndUpdateSelectedDate]):
3103         (-[WKDatePickerViewController numberOfItemsInPickerView:]):
3104         (-[WKDatePickerViewController pickerView:viewForItemAtIndex:]):
3105         (-[WKDatePickerViewController didBeginInteractingWithDatePicker:]):
3106         (-[WKDatePickerViewController pickerView:didSelectItemAtIndex:]):
3107         (-[WKDatePickerViewController pickerViewWillBeginSelection:]):
3108         (-[WKDatePickerViewController pickerViewDidEndSelection:]):
3109         (-[WKDatePickerViewController _dayFromIndex:]):
3110         (-[WKDatePickerViewController _eraAndYearFromIndex:]):
3111         (-[WKDatePickerViewController _monthFromIndex:]):
3112         (-[WKDatePickerViewController _indexFromDay:]):
3113         (-[WKDatePickerViewController _indexFromYear:era:]):
3114         (-[WKDatePickerViewController _indexFromMonth:]):
3115         * UIProcess/ios/forms/WKFormControlListViewController.h: Removed.
3116         * UIProcess/ios/forms/WKFormControlListViewController.mm: Removed.
3117         * UIProcess/ios/forms/WKNumberPadViewController.h:
3118         * UIProcess/ios/forms/WKNumberPadViewController.mm:
3119         (inputLabelFontSize):
3120         (-[WKNumberPadViewController initWithDelegate:initialText:inputMode:]):
3121         (-[WKNumberPadViewController dealloc]):
3122         (-[WKNumberPadViewController viewDidLoad]):
3123         (-[WKNumberPadViewController viewWillDisappear:]):
3124         (-[WKNumberPadViewController viewWillLayoutSubviews]):
3125         (-[WKNumberPadViewController _reloadHeaderViewFromInputText]):
3126         (-[WKNumberPadViewController didSelectKey:]):
3127         (-[WKNumberPadViewController _handleKeyPress:]):
3128         (-[WKNumberPadViewController _cancelInput]):
3129         (-[WKNumberPadViewController _deleteLastInputCharacter]):
3130         (-[WKNumberPadViewController _deleteButtonPressed]):
3131         (-[WKNumberPadViewController _cancelDeletionTimers]):
3132         (-[WKNumberPadViewController _startDeletionTimer]):
3133         (-[WKNumberPadViewController _deletionTimerFired]):
3134         (-[WKNumberPadViewController addContentViewAnimations:]):
3135         * UIProcess/ios/forms/WKQuickboardListViewController.h: Added.
3136         * UIProcess/ios/forms/WKQuickboardListViewController.mm: Added.
3137         (-[WKQuickboardListItemCell topToLabelBaselineSpecValue]):
3138         (-[WKQuickboardListItemCell baselineToBottomSpecValue]):
3139         (-[WKQuickboardListViewController initWithDelegate:]):
3140         (-[WKQuickboardListViewController updateContextViewIfNeeded]):
3141         (-[WKQuickboardListViewController prefersStatusBarHidden]):
3142         (-[WKQuickboardListViewController viewDidLoad]):
3143         (-[WKQuickboardListViewController viewWillAppear:]):
3144         (-[WKQuickboardListViewController viewDidDisappear:]):
3145         (-[WKQuickboardListViewController _handleStatusBarNavigation]):
3146         (-[WKQuickboardListViewController reloadContextView]):
3147         (-[WKQuickboardListViewController actionController]):
3148         (-[WKQuickboardListViewController languageControllerDidChangePrimaryLanguage:]):
3149         (-[WKQuickboardListViewController headerContentViewHeight]):
3150         (-[WKQuickboardListViewController headerContentView]):
3151         (configureStatusBarForController):
3152         * UIProcess/ios/forms/WKSelectMenuListViewController.h:
3153         * UIProcess/ios/forms/WKSelectMenuListViewController.mm:
3154         (-[WKSelectMenuItemCell initWithStyle:reuseIdentifier:]):
3155         (-[WKSelectMenuItemCell imageView]):
3156         (-[WKSelectMenuListViewController initWithDelegate:]):
3157         (-[WKSelectMenuListViewController viewDidLoad]):
3158         (-[WKSelectMenuListViewController acceptButtonTappedWithCompletion:]):
3159         (-[WKSelectMenuListViewController shouldShowTrayView]):
3160         (-[WKSelectMenuListViewController didSelectListItem:]):
3161         (-[WKSelectMenuListViewController numberOfListItems]):
3162         (-[WKSelectMenuListViewController heightForListItem:width:]):
3163         (-[WKSelectMenuListViewController cellForListItem:]):
3164         (-[WKSelectMenuListViewController selectItemAtIndex:]):
3165         * UIProcess/ios/forms/WKTimePickerViewController.h:
3166         * UIProcess/ios/forms/WKTimePickerViewController.mm:
3167         (-[WKTimePickerViewController initWithDelegate:]):
3168         (-[WKTimePickerViewController dateFormatter]):
3169         (-[WKTimePickerViewController timeValueForFormControls]):
3170         (-[WKTimePickerViewController dateComponentsFromInitialValue]):
3171         (-[WKTimePickerViewController viewDidAppear:]):
3172         (-[WKTimePickerViewController viewDidLoad]):
3173         (-[WKTimePickerViewController becomeFirstResponder]):
3174         (-[WKTimePickerViewController setHour:minute:]):
3175         (-[WKTimePickerViewController leftButtonWOTAction]):
3176         (-[WKTimePickerViewController rightButtonWOTAction]):
3177         * WebKit.xcodeproj/project.pbxproj:
3178
3179 2018-06-12  Jer Noble  <jer.noble@apple.com>
3180
3181         Make Modern EME An Experimental Feature Again
3182         https://bugs.webkit.org/show_bug.cgi?id=186569
3183         <rdar://problem/41054402>
3184
3185         Reviewed by Eric Carlson.
3186
3187         * Shared/WebPreferences.yaml:
3188
3189 2018-06-12  Andy Estes  <aestes@apple.com>
3190
3191         [watchOS] Enable NetworkActivityTracker
3192         https://bugs.webkit.org/show_bug.cgi?id=186568
3193         <rdar://problem/41050624>
3194
3195         Reviewed by Tim Horton.
3196
3197         * NetworkProcess/NetworkActivityTracker.h:
3198
3199 2018-06-12  Antti Koivisto  <antti@apple.com>
3200
3201         Add performance logging for slow cache retrieves
3202         https://bugs.webkit.org/show_bug.cgi?id=186520
3203         <rdar://problem/41002070>
3204
3205         Reviewed by Chris Dumez.
3206
3207         We sometimes see slow cache retrieves in logs. Add some more logging to better analyze these cases.
3208
3209         This patch adds timings to all cache storage retrieve operations and passes them up to the client.
3210         We then log the timings on NetworkResourceLoader levels if needed. Items logged include
3211
3212         - total retrieve time
3213         - dispatch delay and number of resources dispatched before this one
3214         - record I/O time
3215         - blob I/O time
3216         - whether cache shrink was in progress
3217         - whether cache synchronization was in progress
3218         - cancellation
3219
3220         * NetworkProcess/NetworkResourceLoader.cpp:
3221         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3222         (WebKit::NetworkResourceLoader::logSlowCacheRetrieveIfNeeded):
3223
3224         Log if the retrieve took more than 1s.
3225
3226         * NetworkProcess/NetworkResourceLoader.h:
3227         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3228         (WebKit::CacheStorage::Caches::readRecord):
3229         * NetworkProcess/cache/NetworkCache.cpp:
3230         (WebKit::NetworkCache::Cache::retrieve):
3231         (WebKit::NetworkCache::Cache::completeRetrieve):
3232         (WebKit::NetworkCache::Cache::retrieveData):
3233         * NetworkProcess/cache/NetworkCache.h:
3234         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
3235         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveEntryFromStorage):
3236         (WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):
3237
3238         SpeculativeLoadManager does not records specific timings yet but at least we do log when they occur.
3239
3240         * NetworkProcess/cache/NetworkCacheStorage.cpp:
3241         (WebKit::NetworkCache::Storage::ReadOperation::cancel):
3242         (WebKit::NetworkCache::Storage::ReadOperation::finish):
3243
3244         Record timing info in ReadOperations.
3245
3246         (WebKit::NetworkCache::Storage::dispatchReadOperation):
3247         (WebKit::NetworkCache::retrieveFromMemory):
3248         (WebKit::NetworkCache::Storage::retrieve):
3249         * NetworkProcess/cache/NetworkCacheStorage.h:
3250
3251 2018-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3252
3253         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.4 release.
3254
3255         * gtk/NEWS: Add release notes for 2.21.4.
3256
3257 2018-06-11  Youenn Fablet  <youenn@apple.com>
3258
3259         Improve error messages in case FetchEvent.respondWith has a rejected promise
3260         https://bugs.webkit.org/show_bug.cgi?id=186368
3261
3262         Reviewed by Chris Dumez.
3263
3264         Log in JS console in case of failures.
3265         Rely on ThreadableLoader to log which client actually failed.
3266
3267         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3268         (WebKit::ServiceWorkerClientFetch::didFail):
3269
3270 2018-06-11  Chris Dumez  <cdumez@apple.com>
3271
3272         http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html times out with PSON enabled
3273         https://bugs.webkit.org/show_bug.cgi?id=186546
3274
3275         Reviewed by Brady Eidson.
3276
3277         Disable process swap on navigation in frames that have opened other frames via
3278         window.open(). These new windows may have a WindowProxy to their opener, and it
3279         would therefore be unsafe to process swap at this point.
3280
3281         * Shared/NavigationActionData.cpp:
3282         (WebKit::NavigationActionData::encode const):
3283         (WebKit::NavigationActionData::decode):
3284         * Shared/NavigationActionData.h:
3285         * UIProcess/API/APINavigation.h:
3286         (API::Navigation::setHasOpenedFrames):
3287         (API::Navigation::hasOpenedFrames const):
3288         * UIProcess/WebPageProxy.cpp:
3289         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3290         * UIProcess/WebProcessPool.cpp:
3291         (WebKit::WebProcessPool::processForNavigationInternal):
3292         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3293         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3294
3295 2018-06-11  Keith Rollin  <krollin@apple.com>
3296
3297         Add logging around internalError(const URL&)
3298         https://bugs.webkit.org/show_bug.cgi?id=186369
3299         <rdar://problem/40872046>
3300
3301         Reviewed by Brent Fulgham.
3302
3303         There are times when we receive bug reports where the user says that
3304         they are simply shown a page saying an internal error occurred. To
3305         help understand the circumstances of that error, add some logging to
3306         internalError() in WebErrors.cpp. This logging logs at the Error level
3307         that internalError() was called and then logs a backtrace.
3308
3309         * Shared/WebErrors.cpp:
3310         (WebKit::internalError):
3311
3312 2018-06-11  Tim Horton  <timothy_horton@apple.com>
3313
3314         Link drag image is inconsistently unreadable in dark mode
3315         https://bugs.webkit.org/show_bug.cgi?id=186472
3316
3317         Reviewed by Timothy Hatcher.
3318
3319         * UIProcess/Cocoa/WebViewImpl.mm:
3320         (WebKit::WebViewImpl::useDefaultAppearance):
3321         Make defaultAppearance accurate even if useSystemAppearance is false.
3322         Some parts of WebKit (like the link drag image, but also context menus)
3323         want to be able to follow the system appearance regardless of whether
3324         the view or content has opted in.
3325
3326 2018-06-11  Chris Dumez  <cdumez@apple.com>
3327
3328         http/tests/security/cors-post-redirect-307.html fails with PSON enabled
3329         https://bugs.webkit.org/show_bug.cgi?id=186441
3330
3331         Reviewed by Brady Eidson.
3332
3333         Rename existing flag to something a bit more generic, now that it is used for
3334         more things than bypassing the navigation policy check.
3335
3336         * Shared/LoadParameters.cpp:
3337         (WebKit::LoadParameters::encode const):
3338         (WebKit::LoadParameters::decode):
3339         * Shared/LoadParameters.h:
3340         * UIProcess/WebPageProxy.cpp:
3341         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3342         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3343         (WebKit::WebPageProxy::loadRequest):
3344         (WebKit::WebPageProxy::loadRequestWithNavigation):
3345         (WebKit::WebPageProxy::goToBackForwardItem):
3346         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3347         * UIProcess/WebPageProxy.h:
3348         * WebProcess/WebPage/WebPage.cpp:
3349         (WebKit::WebPage::loadRequest):
3350         (WebKit::WebPage::goToBackForwardItem):
3351         * WebProcess/WebPage/WebPage.h:
3352         * WebProcess/WebPage/WebPage.messages.in:
3353
3354 2018-06-11  Nan Wang  <n_wang@apple.com>
3355
3356         AX: [iOS] accessibility sometimes doesn't know process suspension is canceled
3357         https://bugs.webkit.org/show_bug.cgi?id=186450
3358
3359         Reviewed by Chris Fleizach.
3360
3361         There's some early return condition in WebProcess::cancelPrepareToSuspend() which
3362         could lead to accessibility failing to post process status notificaiton. Fixed it
3363         by moving the accessibility notification before the early return condition.
3364
3365         * WebProcess/WebProcess.cpp:
3366         (WebKit::WebProcess::cancelPrepareToSuspend):
3367
3368 2018-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3369
3370         [GTK][WPE] Add API run run javascript from a WebKitWebView in an isolated world
3371         https://bugs.webkit.org/show_bug.cgi?id=186192
3372
3373         Reviewed by Michael Catanzaro.
3374
3375         Add webkit_web_view_run_javascript_in_world() that receives a world name. Also add
3376         webkit_script_world_new_with_name() to create an isolated world with a name and webkit_script_world_get_name()
3377         to get the name of a WebKitScriptWorld.
3378
3379         * UIProcess/API/glib/WebKitWebView.cpp:
3380         (webkit_web_view_run_javascript):
3381         (webkit_web_view_run_javascript_finish):
3382         (webkit_web_view_run_javascript_in_world):
3383         (webkit_web_view_run_javascript_in_world_finish):
3384         * UIProcess/API/gtk/WebKitWebView.h:
3385         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols.
3386         * UIProcess/API/wpe/WebKitWebView.h:
3387         * UIProcess/WebPageProxy.cpp:
3388         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): Send RunJavaScriptInMainFrameScriptWorld message to
3389         the WebProcess.
3390         * UIProcess/WebPageProxy.h:
3391         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
3392         (webkitScriptWorldCreate):
3393         (webkit_script_world_new_with_name):
3394         (webkit_script_world_get_name):
3395         * WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.h:
3396         * WebProcess/InjectedBundle/API/wpe/WebKitScriptWorld.h:
3397         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
3398         (WebKit::InjectedBundleScriptWorld::find): Find an InjectedBundleScriptWorld by its name.
3399         * WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
3400         * WebProcess/WebPage/WebPage.cpp:
3401         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld): Find the InjectedBundleScriptWorld for the given name
3402         and run the script in its js context.
3403         * WebProcess/WebPage/WebPage.h:
3404         * WebProcess/WebPage/WebPage.messages.in: Add RunJavaScriptInMainFrameScriptWorld message.
3405
3406 2018-06-10  Chris Dumez  <cdumez@apple.com>
3407
3408         Reload the Web view in case of crash if the client does not implement webViewWebContentProcessDidTerminate delegate
3409         https://bugs.webkit.org/show_bug.cgi?id=186468
3410
3411         Reviewed by Geoffrey Garen.
3412
3413         We now attempt to reload the Web view if the web content process crashes and the client
3414         does not implement the webViewWebContentProcessDidTerminate delegate (or any of the similar
3415         delegates in our SPI).
3416