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