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