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