f8f739337ae05f3cdaf49ee7b1729dbc6b4f67f1
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-03-30  Dan Bernstein  <mitz@apple.com>
2
3         Update availability annotations to match the macOS 10.13.4 and iOS 11.3 GM SDKs
4         https://bugs.webkit.org/show_bug.cgi?id=184173
5
6         Reviewed by Alex Christensen.
7
8         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13.4 and 11.3, respectively, in all declarations that
9         appear in the GM SDKs.
10
11         * Shared/API/Cocoa/_WKNSWindowExtras.h:
12         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
13         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
14         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
15         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
16         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
17         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
18         * UIProcess/API/Cocoa/WKViewPrivate.h:
19         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
20         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
21         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
22         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
23         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
24         * UIProcess/API/Cocoa/_WKAttachment.h:
25         * UIProcess/API/Cocoa/_WKAutomationSession.h:
26         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
27         * UIProcess/API/Cocoa/_WKDownload.h:
28         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
29         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
30         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
31         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
32         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
33         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
34         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
35         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
36         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
37         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
38
39 2018-03-30  Youenn Fablet  <youenn@apple.com>
40
41         NetworkLoadChecker should upgrade redirects if needed
42         https://bugs.webkit.org/show_bug.cgi?id=184098
43
44         Reviewed by Chris Dumez.
45
46         In case of redirections, upgrade URL according CSP.
47
48         * NetworkProcess/NetworkLoadChecker.cpp:
49         (WebKit::NetworkLoadChecker::checkRequest):
50         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
51
52 2018-03-30  JF Bastien  <jfbastien@apple.com>
53
54         Update messages.py codegen for String, fix tests
55         https://bugs.webkit.org/show_bug.cgi?id=184179
56         <rdar://problem/39041352>
57
58         Reviewed by Mark Lam.
59
60         I updated some of the code in
61         https://trac.webkit.org/changeset/230097 and auto-magically used a
62         script to update copyright headers... and that broke the tests
63         which checked for a particular date. Update all of the headers.
64
65         Part of this change updates the code generated by messages.py
66
67         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
68         * Scripts/webkit/MessageReceiver-expected.cpp:
69         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
70         * Scripts/webkit/MessagesSuperclass-expected.h:
71         * Scripts/webkit/messages.py:
72         * Scripts/webkit/messages_unittest.py:
73         (GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
74         generate a better error message
75
76 2018-03-29  JF Bastien  <jfbastien@apple.com>
77
78         Use Forward.h instead of forward-declaring WTF::String
79         https://bugs.webkit.org/show_bug.cgi?id=184172
80         <rdar://problem/39026146>
81
82         Reviewed by Yusuke Suzuki.
83
84         As part of #184164 I'm changing WTF::String, and the forward
85         declarations are just wrong because I'm making it templated. We
86         should use Forward.h anyways, so do that instead.
87
88         * Scripts/webkit/LegacyMessages-expected.h:
89         * Scripts/webkit/Messages-expected.h:
90         * Scripts/webkit/MessagesSuperclass-expected.h:
91         * UIProcess/WebOpenPanelResultListenerProxy.h:
92
93 2018-03-29  Brian Burg  <bburg@apple.com>
94
95         Web Automation: clipToViewport is ignored for element screenshots
96         https://bugs.webkit.org/show_bug.cgi?id=184158
97         <rdar://problem/39014307>
98
99         Reviewed by Timothy Hatcher.
100
101         In §19.2 Take Element Screenshot, step 5.2 says that we should clip
102         the element screenshot rect with the visible viewport rect. We don't
103         do that right now even though we pass over clipToViewport.
104
105         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
106         (WebKit::snapshotRectForScreenshot):
107         Clip the rect to viewport if needed.
108
109         (WebKit::WebAutomationSessionProxy::takeScreenshot):
110         This scrollIntoView is misplaced; by this point we have already done
111         the math to figure out the screenshot rect. Move it before computing the rect.
112
113 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
114
115         REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection::initializeSendSource()
116         https://bugs.webkit.org/show_bug.cgi?id=184122
117         <rdar://problem/39003606>
118
119         Reviewed by Chris Dumez.
120
121         One of the new assertions added in r230035 begin firing while running tests locally. This was happening
122         because the WebInspector was attempting to open a new connection to a web process that had already
123         terminated its mach port connection (a dead port).
124         
125         We should avoid opening new connections when the port we were given is already dead.
126
127         * Platform/IPC/Connection.h:
128         (IPC::Connection::identifierIsValid): Added.
129         * Platform/IPC/mac/ConnectionMac.mm:
130         (IPC::Connection::platformInitialize): Do not perform initialization on a dead (or null) port.
131         (IPC::Connection::open): Add some assertions that ports are in a valid state.
132         (IPC::Connection::sendOutgoingMessage): Assert that the send port is not dead.
133         (IPC::Connection::receiveSourceEventHandler): Assert that the receive port is valid.
134         * UIProcess/ChildProcessProxy.cpp:
135         (WebKit::ChildProcessProxy::didFinishLaunching): Treat a dead port as a signal that the
136         child process failed to launch.
137         * UIProcess/Network/NetworkProcessProxy.cpp:
138         (WebKit::NetworkProcessProxy::didFinishLaunching): Ditto.
139         * UIProcess/Plugins/PluginProcessProxy.cpp:
140         (WebKit::PluginProcessProxy::didFinishLaunching): Ditto.
141         * UIProcess/Storage/StorageProcessProxy.cpp:
142         (WebKit::StorageProcessProxy::didFinishLaunching): Ditto.
143         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
144         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Ditto.
145         * WebProcess/WebPage/WebInspectorUI.cpp:
146         (WebKit::WebInspectorUI::establishConnection): Ditto.
147         * WebProcess/WebProcess.cpp:
148         (WebKit::WebProcess::ensureNetworkProcessConnection): Ditto.
149         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Ditto.
150
151 2018-03-29  Youenn Fablet  <youenn@apple.com>
152
153         Synchronize SecurityOrigin related scheme registries with NetworkProcess
154         https://bugs.webkit.org/show_bug.cgi?id=184140
155
156         Reviewed by Chris Dumez.
157
158         Add syncing of scheme registries that are used by SecurityOrigin and ContentSecurityPolicy
159         so that we can properly use them in NetworkProcess as we do in WebProcess.
160         The registries that are not synced are:
161         - URLSchemeAsEmptyDocument
162         - URLSchemeDomainRelaxationForbidden
163         - URLSchemeAsCachePartitioned
164         - URLSchemeAsCanDisplayOnlyIfCanRequest
165
166         * NetworkProcess/NetworkProcess.cpp:
167         (WebKit::NetworkProcess::initializeNetworkProcess):
168         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
169         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
170         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
171         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
172         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
173         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
174         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
175         * NetworkProcess/NetworkProcess.h:
176         * NetworkProcess/NetworkProcess.messages.in:
177         * NetworkProcess/NetworkProcessCreationParameters.cpp:
178         (WebKit::NetworkProcessCreationParameters::encode const):
179         (WebKit::NetworkProcessCreationParameters::decode):
180         * NetworkProcess/NetworkProcessCreationParameters.h:
181         * UIProcess/WebProcessPool.cpp:
182         (WebKit::WebProcessPool::ensureNetworkProcess):
183         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
184         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
185         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
186         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
187         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
188         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
189         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
190
191 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
192
193         REGRESSION(r229480): ERROR: Unhandled web process message 'WebCookieManager:SetHTTPCookieAcceptPolicy'
194         https://bugs.webkit.org/show_bug.cgi?id=184124
195         <rdar://problem/38998971>
196
197         Reviewed by Chris Dumez.
198
199         Cookie accept policy messages were still being sent to the WebContent process after
200         I removed cookie access in r229480. The WebContent process no longer recognizes these
201         messages, and generates logging to that effect.
202         
203         This patch stops sending these unnecessary messages to the WebContent process. Only the
204         Network process needs to receive this information.
205
206         * UIProcess/WebCookieManagerProxy.cpp:
207         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
208
209 2018-03-29  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
210
211         [WPE] Floating point exception in WebEventFactory::createWebWheelEvent
212         https://bugs.webkit.org/show_bug.cgi?id=184037
213
214         Reviewed by Žan Doberšek.
215
216         * Shared/wpe/WebEventFactory.cpp:
217         (WebKit::WebEventFactory::createWebWheelEvent): Use std::copysign() to avoid division by 0.
218
219 2018-03-28  Zalan Bujtas  <zalan@apple.com>
220
221         Make it possible to override the screen size
222         https://bugs.webkit.org/show_bug.cgi?id=184111
223         <rdar://problem/38972181>
224
225         Reviewed by Tim Horton.
226
227         * Shared/WebPageCreationParameters.cpp:
228         (WebKit::WebPageCreationParameters::encode const):
229         (WebKit::WebPageCreationParameters::decode):
230         * Shared/WebPageCreationParameters.h:
231         * UIProcess/WebPageProxy.cpp:
232         (WebKit::WebPageProxy::creationParameters):
233         * UIProcess/WebPageProxy.h:
234         * UIProcess/ios/WebPageProxyIOS.mm:
235         (WebKit::WebPageProxy::overrideScreenSize):
236         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
237         (WebKit::WebChromeClient::overrideScreenSize const):
238         * WebProcess/WebCoreSupport/WebChromeClient.h:
239         * WebProcess/WebPage/WebPage.cpp:
240         * WebProcess/WebPage/WebPage.h:
241         * WebProcess/WebPage/ios/WebPageIOS.mm:
242         (WebKit::WebPage::overrideScreenSize const):
243
244 2018-03-28  Chris Dumez  <cdumez@apple.com>
245
246         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
247         https://bugs.webkit.org/show_bug.cgi?id=183962
248         <rdar://problem/38817833>
249
250         Reviewed by Brady Eidson.
251
252         Swap WebProcess on for the initial navigation in a new Window that was opened
253         via window.open(), when the new URL is cross-origin compared to the opener's
254         origin. For now, we only swap process if 'noopener' property is set when calling
255         window.open(). This is because we do not support the remote DOMWindows yet.
256
257         * Shared/NavigationActionData.cpp:
258         (WebKit::NavigationActionData::encode const):
259         (WebKit::NavigationActionData::decode):
260         * Shared/NavigationActionData.h:
261         * UIProcess/API/APINavigation.h:
262         (API::Navigation::setIsCrossOriginWindowOpenNavigation):
263         (API::Navigation::isCrossOriginWindowOpenNavigation const):
264         (API::Navigation::setOpener):
265         (API::Navigation::opener const):
266         * UIProcess/WebPageProxy.cpp:
267         (WebKit::WebPageProxy::receivedPolicyDecision):
268         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
269         * UIProcess/WebProcessPool.cpp:
270         (WebKit::WebProcessPool::processForNavigation):
271         * UIProcess/WebProcessPool.h:
272         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
273         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
274
275 2018-03-28  Per Arne Vollan  <pvollan@apple.com>
276
277         Adopt WEBPROCESS_WINDOWSERVER_BLOCKING compiler guard in WebProcess.
278         https://bugs.webkit.org/show_bug.cgi?id=183959
279         <rdar://problem/38965719>
280
281         Reviewed by Brent Fulgham.
282
283         Use the compile guard to guard the call to CGSSetDenyWindowServerConnections.
284
285         * WebProcess/WebProcess.cpp:
286         (WebKit::WebProcess::initializeProcess):
287
288 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
289
290         Unreviewed build fix after r230045.
291
292         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Add missing include (breaks iOS).
293
294 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
295
296         Protect against invalid mach ports returned by mach_port_request_notification
297         https://bugs.webkit.org/show_bug.cgi?id=184106
298         <rdar://problem/37865316>
299
300         Reviewed by Chris Dumez.
301
302         * Platform/IPC/Connection.h:
303         (IPC::Connection::Identifier::Identifier): Use default initializer syntax.
304         * Platform/IPC/mac/ConnectionMac.mm:
305         (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging.
306         (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification'
307         and clean up if it experienced an error.
308         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
309         (WebKit::ProcessLauncher::launchProcess): Ditto.
310
311 2018-03-28  Dean Jackson  <dino@apple.com>
312
313         WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
314         https://bugs.webkit.org/show_bug.cgi?id=184107
315         <rdar://problem/38967492>
316
317         Reviewed by Tim Horton.
318
319         There is no need for this class to be a UIScrollViewDelegate. Instead
320         the protocol should have an optional method that is effectively
321         scrollViewDidScroll.
322
323         * UIProcess/API/Cocoa/WKWebView.mm:
324         (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
325         if it exists.
326         * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
327         and add an optional web_scrollViewDidScroll.
328         * UIProcess/ios/WKPDFView.mm:
329         (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
330         (-[WKPDFView scrollViewDidScroll:]): Deleted.
331         * UIProcess/ios/WKSystemPreviewView.mm:
332         (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
333
334 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
335
336         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
337         https://bugs.webkit.org/show_bug.cgi?id=184092
338         <rdar://problem/38939917>
339
340         Reviewed by Tim Horton.
341
342         Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
343         normal text autosizing values.
344
345         * Shared/WebPreferences.yaml:
346         * UIProcess/API/Cocoa/WKPreferences.mm:
347         (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
348         (-[WKPreferences _shouldEnableTextAutosizingBoost]):
349         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
350
351 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
352
353         Avoid uninitialized mach ports
354         https://bugs.webkit.org/show_bug.cgi?id=184090
355         <rdar://problem/37261129>
356
357         Reviewed by Chris Dumez.
358
359         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
360         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
361         there is a potential for us to try to use invalid ports.
362
363         We should always check return values, and ensure that the mach port variables we seek to initialize are
364         kept in a valid state.
365
366         Reviewed by Chris Dumez.
367
368         * NetworkProcess/NetworkProcess.cpp:
369         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): Initialize new port to a safe default and
370         check the return state of the allocation function.
371         * Platform/IPC/Connection.h:
372         * Platform/IPC/mac/ConnectionMac.mm:
373         (IPC::Connection::open): Ditto.
374         (IPC::Connection::initializeSendSource): Ditto.
375         (IPC::readFromMachPort): Ditto.
376         (IPC::Connection::receiveSourceEventHandler): Ditto.
377         * Platform/SharedMemory.h:
378         * Platform/cocoa/SharedMemoryCocoa.cpp:
379         (WebKit::makeMemoryEntry): Ditto.
380         * Platform/mac/MachUtilities.cpp:
381         (setMachPortQueueLength): Ditto.
382         (setMachExceptionPort): Ditto.
383         * PluginProcess/PluginProcess.cpp:
384         (WebKit::PluginProcess::createWebProcessConnection): Ditto.
385         * StorageProcess/StorageProcess.cpp:
386         (WebKit::StorageProcess::createStorageToWebProcessConnection): Ditto.
387         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
388         (WebKit::ProcessLauncher::launchProcess): Ditto.
389         * WebProcess/WebPage/WebInspector.cpp:
390         (WebKit::WebInspector::openFrontendConnection): Ditto.
391
392 2018-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
393
394         Fails to build webkitgtk+ after git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
395         https://bugs.webkit.org/show_bug.cgi?id=184081
396
397         Unreviewed, switch to use UNUSED_PARAM()
398
399         * UIProcess/WebPageProxy.cpp:
400         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
401
402 2018-03-28  Tim Horton  <timothy_horton@apple.com>
403
404         Make use of HAVE(CORE_ANIMATION_RENDER_SERVER) in more places
405         https://bugs.webkit.org/show_bug.cgi?id=184072
406         <rdar://problem/38946530>
407
408         Reviewed by Dan Bernstein.
409
410         * Platform/mac/LayerHostingContext.mm:
411         (WebKit::LayerHostingContext::createForExternalHostingProcess):
412         * UIProcess/mac/ViewSnapshotStore.h:
413         * UIProcess/mac/ViewSnapshotStore.mm:
414         (WebKit::ViewSnapshot::clearImage):
415
416 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
417
418         Revert an unnecessary workaround when zooming focused form controls
419         https://bugs.webkit.org/show_bug.cgi?id=184067
420         <rdar://problem/38805254>
421
422         Reviewed by Tim Horton.
423
424         Reverts an unintended change introduced in r227984.
425
426         * UIProcess/ios/WKContentViewInteraction.mm:
427         (-[WKContentView _displayFormNodeInputView]):
428
429 2018-03-28  Miguel Gomez  <magomez@igalia.com>
430
431         [GTK][WPE] Remove UpdateAtlas
432         https://bugs.webkit.org/show_bug.cgi?id=184042
433
434         Reviewed by Žan Doberšek.
435
436         Remove all the code related to UpdateAtlas handling.
437
438         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
439         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
440         (WebKit::CoordinatedGraphicsScene::commitSceneState):
441         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
442         (WebKit::CoordinatedGraphicsScene::syncUpdateAtlases): Deleted.
443         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas): Deleted.
444         (WebKit::CoordinatedGraphicsScene::removeUpdateAtlas): Deleted.
445         (WebKit::CoordinatedGraphicsScene::releaseUpdateAtlases): Deleted.
446         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
447         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
448         (WebKit::ThreadedCompositor::renderLayerTree):
449         (WebKit::ThreadedCompositor::releaseUpdateAtlases): Deleted.
450         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
451         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
452         (WebKit::WebChromeClient::delegatedScrollRequested):
453         (WebKit::WebChromeClient::resetUpdateAtlasForTesting): Deleted.
454         * WebProcess/WebCoreSupport/WebChromeClient.h:
455         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
456         (WebKit::AcceleratedDrawingArea::resetUpdateAtlasForTesting): Deleted.
457         * WebProcess/WebPage/AcceleratedDrawingArea.h:
458         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
459         (WebKit::CompositingCoordinator::CompositingCoordinator):
460         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
461         (WebKit::CompositingCoordinator::clearPendingStateChanges):
462         (WebKit::CompositingCoordinator::renderNextFrame):
463         (WebKit::CompositingCoordinator::purgeBackingStores):
464         (WebKit::CompositingCoordinator::createUpdateAtlas): Deleted.
465         (WebKit::CompositingCoordinator::removeUpdateAtlas): Deleted.
466         (WebKit::CompositingCoordinator::getCoordinatedBuffer): Deleted.
467         (): Deleted.
468         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases): Deleted.
469         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired): Deleted.
470         (WebKit::CompositingCoordinator::releaseAtlases): Deleted.
471         (WebKit::CompositingCoordinator::clearUpdateAtlases): Deleted.
472         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
473         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
474         (WebKit::CoordinatedLayerTreeHost::clearUpdateAtlases): Deleted.
475         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
476         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
477         (WebKit::ThreadedCoordinatedLayerTreeHost::releaseUpdateAtlases): Deleted.
478         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
479         * WebProcess/WebPage/DrawingArea.h:
480         * WebProcess/WebPage/LayerTreeHost.h:
481         (WebKit::LayerTreeHost::setIsDiscardable):
482
483 2018-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
484
485         REGRESSION(r229998): WebDriver: MiniBrowser is crashing in a lot of tests after r229998
486         https://bugs.webkit.org/show_bug.cgi?id=184075
487
488         Reviewed by Žan Doberšek.
489
490         This is because we are using a value after it has been moved.
491
492         * UIProcess/Automation/WebAutomationSession.cpp:
493         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): Save a reference to page in a local variable
494         before using it when it's also going to be moved in the lambda capture.
495
496 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
497
498         Unreviewed, fix typo in variable name
499
500         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
501         (webkitWebViewBaseCrossingNotifyEvent):
502
503 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
504
505         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
506         https://bugs.webkit.org/show_bug.cgi?id=183923
507         <rdar://problem/38756869>
508
509         Reviewed by Brent Fulgham.
510
511         Send OpenGL display mask to the WebContent process when the display ID is changing.
512
513         * UIProcess/WebPageProxy.cpp:
514         (WebKit::WebPageProxy::windowScreenDidChange):
515         * WebProcess/WebPage/WebPage.h:
516         * WebProcess/WebPage/WebPage.messages.in:
517         * WebProcess/WebPage/mac/WebPageMac.mm:
518         (WebKit::WebPage::openGLDisplayMaskChanged):
519
520 2018-03-27  Youenn Fablet  <youenn@apple.com>
521
522         Move request checking out of PingLoad for future reuse in NetworkLoad
523         https://bugs.webkit.org/show_bug.cgi?id=183865
524
525         Reviewed by Chris Dumez.
526
527         Introduce NetworkLoadChecker as a way to validate requests before sending them in the network process.
528         Validation encompasses: CORS checks, CSP and Content Extensions on both main request and redirected requests if any.
529
530         Make PingLoad use NetworkLoadChecker. Future patch should make NetworkLoad to use it as well whenever needed.
531
532         Make NetworkCORSPreflightChecker takes a CompletionHandler instead of a Function.
533         Ensure this callback is called even if preflight is not completed by returning a Canceled error.
534
535         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
536         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
537         (WebKit::NetworkCORSPreflightChecker::returnResult):
538         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
539         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
540         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
541         * NetworkProcess/NetworkCORSPreflightChecker.h:
542         * NetworkProcess/NetworkLoadChecker.cpp: Added.
543         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
544         (WebKit::NetworkLoadChecker::check):
545         (WebKit::NetworkLoadChecker::checkRedirection):
546         (WebKit::NetworkLoadChecker::returnError):
547         (WebKit::NetworkLoadChecker::checkRequest):
548         (WebKit::NetworkLoadChecker::checkCORSRequest):
549         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
550         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
551         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
552         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
553         (WebKit::NetworkLoadChecker::contentExtensionsBackend):
554         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
555         * NetworkProcess/NetworkLoadChecker.h: Added.
556         (WebKit::NetworkLoadChecker::setCSPResponseHeaders):
557         (WebKit::NetworkLoadChecker::setContentExtensionRuleLists):
558         (WebKit::NetworkLoadChecker::url const):
559         (WebKit::NetworkLoadChecker::storedCredentialsPolicy const):
560         (WebKit::NetworkLoadChecker::isChecking const):
561         (WebKit::NetworkLoadChecker::isRedirected const):
562         * NetworkProcess/PingLoad.cpp:
563         (WebKit::PingLoad::PingLoad):
564         (WebKit::PingLoad::~PingLoad):
565         (WebKit::PingLoad::willPerformHTTPRedirection):
566         (WebKit::PingLoad::didReceiveChallenge):
567         (WebKit::PingLoad::wasBlocked):
568         (WebKit::PingLoad::cannotShowURL):
569         (WebKit::PingLoad::timeoutTimerFired):
570         (WebKit::PingLoad::currentURL const):
571         * NetworkProcess/PingLoad.h:
572         * WebKit.xcodeproj/project.pbxproj:
573
574 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
575
576         [WebAuthN] Implement authenticatorGetAssertion
577         https://bugs.webkit.org/show_bug.cgi?id=183881
578         <rdar://problem/37258628>
579
580         Reviewed by Brent Fulgham.
581
582         * Shared/WebPreferences.yaml:
583         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
584         (WebKit::WebCredentialsMessengerProxy::makeCredential):
585         (WebKit::WebCredentialsMessengerProxy::getAssertion):
586         (WebKit::WebCredentialsMessengerProxy::getAssertionReply):
587         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
588         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
589         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
590         (WebKit::WebCredentialsMessenger::getAssertion):
591         (WebKit::WebCredentialsMessenger::getAssertionReply):
592         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
593
594 2018-03-27  Chris Dumez  <cdumez@apple.com>
595
596         Avoid constructing SecurityOrigin objects from non-main threads
597         https://bugs.webkit.org/show_bug.cgi?id=184024
598
599         Reviewed by Youenn Fablet.
600
601         Avoid constructing SecurityOrigin objects from non-main threads as much as possible.
602
603         * WebProcess/Storage/WebSWClientConnection.cpp:
604         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
605         (WebKit::WebSWClientConnection::matchRegistration):
606         (WebKit::WebSWClientConnection::getRegistrations):
607         * WebProcess/Storage/WebSWClientConnection.h:
608         * WebProcess/Storage/WebSWOriginTable.cpp:
609         (WebKit::WebSWOriginTable::contains const):
610         * WebProcess/Storage/WebSWOriginTable.h:
611
612 2018-03-27  Chris Dumez  <cdumez@apple.com>
613
614         Move online state detection from the WebProcess to the NetworkProcess
615         https://bugs.webkit.org/show_bug.cgi?id=183989
616         <rdar://problem/37093299>
617
618         Reviewed by Youenn Fablet.
619
620         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
621         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
622         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
623         its connected WebProcesses via IPC.
624
625         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
626         (WebKit::NetworkConnectionToWebProcess::setOnLineState):
627         * NetworkProcess/NetworkConnectionToWebProcess.h:
628         * NetworkProcess/NetworkProcess.cpp:
629         (WebKit::NetworkProcess::NetworkProcess):
630         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
631         * WebProcess/Network/NetworkProcessConnection.cpp:
632         (WebKit::NetworkProcessConnection::setOnLineState):
633         * WebProcess/Network/NetworkProcessConnection.h:
634         * WebProcess/Network/NetworkProcessConnection.messages.in:
635         * WebProcess/Network/WebLoaderStrategy.cpp:
636         (WebKit::WebLoaderStrategy::isOnLine const):
637         (WebKit::WebLoaderStrategy::addOnlineStateChangeListener):
638         (WebKit::WebLoaderStrategy::setOnLineState):
639         * WebProcess/Network/WebLoaderStrategy.h:
640
641 2018-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
642
643         [Extra zoom mode] Add support for new focused form control overlay behaviors
644         https://bugs.webkit.org/show_bug.cgi?id=184043
645         <rdar://problem/38758727>
646
647         Reviewed by Tim Horton.
648
649         See below for more details.
650
651         * UIProcess/ios/WKContentViewInteraction.mm:
652         (-[WKContentView _willStartScrollingOrZooming]):
653         (-[WKContentView _didEndScrollingOrZooming]):
654
655         Suppress focused form control navigation while the scroll view is undergoing a scroll or zoom animation (e.g.,
656         when moving from one focused form control to another).
657
658         (-[WKContentView textInputController:didCommitText:withSuggestion:]):
659
660         When dismissing an input view controller, allow focused form control navigation only after updating assisted
661         node information to ensure that focus rects aren't stale as the user begins to navigate between forms.
662
663         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]):
664         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]):
665         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]):
666         (-[WKContentView scrollViewForFocusedFormControlController:]):
667         (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
668
669         Implement some new focused form overlay delegate hooks to vend the scroll view, as well as the rects of next and
670         previous focusable form controls.
671
672 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
673
674         Further refine cookie read/write logging
675         https://bugs.webkit.org/show_bug.cgi?id=184044
676         <rdar://problem/38915610>
677
678         Reviewed by Chris Dumez.
679
680         Cookie logging was passing the partition, rather than the first party, when logging, which
681         prevented logging in cases where partitioning or blocking was active. This patch corrects
682         these calls so that logging is generated in these cases, too.
683
684         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
685         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Call log routines if needed.
686         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): Ditto.
687         * NetworkProcess/NetworkResourceLoader.cpp:
688         (WebKit::escapeIDForJSON): Make available to use in multiple functions.
689         (WebKit::NetworkResourceLoader::logCookieInformation const): Revise to use shared
690         convenience functions.
691         (WebKit::logBlockedCookieInformation): Added.
692         (WebKit::logCookieInformationInternal): Added.
693         (WebKit::NetworkResourceLoader::logCookieInformation): Revise to use shared
694         convenience functions.
695         * NetworkProcess/NetworkResourceLoader.h:
696
697 2018-03-27  Brian Burg  <bburg@apple.com>
698
699         Web Automation: support enter/exit fullscreen and hide/restore window operations
700         https://bugs.webkit.org/show_bug.cgi?id=182837
701         <rdar://problem/37580732>
702
703         Reviewed by Tim Horton.
704
705         The W3C specification is more explicit about when to exit fullscreen and
706         restore the window for a browsing context. So, WebKit needs to have support
707         for performing these operations on behalf of a driver.
708
709         Based on prototyping, it is sufficient to use a JavaScript atom to enter
710         fullscreen mode. This is included in the patch as EnterFullscreen.js and
711         can be used to implement the §10.7.5 Fullscreen Window command.
712
713         Other window operations cannot be peformed from JavaScript, so we need to
714         delegate these operations to the session client (i.e., Safari).
715         This patch adds session client callouts for restoring, minimizing, and
716         switching to a browsing context.
717
718         Exiting fullscreen happens implicitly (per specification) when setting a
719         window frame without an actual frame, or when switching/restoring/minimizing a window.
720         If needed, a driver can call Set Window Rect in this way to unfullscreen a context.
721         Similarly, a driver can restore a minimized window using Set Window Rect.
722
723         * UIProcess/API/APIAutomationSessionClient.h:
724         (API::AutomationSessionClient::requestHideWindowOfPage):
725         (API::AutomationSessionClient::requestRestoreWindowOfPage):
726         (API::AutomationSessionClient::requestSwitchToPage):
727         Add new API client methods.
728
729         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
730         Add new Cocoa API delegate methods.
731
732         * UIProcess/Automation/Automation.json:
733         Make the switch to browsing context command asynchronous, since this functionality
734         is not always synchronous, and we prefer to use completion handlers in the delegates.
735
736         Add new protocol method for hiding the window of a browsing context.
737         This is expected to minimize/miniaturize a window for desktop window managers.
738
739         * UIProcess/Automation/WebAutomationSession.h:
740         * UIProcess/Automation/WebAutomationSession.cpp:
741         (WebKit::WebAutomationSession::switchToBrowsingContext):
742         Make this function asynchronous. Call out to the session client.
743
744         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
745         Follow the steps in the specification to restore window and exit fullscreen.
746
747         (WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
748         Exit fullscreen and call out to the session client.
749
750         (WebKit::WebAutomationSession::exitFullscreenWindowForPage):
751         This is a little strange. Because there is no async API for exiting fullscreen
752         from C++ code, we hook into willEnterFullScreen and didExitFullScreen and send
753         out the response if the page exited fullscreen after we requested it to do so.
754         Because the W3C specification mandates that drivers only process one command at
755         a time, there will only ever be one callback installed by this method at a time.
756
757         (WebKit::WebAutomationSession::restoreWindowForPage):
758         (WebKit::WebAutomationSession::hideWindowForPage):
759         Call out to the session client.
760
761         (WebKit::WebAutomationSession::didEnterFullScreenForPage):
762         (WebKit::WebAutomationSession::didExitFullScreenForPage):
763         Add methods to be called by instrumentation hooks in WebFullScreenManagerProxy.
764
765         * UIProcess/Automation/atoms/EnterFullscreen.js: Added.
766         (enterFullscreen):
767
768         * UIProcess/Cocoa/AutomationSessionClient.h:
769         * UIProcess/Cocoa/AutomationSessionClient.mm:
770         (WebKit::AutomationSessionClient::AutomationSessionClient):
771         (WebKit::AutomationSessionClient::requestSwitchToPage):
772         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
773         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
774         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
775         Add boilerplate to convert C++ API client to Objective-C delegate methods.
776
777         * UIProcess/WebFullScreenManagerProxy.cpp:
778         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
779         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
780         Notify the automation session if the page is under automation and
781         enters or exits fullscreen.
782
783         * WebKit.xcodeproj/project.pbxproj:
784         Add EnterFullscreen.js to the list of WebDriver atoms. These are copied
785         as WebKit2 private headers and used by driver implementations.
786
787 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
788
789         Make AVFoundationEnabled preference available on iOS
790         https://bugs.webkit.org/show_bug.cgi?id=183876
791         <rdar://problem/38726459>
792
793         Reviewed by Youenn Fablet.
794
795         * Shared/WebPreferences.yaml: Set AVFoundationEnabled with DEFAULT_AVFOUNDATION_ENABLED.
796         * Shared/WebPreferencesDefaultValues.h:
797
798         * UIProcess/API/Cocoa/WKPreferences.mm:
799         (-[WKPreferences _setAVFoundationEnabled:]): Enable for iOS.
800         (-[WKPreferences _avFoundationEnabled]): Ditto.
801         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
802
803 2018-03-26  Tim Horton  <timothy_horton@apple.com>
804
805         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebKit
806         https://bugs.webkit.org/show_bug.cgi?id=184030
807         <rdar://problem/38895281>
808
809         Reviewed by Dan Bernstein.
810
811         * Configurations/Base.xcconfig:
812         * Configurations/BaseTarget.xcconfig:
813         * Configurations/WebKit.xcconfig:
814
815 2018-03-26  Tim Horton  <timothy_horton@apple.com>
816
817         Add and adopt HAVE(CORE_ANIMATION_RENDER_SERVER)
818         https://bugs.webkit.org/show_bug.cgi?id=184026
819         <rdar://problem/38883321>
820
821         Reviewed by Sam Weinig.
822
823         * UIProcess/API/Cocoa/WKWebView.mm:
824         (-[WKWebView _takeViewSnapshot]):
825         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
826
827 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
828
829         [Extra zoom mode] Refactor input view controller presentation and dismissal helpers
830         https://bugs.webkit.org/show_bug.cgi?id=184020
831         Work towards <rdar://problem/38758727>
832
833         Reviewed by Tim Horton.
834
835         We currently have separate presentation and dismissal helpers for each type of view controller corresponding to
836         a focused element type. This is excessive, considering that all of these helpers are only invoked from one place
837         (either -presentViewControllerForCurrentAssistedNode or -dismissAllInputViewControllers), with the exception of
838         the focused form control overlay.
839
840         This refactoring allows us to then adjust the timing of first responder restoration logic, such that the focused
841         form control view controller can receive forwarded events from the web view. See below for more detail.
842
843         * UIProcess/ios/WKContentViewInteraction.mm:
844         (-[WKContentView presentFocusedFormControlViewController:]):
845         (-[WKContentView dismissFocusedFormControlViewController:]):
846
847         Remove logic to restore the web view as first responder.
848
849         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
850         (-[WKContentView dismissAllInputViewControllers]):
851
852         Restore first responder after dismissing a view controller that was presented when focusing a form control, only
853         if the web view was first responder before presentation.
854
855         (-[WKContentView presentDatePickerViewController:]): Deleted.
856         (-[WKContentView dismissDatePickerViewController:]): Deleted.
857         (-[WKContentView presentTimePickerViewController:]): Deleted.
858         (-[WKContentView dismissTimePickerViewController:]): Deleted.
859         (-[WKContentView presentSelectMenuViewController:]): Deleted.
860         (-[WKContentView dismissSelectMenuViewController:]): Deleted.
861         (-[WKContentView dismissNumberPadViewController:]): Deleted.
862         (-[WKContentView presentNumberPadViewController:]): Deleted.
863         (-[WKContentView presentTextInputViewController:]): Deleted.
864         (-[WKContentView dismissTextInputViewController:]): Deleted.
865
866 2018-03-06  Brian Burg  <bburg@apple.com>
867
868         Web Automation: provide a way to ask clients for a new tab or window
869         https://bugs.webkit.org/show_bug.cgi?id=183381
870         <rdar://problem/38167301>
871
872         Reviewed by Timothy Hatcher.
873
874         Add support for specifying browsing context options when requesting
875         a new browsing context from the automation session client/delegate.
876         This is currently just used for specifying tab vs window, but could
877         also be used for things like toggling certain browser chrome or features.
878
879         There is no guarantee that the client has a notion of tabs vs windows,
880         so this option is purely advisory and should not cause the command to
881         fail if it cannot be honored.
882
883         This behavior caused by specifying this option is client-specific, so no
884         new tests are included in WebKit for this change.
885
886         * UIProcess/API/APIAutomationSessionClient.h:
887         (API::AutomationSessionClient::didRequestNewPageWithOptions):
888         (API::AutomationSessionClient::didRequestNewWindow): Deleted.
889         Add options parameter.
890
891         * UIProcess/API/glib/WebKitAutomationSession.cpp:
892         Adjust to new signature. More work is needed to plumb this information
893         to the public API for GTK/WPE and support it in WebKitGTK driver.
894
895         * UIProcess/Automation/Automation.json: Add new optional parameter.
896
897         * UIProcess/Automation/WebAutomationSession.h:
898         * UIProcess/Automation/WebAutomationSession.cpp:
899         (WebKit::WebAutomationSession::createBrowsingContext):
900         Convert the protocol option to an API option.
901
902         * UIProcess/Cocoa/AutomationSessionClient.h:
903         * UIProcess/Cocoa/AutomationSessionClient.mm:
904         (WebKit::AutomationSessionClient::AutomationSessionClient):
905         (WebKit::toAPI):
906         (WebKit::AutomationSessionClient::didRequestNewPageWithOptions):
907         (WebKit::AutomationSessionClient::didRequestNewWindow): Deleted.
908         Convert the internal option to a Cocoa SPI option and pass it along.
909
910         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
911         Adjust delegate methods to include options. Clients need to adopt the new signature(s).
912
913 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
914
915         [Extra zoom mode] Add plumbing for next and previous focusable element rects
916         https://bugs.webkit.org/show_bug.cgi?id=184016
917         Work towards <rdar://problem/38758727>
918
919         Reviewed by Tim Horton.
920
921         When building up AssistedNodeInformation, we currently compute the element rect of the current focused element,
922         as well as flags indicating whether or not there are next or previous focusable elements. For
923         <rdar://problem/38758727>, we additionally send the rects of the next or previous focusable elements as well.
924
925         * Shared/AssistedNodeInformation.cpp:
926         (WebKit::AssistedNodeInformation::encode const):
927         (WebKit::AssistedNodeInformation::decode):
928
929         IPC support for nextNodeRect and previousNodeRect.
930
931         * Shared/AssistedNodeInformation.h:
932         * WebProcess/WebPage/ios/WebPageIOS.mm:
933         (WebKit::elementRectInRootViewCoordinates):
934
935         Add a helper to compute an element's rect in root view coordinates. We use this to compute the rects of the
936         current focused element as well as those of the next and previous elements, if any.
937
938         (WebKit::WebPage::getAssistedNodeInformation):
939         (WebKit::hasAssistableElement): Deleted.
940
941         Since we need the next or previous focusable element to get its rect, we don't need this helper anymore.
942
943 2018-03-26  Chris Dumez  <cdumez@apple.com>
944
945         Use SecurityOriginData more consistently in Service Worker code
946         https://bugs.webkit.org/show_bug.cgi?id=183969
947
948         Reviewed by Darin Adler.
949
950         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
951         SecurityOrigin objects unnecessarily.
952
953         * NetworkProcess/NetworkResourceLoadParameters.cpp:
954         (WebKit::NetworkResourceLoadParameters::encode const):
955         * Shared/API/c/WKSecurityOriginRef.cpp:
956         (WKSecurityOriginCopyDatabaseIdentifier):
957         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
958         (WebKit::WebSWOriginStore::addToStore):
959         (WebKit::WebSWOriginStore::removeFromStore):
960         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
961         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
962         (WebKit::WebSWServerConnection::scheduleJobInServer):
963         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
964         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
965         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
966         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
967         * StorageProcess/StorageProcess.cpp:
968         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
969         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
970         (WebKit::StorageProcess::createStorageToWebProcessConnection):
971         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
972         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
973         (WebKit::StorageProcess::createServerToContextConnection):
974         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
975         * StorageProcess/StorageProcess.h:
976         * UIProcess/API/APIFrameInfo.cpp:
977         (API::FrameInfo::create):
978         * UIProcess/API/C/WKApplicationCacheManager.cpp:
979         (WKApplicationCacheManagerDeleteEntriesForOrigin):
980         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
981         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
982         * UIProcess/API/C/WKResourceCacheManager.cpp:
983         (WKResourceCacheManagerClearCacheForOrigin):
984         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
985         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
986         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
987         * UIProcess/ServiceWorkerProcessProxy.cpp:
988         (WebKit::ServiceWorkerProcessProxy::create):
989         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
990         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
991         * UIProcess/ServiceWorkerProcessProxy.h:
992         * UIProcess/Storage/StorageProcessProxy.cpp:
993         (WebKit::StorageProcessProxy::getStorageProcessConnection):
994         * UIProcess/WebProcessPool.cpp:
995         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
996         (WebKit::WebProcessPool::disconnectProcess):
997         (WebKit::WebProcessPool::updateProcessAssertions):
998         * UIProcess/WebProcessPool.h:
999         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1000         (WebKit::WebsiteDataStore::fetchDataAndApply):
1001         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1002         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
1003         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1004         (WKBundlePageCopyOriginsWithApplicationCache):
1005         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1006         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
1007         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
1008         * WebProcess/Storage/WebSWClientConnection.cpp:
1009         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1010         (WebKit::WebSWClientConnection::matchRegistration):
1011         (WebKit::WebSWClientConnection::whenRegistrationReady):
1012         (WebKit::WebSWClientConnection::getRegistrations):
1013         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1014         (WebKit::WebChromeClient::exceededDatabaseQuota):
1015         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
1016         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1017         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1018         * WebProcess/WebProcess.cpp:
1019         (WebKit::WebProcess::fetchWebsiteData):
1020         * WebProcess/WebStorage/StorageAreaImpl.cpp:
1021         (WebKit::StorageAreaImpl::securityOrigin const):
1022         * WebProcess/WebStorage/StorageAreaImpl.h:
1023         * WebProcess/WebStorage/StorageAreaMap.cpp:
1024         (WebKit::StorageAreaMap::StorageAreaMap):
1025         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
1026         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
1027         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1028         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
1029
1030 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
1031
1032         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
1033         https://bugs.webkit.org/show_bug.cgi?id=183911
1034         <rdar://problem/38762306>
1035
1036         Reviewed by Youenn Fablet.
1037
1038         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
1039         should never call Cookie API directly. That should only happen in the Networking or
1040         UIProcess. 
1041
1042         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1043         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1044         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
1045         * NetworkProcess/NetworkProcess.cpp:
1046         (WebKit::NetworkProcess::initializeNetworkProcess):
1047         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1048         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
1049         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1050         (WebKit::NetworkProcess::setSharedHTTPCookieStorage):
1051         (WebKit::NetworkProcess::syncAllCookies):
1052         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1053         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1054         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1055         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1056         * PluginProcess/PluginProcess.cpp:
1057         (WebKit::PluginProcess::initializeProcess):
1058         * Shared/cf/CookieStorageUtilsCF.mm:
1059         (WebKit::cookieStorageFromIdentifyingData):
1060         (WebKit::identifyingDataFromCookieStorage):
1061         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1062         (WebKit::WebProcessPool::platformInitializeWebProcess):
1063         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1064         (WebKit::privateBrowsingSession):
1065         * UIProcess/WebProcessPool.cpp:
1066         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1067         (WebKit::WebsiteDataStore::parameters):
1068         * UIProcess/mac/WebCookieManagerProxyMac.mm:
1069         (WebKit::WebCookieManagerProxy::persistHTTPCookieAcceptPolicy):
1070         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1071         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
1072         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1073         (WebKit::WebFrameLoaderClient::createNetworkingContext):
1074         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
1075         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
1076         (WebKit::WebFrameNetworkingContext::storageSession const):
1077         * WebProcess/WebProcess.cpp:
1078         (WebKit::WebProcess::initializeProcess):
1079
1080 2018-03-26  Alex Christensen  <achristensen@webkit.org>
1081
1082         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
1083         https://bugs.webkit.org/show_bug.cgi?id=183965
1084
1085         Reviewed by Chris Dumez.
1086
1087         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1088         (WebKit::WebFrameLoaderClient::willCacheResponse const):
1089         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1090
1091 2018-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1092
1093         [GTK][WPE] Add API to convert between DOM and JSCValue
1094         https://bugs.webkit.org/show_bug.cgi?id=183448
1095
1096         Reviewed by Michael Catanzaro.
1097
1098         Add methods to get a JSCValue for a WebKitDOMObject and to create a WebKitDOMNode from a JSCValue. Deprecate
1099         most of the GTK+ DOM bindings API and move the non-deprecated parts to glib dir to be exposed by WPE too.
1100
1101         * PlatformGTK.cmake:
1102         * PlatformWPE.cmake:
1103         * SourcesGTK.txt:
1104         * SourcesWPE.txt:
1105         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1106         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.cpp.
1107         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
1108         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocument.cpp: Added.
1109         (WebKit::kit):
1110         (WebKit::core):
1111         (WebKit::wrapDocument):
1112         (webkit_dom_document_class_init):
1113         (webkit_dom_document_init):
1114         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocumentPrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentPrivate.h.
1115         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp: Added.
1116         (WebKit::kit):
1117         (WebKit::core):
1118         (WebKit::wrapElement):
1119         (webkit_dom_element_class_init):
1120         (webkit_dom_element_init):
1121         (webkit_dom_element_html_input_element_is_user_edited):
1122         (webkit_dom_element_html_input_element_get_auto_filled):
1123         (webkit_dom_element_html_input_element_set_auto_filled):
1124         (webkit_dom_element_html_input_element_set_editing_value):
1125         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElementPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementPrivate.h.
1126         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNode.cpp: Added.
1127         (_WebKitDOMNodePrivate::~_WebKitDOMNodePrivate):
1128         (WebKit::kit):
1129         (WebKit::core):
1130         (WebKit::wrapNode):
1131         (webkitDOMNodeConstructor):
1132         (webkitDOMNodeFinalize):
1133         (webkit_dom_node_init):
1134         (webkit_dom_node_class_init):
1135         (webkitDOMNodeSetCoreObject):
1136         (webkitDOMNodeGetCoreObject):
1137         (webkit_dom_node_for_js_value):
1138         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNodePrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodePrivate.h.
1139         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMObject.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.cpp.
1140         (webkitDOMObjectSetProperty):
1141         (webkit_dom_object_class_init):
1142         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.cpp: Added.
1143         (WebKit::wrap):
1144         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
1145         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
1146         (webkit_frame_get_js_value_for_dom_object):
1147         (webkit_frame_get_js_value_for_dom_object_in_script_world):
1148         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1149         (webkit_web_page_class_init):
1150         (webkitWebPageCreate):
1151         (webkit_web_page_get_dom_document):
1152         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.cpp:
1153         (WebKit::GObjectEventListener::handleEvent):
1154         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectNodeFilterCondition.cpp:
1155         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.cpp:
1156         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
1157         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.h:
1158         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
1159         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h:
1160         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
1161         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h:
1162         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
1163         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h:
1164         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
1165         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h:
1166         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
1167         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.h:
1168         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
1169         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.h:
1170         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
1171         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.h:
1172         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
1173         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h:
1174         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
1175         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h:
1176         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
1177         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h:
1178         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
1179         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h:
1180         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
1181         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.h:
1182         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
1183         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.h:
1184         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
1185         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.h:
1186         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1187         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.h:
1188         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
1189         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
1190         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
1191         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.h:
1192         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp.
1193         (webkitDOMDocumentDOMEventTargetInit):
1194         (webkitDOMDocumentInstallProperties):
1195         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
1196         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.h:
1197         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h:
1198         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp.
1199         (webkitDOMElementDOMEventTargetInit):
1200         (webkitDOMElementInstallProperties):
1201         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
1202         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.h:
1203         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.cpp:
1204         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.h:
1205         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
1206         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.h:
1207         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
1208         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.h:
1209         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
1210         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.h:
1211         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
1212         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.h:
1213         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
1214         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.h:
1215         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
1216         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.h:
1217         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
1218         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.h:
1219         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
1220         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.h:
1221         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
1222         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.h:
1223         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
1224         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.h:
1225         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.cpp:
1226         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCollection.h:
1227         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
1228         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.h:
1229         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
1230         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.h:
1231         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
1232         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.h:
1233         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
1234         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.h:
1235         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
1236         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.h:
1237         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
1238         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.h:
1239         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
1240         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.h:
1241         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
1242         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.h:
1243         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
1244         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.h:
1245         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
1246         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.h:
1247         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
1248         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.h:
1249         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
1250         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.h:
1251         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
1252         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.h:
1253         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
1254         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.h:
1255         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
1256         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.h:
1257         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
1258         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.h:
1259         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
1260         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.h:
1261         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
1262         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.h:
1263         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
1264         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.h:
1265         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
1266         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.h:
1267         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
1268         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.h:
1269         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
1270         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.h:
1271         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
1272         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.h:
1273         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
1274         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.h:
1275         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
1276         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.h:
1277         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
1278         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.h:
1279         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
1280         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.h:
1281         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
1282         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.h:
1283         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
1284         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.h:
1285         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
1286         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.h:
1287         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
1288         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.h:
1289         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.cpp:
1290         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionsCollection.h:
1291         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
1292         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.h:
1293         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
1294         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.h:
1295         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
1296         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.h:
1297         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPrivate.cpp:
1298         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
1299         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.h:
1300         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
1301         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.h:
1302         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
1303         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.h:
1304         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
1305         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.h:
1306         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
1307         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.h:
1308         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
1309         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.h:
1310         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
1311         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.h:
1312         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
1313         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.h:
1314         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
1315         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.h:
1316         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
1317         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.h:
1318         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
1319         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.h:
1320         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
1321         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.h:
1322         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
1323         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.h:
1324         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.cpp:
1325         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMKeyboardEvent.h:
1326         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.cpp:
1327         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMediaList.h:
1328         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.cpp:
1329         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMMouseEvent.h:
1330         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.cpp:
1331         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNamedNodeMap.h:
1332         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.h:
1333         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.cpp:
1334         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeFilter.h:
1335         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp.
1336         (webkitDOMNodeDOMEventTargetInit):
1337         (webkitDOMNodeInstallProperties):
1338         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.cpp:
1339         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeIterator.h:
1340         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.cpp:
1341         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodeList.h:
1342         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.h:
1343         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp.
1344         (WebKit::wrapNodeGtk):
1345         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivateGtk.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.h.
1346         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
1347         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.h:
1348         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
1349         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.h:
1350         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.cpp:
1351         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheet.h:
1352         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.cpp:
1353         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMStyleSheetList.h:
1354         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
1355         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.h:
1356         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.cpp:
1357         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMTreeWalker.h:
1358         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.cpp:
1359         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMUIEvent.h:
1360         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.cpp:
1361         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMWheelEvent.h:
1362         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
1363         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.h:
1364         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.cpp:
1365         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathNSResolver.h:
1366         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
1367         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.h:
1368         * WebProcess/InjectedBundle/API/gtk/DOM/docs/webkitdomgtk-4.0-sections.txt:
1369         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
1370         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDefines.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentPrivate.h.
1371         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMDocument.h: Added.
1372         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMElement.h: Added.
1373         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMNode.h: Added.
1374         * WebProcess/InjectedBundle/API/wpe/DOM/WebKitDOMObject.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.h.
1375         * WebProcess/InjectedBundle/API/wpe/DOM/webkitdom.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodePrivate.h.
1376         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
1377         * WebProcess/InjectedBundle/API/wpe/WebKitWebHitTestResult.h: Added.
1378         * WebProcess/InjectedBundle/API/wpe/WebKitWebPage.h:
1379         * WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.cpp.template: Added.
1380         * WebProcess/InjectedBundle/API/wpe/WebKitWebProcessEnumTypes.h.template: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObjectPrivate.h.
1381         * WebProcess/InjectedBundle/API/wpe/webkit-web-extension.h:
1382
1383 2018-03-26  Zan Dobersek  <zdobersek@igalia.com>
1384
1385         [CoordGraphics] Clean up CoordinatedGraphicsScene construct-time initializations
1386         https://bugs.webkit.org/show_bug.cgi?id=184002
1387
1388         Reviewed by Carlos Garcia Campos.
1389
1390         Move the CoordinatedGraphicsScene constant-expression initializations
1391         from constructor to the point of declaration.
1392
1393         Default the CoordinatedGraphicsScene destructor.
1394
1395         The m_scrollPosition member variable is unused in this class, while the
1396         similarly-named m_renderedContentsScrollPosition tracks scroll position
1397         of the scene. Remove the latter and use m_scrollPosition in its place.
1398
1399         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1400         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
1401         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers):
1402         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1403         (WebKit::CoordinatedGraphicsScene::~CoordinatedGraphicsScene): Deleted.
1404         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1405
1406 2018-03-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1407
1408         [GTK] WebKitWebProcessEnumTypes.h missing from webkit-web-extension.h
1409         https://bugs.webkit.org/show_bug.cgi?id=183998
1410
1411         Reviewed by Carlos Garcia Campos.
1412
1413         * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:
1414
1415 2018-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1416
1417         [GTK] Unresolved type warnings when generating gir
1418         https://bugs.webkit.org/show_bug.cgi?id=183926
1419
1420         Reviewed by Michael Catanzaro.
1421
1422         Skip deprecated functions using JSC C API from introspection.
1423
1424         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
1425         * UIProcess/API/glib/WebKitWebView.cpp:
1426         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
1427
1428 2018-03-25  Commit Queue  <commit-queue@webkit.org>
1429
1430         Unreviewed, rolling out r229954.
1431         https://bugs.webkit.org/show_bug.cgi?id=184000
1432
1433         Caused many layout tests to crash on Apple High Sierra,
1434         Sierra, iOS Simulator and GTK Linux Debug test bots (Requested
1435         by dydz on #webkit).
1436
1437         Reverted changeset:
1438
1439         "Use SecurityOriginData more consistently in Service Worker
1440         code"
1441         https://bugs.webkit.org/show_bug.cgi?id=183969
1442         https://trac.webkit.org/changeset/229954
1443
1444 2018-03-23  Brian Burg  <bburg@apple.com>
1445
1446         Web Automation: remove unnecessary member variable WebAutomationSession
1447         https://bugs.webkit.org/show_bug.cgi?id=183971
1448
1449         Reviewed by Timothy Hatcher.
1450
1451         The concept of the "active" browsing context is something in the WebDriver
1452         specification, but we were a bit too literal when first implementing this.
1453         There's no actual need for this on the browser side since most commands
1454         require implicitly switching to the target window passed in with the
1455         Automation command. The driver, however, still needs to track the current
1456         browsing context and current top-level browsing context.
1457
1458         For returning whether a browsing context is active,  we can just look at
1459         the page's activity state to know whether the page is active or not. For
1460         a normal browser, only one page is going to be visible and focused at a time.
1461
1462         * UIProcess/Automation/WebAutomationSession.h:
1463         * UIProcess/Automation/WebAutomationSession.cpp:
1464         (WebKit::WebAutomationSession::buildBrowsingContextForPage):
1465         Consult the page's activity state to determine whether it's active.
1466
1467         (WebKit::WebAutomationSession::createBrowsingContext):
1468         (WebKit::WebAutomationSession::closeBrowsingContext):
1469         (WebKit::WebAutomationSession::switchToBrowsingContext):
1470         (WebKit::WebAutomationSession::handleRunOpenPanel):
1471         Stop reading and writing the current browsing context handle.
1472
1473         * UIProcess/WebPageProxy.h:
1474         (WebKit::WebPageProxy::isViewFocused const):
1475         (WebKit::WebPageProxy::isViewWindowActive const):
1476         Add new accessor.
1477
1478 2018-03-25  Tim Horton  <timothy_horton@apple.com>
1479
1480         Add and adopt ENABLE(AIRPLAY_PICKER)
1481         https://bugs.webkit.org/show_bug.cgi?id=183992
1482
1483         Reviewed by Daniel Bates.
1484
1485         * UIProcess/ios/WKContentViewInteraction.h:
1486         * UIProcess/ios/WKContentViewInteraction.mm:
1487         (-[WKContentView _showPlaybackTargetPicker:fromRect:]):
1488         * UIProcess/ios/forms/WKAirPlayRoutePicker.h:
1489         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
1490
1491 2018-03-25  Tim Horton  <timothy_horton@apple.com>
1492
1493         Move WKAnimationDelegate to its own header
1494         https://bugs.webkit.org/show_bug.cgi?id=183976
1495         <rdar://problem/38822299>
1496
1497         Reviewed by Dan Bernstein.
1498
1499         * Shared/RemoteLayerTree/WKAnimationDelegate.h: Added.
1500         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1501         * WebKit.xcodeproj/project.pbxproj:
1502         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1503         RemoteLayerTreeHost uses a forward declaration of WKAnimationDelegate,
1504         so we're just getting lucky that an -invalidate method exists on
1505         some other object. Instead, move WKAnimationDelegate to its own
1506         header, and include it in the places we use it.
1507
1508 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1509
1510         Adopt WK_PLATFORM_NAME in WebKit
1511         https://bugs.webkit.org/show_bug.cgi?id=183978
1512
1513         Reviewed by Dan Bernstein.
1514
1515         * Configurations/WebKit.xcconfig:
1516         * WebKit.xcodeproj/project.pbxproj:
1517         * mac/MigrateHeadersFromWebKitLegacy.make:
1518         * mac/postprocess-framework-headers.sh:
1519
1520 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1521
1522         Ignore sandbox_init_with_parameters deprecation warnings
1523         https://bugs.webkit.org/show_bug.cgi?id=183979
1524
1525         Reviewed by Dan Bernstein.
1526
1527         * Shared/ios/ChildProcessIOS.mm:
1528         (WebKit::ChildProcess::initializeSandbox):
1529
1530 2018-03-24  Chris Dumez  <cdumez@apple.com>
1531
1532         Use SecurityOriginData more consistently in Service Worker code
1533         https://bugs.webkit.org/show_bug.cgi?id=183969
1534
1535         Reviewed by Darin Adler.
1536
1537         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
1538         SecurityOrigin objects unnecessarily.
1539
1540         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1541         (WebKit::NetworkResourceLoadParameters::encode const):
1542         * Shared/API/c/WKSecurityOriginRef.cpp:
1543         (WKSecurityOriginCopyDatabaseIdentifier):
1544         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
1545         (WebKit::WebSWOriginStore::addToStore):
1546         (WebKit::WebSWOriginStore::removeFromStore):
1547         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
1548         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
1549         (WebKit::WebSWServerConnection::scheduleJobInServer):
1550         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1551         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1552         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
1553         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1554         * StorageProcess/StorageProcess.cpp:
1555         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1556         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
1557         (WebKit::StorageProcess::createStorageToWebProcessConnection):
1558         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
1559         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
1560         (WebKit::StorageProcess::createServerToContextConnection):
1561         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
1562         * StorageProcess/StorageProcess.h:
1563         * UIProcess/API/APIFrameInfo.cpp:
1564         (API::FrameInfo::create):
1565         * UIProcess/API/C/WKApplicationCacheManager.cpp:
1566         (WKApplicationCacheManagerDeleteEntriesForOrigin):
1567         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
1568         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
1569         * UIProcess/API/C/WKResourceCacheManager.cpp:
1570         (WKResourceCacheManagerClearCacheForOrigin):
1571         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1572         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
1573         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
1574         * UIProcess/ServiceWorkerProcessProxy.cpp:
1575         (WebKit::ServiceWorkerProcessProxy::create):
1576         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1577         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1578         * UIProcess/ServiceWorkerProcessProxy.h:
1579         * UIProcess/Storage/StorageProcessProxy.cpp:
1580         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1581         * UIProcess/WebProcessPool.cpp:
1582         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1583         (WebKit::WebProcessPool::disconnectProcess):
1584         (WebKit::WebProcessPool::updateProcessAssertions):
1585         * UIProcess/WebProcessPool.h:
1586         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1587         (WebKit::WebsiteDataStore::fetchDataAndApply):
1588         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
1589         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
1590         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1591         (WKBundlePageCopyOriginsWithApplicationCache):
1592         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
1593         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
1594         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
1595         * WebProcess/Storage/WebSWClientConnection.cpp:
1596         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1597         (WebKit::WebSWClientConnection::matchRegistration):
1598         (WebKit::WebSWClientConnection::whenRegistrationReady):
1599         (WebKit::WebSWClientConnection::getRegistrations):
1600         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1601         (WebKit::WebChromeClient::exceededDatabaseQuota):
1602         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
1603         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1604         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1605         * WebProcess/WebProcess.cpp:
1606         (WebKit::WebProcess::fetchWebsiteData):
1607         * WebProcess/WebStorage/StorageAreaImpl.cpp:
1608         (WebKit::StorageAreaImpl::securityOrigin const):
1609         * WebProcess/WebStorage/StorageAreaImpl.h:
1610         * WebProcess/WebStorage/StorageAreaMap.cpp:
1611         (WebKit::StorageAreaMap::StorageAreaMap):
1612         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
1613         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
1614         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1615         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
1616
1617 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1618
1619         Fix the !ENABLE(MEDIA_STREAM) build
1620         https://bugs.webkit.org/show_bug.cgi?id=183977
1621
1622         Reviewed by Wenson Hsieh.
1623
1624         * UIProcess/Cocoa/UIDelegate.mm:
1625         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1626         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
1627         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1628         * WebProcess/cocoa/UserMediaCaptureManager.messages.in:
1629
1630 2018-03-24  Tim Horton  <timothy_horton@apple.com>
1631
1632         WKFileUploadPanel shouldn't depend on WebKitLegacy
1633         https://bugs.webkit.org/show_bug.cgi?id=183981
1634
1635         Reviewed by Wenson Hsieh.
1636
1637         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1638         (-[WKFileUploadPanel _uploadItemForImageData:imageName:successBlock:failureBlock:]):
1639         Just use the underlying WebCore function instead of the
1640         unnecessary NSFileManager category method.
1641
1642 2018-03-23  Tim Horton  <timothy_horton@apple.com>
1643
1644         Fix the build with no pasteboard
1645         https://bugs.webkit.org/show_bug.cgi?id=183973
1646
1647         Reviewed by Dan Bernstein.
1648
1649         * Configurations/FeatureDefines.xcconfig:
1650
1651 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
1652
1653         Enable unified text selection in select cases for gradual testing
1654         https://bugs.webkit.org/show_bug.cgi?id=183967
1655         <rdar://problem/38815328>
1656
1657         Reviewed by Tim Horton.
1658         
1659         Enable in select places for a more gradual switch, as this is a big change and we want to make sure
1660         it works before switching completely.
1661
1662         * UIProcess/ios/WKContentViewInteraction.mm:
1663         (-[WKContentView useSelectionAssistantWithGranularity:]):
1664
1665 2018-03-23  John Wilander  <wilander@apple.com>
1666
1667         Resource Load Statistics: Pick up ITP debug mode flag from defaults
1668         https://bugs.webkit.org/show_bug.cgi?id=183956
1669         <rdar://problem/38559574>
1670
1671         Reviewed by Brent Fulgham.
1672
1673         * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
1674         (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
1675
1676 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1677
1678         [Extra zoom mode] Adopt list view controller UI for select menus
1679         https://bugs.webkit.org/show_bug.cgi?id=183944
1680         <rdar://problem/38799062>
1681
1682         Reviewed by Tim Horton.
1683
1684         Move UIProcess/WKSelectMenuListViewController.* to UIProcess/ios/forms, where it was intended to go.
1685
1686         * UIProcess/ios/forms/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.h.
1687         * UIProcess/ios/forms/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/WKSelectMenuListViewController.mm.
1688         * WebKit.xcodeproj/project.pbxproj:
1689
1690 2018-03-23  Chris Dumez  <cdumez@apple.com>
1691
1692         Promptly terminate service worker processes when they are no longer needed
1693         https://bugs.webkit.org/show_bug.cgi?id=183873
1694         <rdar://problem/38676995>
1695
1696         Reviewed by Youenn Fablet.
1697
1698         The StorageProcess now keeps track of service worker clients for each security
1699         origin. When there is no longer any clients for a given security origin, the
1700         StorageProcess asks the service worker process for the given origin to terminate
1701         and severs its connection to it.
1702
1703         * Shared/Storage/StorageProcessCreationParameters.h:
1704         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1705         (WebKit::WebSWServerToContextConnection::connectionMayNoLongerBeNeeded):
1706         (WebKit::WebSWServerToContextConnection::terminate):
1707         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
1708         * StorageProcess/StorageProcess.cpp:
1709         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
1710         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
1711         (WebKit::StorageProcess::initializeWebsiteDataStore):
1712         (WebKit::StorageProcess::swServerForSession):
1713         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
1714         (WebKit::StorageProcess::disableServiceWorkerProcessTerminationDelay):
1715         * StorageProcess/StorageProcess.h:
1716         * StorageProcess/StorageProcess.messages.in:
1717         * UIProcess/API/Cocoa/WKProcessPool.mm:
1718         (-[WKProcessPool _disableServiceWorkerProcessTerminationDelay]):
1719         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1720         * UIProcess/WebProcessPool.cpp:
1721         (WebKit::WebProcessPool::ensureStorageProcessAndWebsiteDataStore):
1722         (WebKit::WebProcessPool::disableServiceWorkerProcessTerminationDelay):
1723         * UIProcess/WebProcessPool.h:
1724         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1725         (WebKit::WebSWContextManagerConnection::terminateProcess):
1726         * WebProcess/Storage/WebSWContextManagerConnection.h:
1727         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1728
1729 2018-03-23  Brady Eidson  <beidson@apple.com>
1730
1731         Go to back/forward list items after a process-swapped navigation.
1732         <rdar://problem/38690544> and https://bugs.webkit.org/show_bug.cgi?id=183920
1733
1734         Reviewed by Andy Estes.
1735
1736         This takes the initial work of "process swap a normal navigation" and extends it to
1737         process swapping for back/forward item navigations.
1738
1739         * Scripts/webkit/messages.py:
1740
1741         Make sure state objects are serialized to the UI Process back/forward list items, as otherwise
1742         they will be lost in process-swap scenarios:
1743         * Shared/SessionState.cpp:
1744         (WebKit::PageState::encode const):
1745         (WebKit::PageState::decode):
1746         * Shared/SessionState.h:
1747
1748         Make a new variant of APINavigation specifically for back/forward list items.
1749         * UIProcess/API/APINavigation.cpp:
1750         (API::Navigation::Navigation):
1751         (API::Navigation::loggingURL const):
1752         * UIProcess/API/APINavigation.h:
1753         (API::Navigation::create):
1754         (API::Navigation::backForwardListItem):
1755         (API::Navigation::backForwardFrameLoadType const):
1756
1757         * UIProcess/API/C/WKPage.cpp:
1758         (WKPageGoToBackForwardListItem):
1759
1760         * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
1761         (-[WKBrowsingContextController goToBackForwardListItem:]):
1762
1763         * UIProcess/API/Cocoa/WKWebView.mm:
1764         (-[WKWebView goToBackForwardListItem:]):
1765
1766         * UIProcess/WebNavigationState.cpp:
1767         (WebKit::WebNavigationState::createLoadRequestNavigation):
1768         (WebKit::WebNavigationState::createBackForwardNavigation):
1769         * UIProcess/WebNavigationState.h:
1770
1771         * UIProcess/WebPageProxy.cpp:
1772         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1773         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1774         (WebKit::WebPageProxy::goForward):
1775         (WebKit::WebPageProxy::goBack):
1776         (WebKit::WebPageProxy::goToBackForwardItem):
1777         (WebKit::WebPageProxy::receivedPolicyDecision):
1778         (WebKit::WebPageProxy::continueNavigationInNewProcess): Handle back/forward navigations differently than others.
1779         (WebKit::WebPageProxy::restoreFromSessionState):
1780         * UIProcess/WebPageProxy.h:
1781
1782         * UIProcess/WebProcessProxy.cpp:
1783         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Renamed from "addBackForwardItem" for clarity
1784         (WebKit::WebProcessProxy::addBackForwardItem): Deleted.
1785         * UIProcess/WebProcessProxy.h:
1786         * UIProcess/WebProcessProxy.messages.in:
1787
1788         * UIProcess/ios/ViewGestureControllerIOS.mm:
1789         (WebKit::ViewGestureController::endSwipeGesture):
1790
1791         * UIProcess/mac/ViewGestureControllerMac.mm:
1792         (WebKit::ViewGestureController::endSwipeGesture):
1793
1794         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1795         (WebKit::toPageState):
1796         (WebKit::toHistoryItem):
1797
1798         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1799         (WebKit::updateBackForwardItem):
1800
1801         * WebProcess/WebPage/WebPage.cpp:
1802         (WebKit::WebPage::goToBackForwardItem): Combined "goBack" and "goForward" with this method,
1803           passing the appropriate FrameLoadType around as needed to remember the specific type.
1804         (WebKit::WebPage::goForward): Deleted.
1805         (WebKit::WebPage::goBack): Deleted.
1806         * WebProcess/WebPage/WebPage.h:
1807         * WebProcess/WebPage/WebPage.messages.in:
1808
1809 2018-03-23  Megan Gardner  <megan_gardner@apple.com>
1810
1811         Don't use the presence of a textSelectionAssistant as a proxy for if we are in content editable.
1812         https://bugs.webkit.org/show_bug.cgi?id=183804
1813
1814         Reviewed by Tim Horton.
1815
1816         We need to stop using the presence of a textSelectionAssistant as a proxy for if we are selecting in a content editable
1817         or not. As we are planning on switching to only using a textSelectionAssistant for selection, these checks need to 
1818         be more direct in checking what we actually need to know i.e. are we selecting in a content editable.
1819
1820         * Platform/spi/ios/UIKitSPI.h:
1821         * UIProcess/ios/WKContentViewInteraction.mm:
1822         (hasAssistedNode):
1823         (-[WKContentView inputView]):
1824         (-[WKContentView _selectionClipRect]):
1825         (-[WKContentView gestureRecognizer:canBePreventedByGestureRecognizer:]):
1826         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
1827         (-[WKContentView gestureRecognizerShouldBegin:]):
1828         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1829         (-[WKContentView webSelectionRects]):
1830         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1831         (-[WKContentView _autofillContext]):
1832
1833 2018-03-23  Youenn Fablet  <youenn@apple.com>
1834
1835         WebProcessPool should not ask to register all clients for each service worker process creation
1836         https://bugs.webkit.org/show_bug.cgi?id=183941
1837
1838         Reviewed by Chris Dumez.
1839
1840         Call registerServiceWorkerClients when there is no service worker process.
1841         Update service worker clients to register all of them no matter the session ID.
1842
1843         * UIProcess/WebProcessPool.cpp:
1844         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
1845         * WebProcess/WebProcess.cpp:
1846         (WebKit::WebProcess::registerServiceWorkerClients):
1847         * WebProcess/WebProcess.h:
1848         * WebProcess/WebProcess.messages.in:
1849
1850 2018-03-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1851
1852         [Extra zoom mode] Adopt list view controller UI for select menus
1853         https://bugs.webkit.org/show_bug.cgi?id=183944
1854         <rdar://problem/38799062>
1855
1856         Reviewed by Andy Estes.
1857
1858         Rename WKSelectMenuViewController to WKSelectMenuListViewController, and also rename the relevant
1859         WebKitAdditions harness files. See corresponding changes for more details.
1860
1861         * UIProcess/WKSelectMenuListViewController.h: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.h.
1862         * UIProcess/WKSelectMenuListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKSelectMenuViewController.mm.
1863         * UIProcess/ios/WKContentViewInteraction.h:
1864         * UIProcess/ios/WKContentViewInteraction.mm:
1865         (-[WKContentView presentSelectMenuViewController:]):
1866         (-[WKContentView dismissSelectMenuViewController:]):
1867         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
1868         (-[WKContentView numberOfItemsInSelectMenu:]):
1869         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
1870         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
1871         (-[WKContentView selectMenuUsesMultipleSelection:]):
1872         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
1873         (-[WKContentView _wheelChangedWithEvent:]):
1874
1875         Overriding wheel events and re-dispatching them is no longer needed after r229437, so we can just remove special
1876         handling for select menus here.
1877
1878         (-[WKContentView didCancelSelectionInSelectMenu:]): Deleted.
1879         (-[WKContentView selectMenuSupportsMultipleSelection:]): Deleted.
1880         (-[WKContentView selectMenu:hasCheckedOptionAtIndex:]): Deleted.
1881         (-[WKContentView startingIndexForSelectMenu:]): Deleted.
1882
1883         The starting index for a select menu is no longer relevant when using list view controllers for input, so we can
1884         just remove this delegate hook altogether.
1885
1886         * WebKit.xcodeproj/project.pbxproj:
1887
1888 2018-03-23  Youenn Fablet  <youenn@apple.com>
1889
1890         CacheStorage::Caches should clear m_caches when clearing its representation even though it is not yet initialized
1891         https://bugs.webkit.org/show_bug.cgi?id=183945
1892
1893         Reviewed by Chris Dumez.
1894
1895         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
1896         (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
1897         In case we clear Caches in the middle of the initialization, m_caches might not be empty
1898         but m_isInitialized is not yet set to true since we are computing the Caches size.
1899         Update the assertion and clear m_caches in that case.
1900
1901 2018-03-23  David Kilzer  <ddkilzer@apple.com>
1902
1903         Stop using dispatch_set_target_queue()
1904         <https://webkit.org/b/183908>
1905         <rdar://problem/33553533>
1906
1907         Reviewed by Daniel Bates.
1908
1909         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
1910         (WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
1911         dispatch_set_target_queue() since this is handled in the
1912         dispatch_io_create() call above.
1913
1914 2018-03-23  Youenn Fablet  <youenn@apple.com>
1915
1916         CacheStorage::Engine should not ref itself when hopping to a background thread
1917         https://bugs.webkit.org/show_bug.cgi?id=183925
1918         <rdar://problem/38580483>
1919
1920         Reviewed by Chris Dumez.
1921
1922         Add support for weak pointers to CacheStorage Engine.
1923         Use weak pointer when hopping to background threads.
1924         Store callbacks in CacheStorage::Engine maps to keep them being destroyed in the main thread only.
1925         Made some callbacks CompletionHandler as a bonus.
1926
1927         Made sure to use just one Engine for all private sessions.
1928
1929         * NetworkProcess/cache/CacheStorageEngine.cpp:
1930         (WebKit::CacheStorage::Engine::~Engine):
1931         (WebKit::CacheStorage::Engine::from):
1932         (WebKit::CacheStorage::Engine::initialize):
1933         (WebKit::CacheStorage::Engine::writeFile):
1934         (WebKit::CacheStorage::Engine::readFile):
1935         * NetworkProcess/cache/CacheStorageEngine.h:
1936         (WebKit::CacheStorage::Engine::weakPtrFactory):
1937
1938 2018-03-23  Ryan Haddad  <ryanhaddad@apple.com>
1939
1940         Unreviewed build fix.
1941
1942         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1943
1944 2018-03-23  Miguel Gomez  <magomez@igalia.com>
1945
1946         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
1947         https://bugs.webkit.org/show_bug.cgi?id=183892
1948
1949         Remove the UpdateContentsFlag parameter when calling BitmapTexture::updateContents().
1950
1951         Reviewed by Žan Doberšek.
1952
1953         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
1954         (WebKit::CoordinatedBackingStoreTile::swapBuffers):
1955
1956 2018-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1957
1958         [WPE][GTK] Fix -Wswitch warnings after r229778
1959         https://bugs.webkit.org/show_bug.cgi?id=183927
1960
1961         Reviewed by Carlos Garcia Campos.
1962
1963         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1964         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Log a warning if Suspend is
1965         received as a PolicyAction
1966         * UIProcess/API/glib/WebKitNavigationClient.cpp: Ignore the ProcessSwap termination reason,
1967         which should be invisible to WebKit clients
1968
1969 2018-03-22  Chris Dumez  <cdumez@apple.com>
1970
1971         Include security origin in the service worker process name
1972         https://bugs.webkit.org/show_bug.cgi?id=183913
1973
1974         Reviewed by Youenn Fablet.
1975
1976         Include security origin in the service worker process name to facilitate debugging. This way, we
1977         can differentiate which service worker process is used for which origin in activity monitor.
1978
1979         * Shared/ChildProcess.h:
1980         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
1981         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1982         * UIProcess/ServiceWorkerProcessProxy.cpp:
1983         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
1984         * WebProcess/cocoa/WebProcessCocoa.mm:
1985         (WebKit::WebProcess::initializeProcessName):
1986
1987 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1988
1989         Unreviewed, silence unused variable warning
1990
1991         * UIProcess/WebPageProxy.cpp:
1992         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1993
1994 2018-03-22  Dan Bernstein  <mitz@apple.com>
1995
1996         WKWebView doesn’t expose its spellCheckerDocumentTag
1997         https://bugs.webkit.org/show_bug.cgi?id=183797
1998         <rdar://problem/38678089>
1999
2000         Reviewed by Tim Horton.
2001
2002         * UIProcess/API/Cocoa/WKWebView.mm:
2003         (-[WKWebView _spellCheckerDocumentTag]): Added this getter which calls through to the WebViewImpl.
2004         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Declared _spellCheckerDocumentTag property.
2005
2006 2018-03-22  Chris Dumez  <cdumez@apple.com>
2007
2008         Use the same SWServer for all ephemeral sessions
2009         https://bugs.webkit.org/show_bug.cgi?id=183921
2010         <rdar://problem/36873075>
2011
2012         Reviewed by Youenn Fablet.
2013
2014         Use the same SWServer for all ephemeral sessions. SWServers never go away and we create
2015         one per sessionID. When browsing doing private browsing in Safari (and other fetching
2016         favorite icons), the sessionID is ephemeral and keeps changing. This means that we kept
2017         constructing new SWServers that would never go away. Each SWServer has a thread so we
2018         would eventually hit the thread limit for the storage process.
2019
2020         * StorageProcess/StorageProcess.cpp:
2021         (WebKit::StorageProcess::swServerForSession):
2022
2023 2018-03-22  Michael Catanzaro  <mcatanzaro@igalia.com>
2024
2025         Unreviewed, fix format string warnings in service worker code
2026
2027         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
2028
2029         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2030         (WebKit::WebSWServerConnection::startFetch):
2031         (WebKit::WebSWServerConnection::didFinishFetch):
2032         (WebKit::WebSWServerConnection::didFailFetch):
2033         (WebKit::WebSWServerConnection::didNotHandleFetch):
2034
2035 2018-03-22  Daniel Bates  <dabates@apple.com>
2036
2037         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
2038         https://bugs.webkit.org/show_bug.cgi?id=183907
2039         <rdar://problem/38759127>
2040
2041         Reviewed by Alex Christensen.
2042
2043         Adds both modern Objective-C SPI and C SPI to allow an embedding client to register a scheme
2044         whose content should be displayed/loaded if and only if it can be requested. Disregarding an
2045         app that enables universal access, by using this SPI WebKit will refuse to display cross-origin
2046         content for the registered schemes.
2047
2048         We need to add C SPI for embedding clients that have not transitioned to the modern Objective-
2049         C API/SPI.
2050
2051         * Shared/WebProcessCreationParameters.cpp:
2052         (WebKit::WebProcessCreationParameters::encode const):
2053         (WebKit::WebProcessCreationParameters::decode):
2054         * Shared/WebProcessCreationParameters.h:
2055         * UIProcess/API/C/WKContext.cpp:
2056         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
2057         * UIProcess/API/C/WKContextPrivate.h:
2058         * UIProcess/API/Cocoa/WKProcessPool.mm:
2059         (-[WKProcessPool _registerURLSchemeAsCanDisplayOnlyIfCanRequest:]):
2060         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2061         * UIProcess/WebProcessPool.cpp:
2062         (WebKit::WebProcessPool::initializeNewWebProcess):
2063         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
2064         * UIProcess/WebProcessPool.h:
2065         * WebProcess/WebProcess.cpp:
2066         (WebKit::WebProcess::initializeWebProcess):
2067         (WebKit::WebProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
2068         * WebProcess/WebProcess.h:
2069         * WebProcess/WebProcess.messages.in:
2070
2071 2018-03-22  Tim Horton  <timothy_horton@apple.com>
2072
2073         Improve readability of WebCore's OTHER_LDFLAGS
2074         https://bugs.webkit.org/show_bug.cgi?id=183909
2075         <rdar://problem/38760992>
2076
2077         Reviewed by Dan Bernstein.
2078
2079         * Configurations/Base.xcconfig:
2080         * Configurations/FeatureDefines.xcconfig:
2081
2082 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
2083
2084         [TexMap] Make TextureMapperContextAttributes thread-specific
2085         https://bugs.webkit.org/show_bug.cgi?id=183895
2086
2087         Reviewed by Carlos Garcia Campos.
2088
2089         CoordinatedGraphicsScene, as an implementor of the
2090         TextureMapperPlatformLayerProxy::Compositor interface, doesn't have to
2091         implement the texmapGL() method anymore.
2092
2093         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2094         (WebKit::CoordinatedGraphicsScene::onNewBufferAvailable):
2095         (WebKit::CoordinatedGraphicsScene::texmapGL): Deleted.
2096         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2097
2098 2018-03-21  Frederic Wang  <fwang@igalia.com>
2099
2100         Unreviewed, update comment added in r229801.
2101
2102         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2103         (WebKit::FindController::didFindString): Remove "On Mobile" and mention bug 183889.
2104
2105 2018-03-21  Chris Dumez  <cdumez@apple.com>
2106
2107         Regression(r229831): ProcessSwap.Basic API test is crashing
2108         https://bugs.webkit.org/show_bug.cgi?id=183884
2109
2110         Reviewed by Brady Eidson.
2111
2112         This code should only be called for navigation policy decisions.
2113         It used to work without this check because of an early return, which
2114         was dropped in r229831.
2115
2116         * UIProcess/WebPageProxy.cpp:
2117         (WebKit::WebPageProxy::receivedPolicyDecision):
2118
2119 2018-03-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2120
2121         [Extra zoom mode] Add new SPI hooks for clients to vend an input session context view
2122         https://bugs.webkit.org/show_bug.cgi?id=183866
2123         <rdar://problem/38692256>
2124
2125         Reviewed by Tim Horton.
2126
2127         Add new SPI hooks to _WKInputDelegate allowing internal clients to provide a view that gives additional context
2128         when editing form controls, on top of the default label or placeholder text displayed by WebKit. The height
2129         delegate is invoked first, giving the client an opportunity to lay out the context view to fit the given size;
2130         the actual view is then queried.
2131
2132         If the view changes, clients may tell WebKit to reload the context view via SPI on WKFormInputSession; this call
2133         to reload is plumbed through to the currently presented list view controller (at the moment, this is only the
2134         text input list view controller).
2135
2136         * UIProcess/API/Cocoa/_WKFormInputSession.h:
2137         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2138
2139         Add the new SPI hooks, described above.
2140
2141         * UIProcess/ios/WKContentViewInteraction.h:
2142         * UIProcess/ios/WKContentViewInteraction.mm:
2143         (-[WKFormInputSession reloadFocusedElementContextView]):
2144
2145         Plumb the context view reload hook through WKContentView to WKTextInputListViewController.
2146
2147         (-[WKContentView setupInteraction]):
2148         (-[WKContentView _stopAssistingNode]):
2149         (-[WKContentView reloadContextViewForPresentedListViewController]):
2150         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2151
2152         Slight tweak to only reload text suggestions if we are not blurring the focused element. Without this extra
2153         condition, the list view controller's inner table view would get reloaded when the form input session's text
2154         suggestions are set to nil when the list view controller is dismissed, causing a visible stutter in the
2155         dismissal animation of view controller.
2156
2157 2018-03-21  Chris Dumez  <cdumez@apple.com>
2158
2159         WebKitTestRunner crashed in com.apple.WebKit: WebKit::WebProcessPool::terminateServiceWorkerProcesses
2160         https://bugs.webkit.org/show_bug.cgi?id=183875
2161
2162         Reviewed by Brent Fulgham.
2163
2164         Protect |this| while we're iterating over m_serviceWorkerProcesses and terminating
2165         each service worker process. It is possible for the WebProcess pool to get destroyed
2166         as a result of terminating a service worker process.
2167
2168         This change is covered by layout tests that are currently crashing on the ASAN bots.
2169
2170         * UIProcess/WebProcessPool.cpp:
2171         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
2172
2173 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
2174
2175         Fix typo in inactive media stream timeout default value
2176         https://bugs.webkit.org/show_bug.cgi?id=183872
2177         <rdar://problem/38723903>
2178
2179         Reviewed by Jer Noble.
2180
2181         * Shared/WebPreferences.yaml: Fix typo.
2182         * Shared/WebPreferencesDefaultValues.h: Ditto.
2183
2184 2018-03-21  Chris Dumez  <cdumez@apple.com>
2185
2186         Make policy decisions asynchronous
2187         https://bugs.webkit.org/show_bug.cgi?id=180568
2188         <rdar://problem/37131297>
2189
2190         Reviewed by Alex Christensen.
2191
2192         Get rid of synchronous IPC and synchronous code paths for policy delegates.
2193         Policy decisions are now all made asynchronously and rely on asynchronous
2194         IPC.
2195
2196         This code change is based on work by Alex Christensen.
2197
2198         * UIProcess/WebPageProxy.cpp:
2199         (WebKit::WebPageProxy::receivedPolicyDecision):
2200         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2201         (WebKit::WebPageProxy::decidePolicyForResponse):
2202         * UIProcess/WebPageProxy.h:
2203         * UIProcess/WebPageProxy.messages.in:
2204         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2205         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2206         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2207
2208 2018-03-21  Chris Dumez  <cdumez@apple.com>
2209
2210         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
2211         https://bugs.webkit.org/show_bug.cgi?id=183787
2212
2213         Reviewed by Wenson Hsieh.
2214
2215         Without asynchronous policy delegates, when the client requests a navigation, we would:
2216         1. Do a synchronous navigation policy check
2217         2. If the client allows the navigation, start the provisional load
2218
2219         Starting the provisional load would freeze the layer tree until first meaningful
2220         layout via WebFrameLoaderClient::provisionalLoadStarted() -> WebPage::didStartPageTransition().
2221
2222         When constructing a WebView and then requesting a load right away. This would make sure
2223         we do not commit a layer tree for the initial about:blank page because the layer tree
2224         would be frozen until we have something meaningful to show for the following load.
2225
2226         However, with asynchronous policy delegates, we are able to do a layer tree commit
2227         during the asynchronous navigation policy check because the layer tree is not frozen
2228         yet (provisional load has not started) and the process is not stuck on synchronous
2229         IPC. When constructing a WebView and then requesting a load right away, this would
2230         allow a layer tree commit for about:blank to happen before we've even started the
2231         load. This would cause some API tests to fail on iOS.
2232
2233         To address the issue, we try and maintain pre-existing behavior by freezing the
2234         layer tree during navigation policy decision.
2235
2236         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2237         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2238         (WebKit::WebFrameLoaderClient::didDecidePolicyForNavigationAction):
2239         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2240         * WebProcess/WebPage/WebPage.cpp:
2241         (WebKit::WebPage::didStartNavigationPolicyCheck):
2242         (WebKit::WebPage::didCompleteNavigationPolicyCheck):
2243         * WebProcess/WebPage/WebPage.h:
2244
2245 2018-03-21  Brent Fulgham  <bfulgham@apple.com>
2246
2247         Allow the WebContent process to read ViewBridge preferences
2248         https://bugs.webkit.org/show_bug.cgi?id=183862
2249         <rdar://problem/38459456>
2250
2251         Reviewed by Eric Carlson.
2252
2253         * WebProcess/com.apple.WebProcess.sb.in:
2254
2255 2018-03-21  Frederic Wang  <fwang@igalia.com>
2256
2257         [iOS] Text highlighted by the Find UI overlaps with NBC news header on google.com
2258         https://bugs.webkit.org/show_bug.cgi?id=183658
2259
2260         Reviewed by Tim Horton.
2261
2262         On Mobile, many sites have overlay headers or footers that may overlap with the highlighted
2263         text inside a scrollable overflow node. To workaround that issue, this commit changes the
2264         behavior so that the text is revealed at the center of the overflow node.
2265
2266         * WebProcess/WebPage/ios/FindControllerIOS.mm:
2267         (WebKit::FindController::didFindString): Use alignCenterAlways instead of alignToEdgeIfNeeded.
2268
2269 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2270
2271         [GTK][WPE] JSC bindings not introspectable
2272         https://bugs.webkit.org/show_bug.cgi?id=136989
2273
2274         Reviewed by Michael Catanzaro.
2275
2276         Deprecate the functions that are not introspectable due to JSC C API in GTK+ port and remove them in WPE
2277         port. Add alternative functions using the new JSC GLib API. We no longer need to keep a global context attached
2278         to every view. We can simply create a temporary global context on demand and release it after 1 second. This
2279         also allows us to remove WebPageProxy::javascriptGlobalContext() and all the related code.
2280
2281         * PlatformGTK.cmake:
2282         * PlatformWPE.cmake:
2283         * UIProcess/API/glib/WebKitJavascriptResult.cpp:
2284         (_WebKitJavascriptResult::_WebKitJavascriptResult):
2285         (webkitJavascriptResultCreate):
2286         (webkit_javascript_result_get_global_context):
2287         (webkit_javascript_result_get_value):
2288         (webkit_javascript_result_get_js_value):
2289         * UIProcess/API/glib/WebKitJavascriptResultPrivate.h:
2290         (SharedJavascriptContext::singleton):
2291         (SharedJavascriptContext::SharedJavascriptContext):
2292         (SharedJavascriptContext::getOrCreateContext):
2293         (SharedJavascriptContext::releaseContext):
2294         * UIProcess/API/glib/WebKitUserContentManager.cpp:
2295         * UIProcess/API/glib/WebKitWebView.cpp:
2296         (webkit_web_view_get_javascript_global_context):
2297         (webkitWebViewRunJavaScriptCallback):
2298         * UIProcess/API/gtk/PageClientImpl.cpp:
2299         * UIProcess/API/gtk/PageClientImpl.h:
2300         * UIProcess/API/gtk/WebKitJavascriptResult.h:
2301         * UIProcess/API/gtk/WebKitWebView.h:
2302         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2303         * UIProcess/API/wpe/APIViewClient.h:
2304         (API::ViewClient::handleDownloadRequest):
2305         * UIProcess/API/wpe/PageClientImpl.cpp:
2306         * UIProcess/API/wpe/PageClientImpl.h:
2307         * UIProcess/API/wpe/WPEView.cpp:
2308         * UIProcess/API/wpe/WPEView.h:
2309         * UIProcess/API/wpe/WebKitJavascriptResult.h:
2310         * UIProcess/API/wpe/WebKitWebView.h:
2311         * UIProcess/PageClient.h:
2312         * UIProcess/WebPageProxy.h:
2313         * UIProcess/gtk/WebPageProxyGtk.cpp:
2314         * UIProcess/wpe/WebPageProxyWPE.cpp:
2315         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
2316         (webkit_frame_get_js_context):
2317         (webkit_frame_get_js_context_for_script_world):
2318         * WebProcess/InjectedBundle/API/gtk/WebKitFrame.h:
2319         * WebProcess/InjectedBundle/API/wpe/WebKitFrame.h:
2320
2321 2018-03-21  Carlos Garcia Campos  <cgarcia@igalia.com>
2322
2323         [GTK][WPE] Initial implementation of JavaScriptCore glib bindings
2324         https://bugs.webkit.org/show_bug.cgi?id=164061
2325
2326         Reviewed by Michael Catanzaro.
2327
2328         Set decorator and deprecation_guard options in API docs config files, since they are no longer common to all
2329         libraries.
2330
2331         * PlatformGTK.cmake:
2332
2333 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2334
2335         [CoordGraphics] Simplify CoordinatedGraphicsScene activation
2336         https://bugs.webkit.org/show_bug.cgi?id=183772
2337
2338         Reviewed by Carlos Garcia Campos.
2339
2340         Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
2341         the m_isActive member variable. We don't have to call renderNextFrame()
2342         anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
2343         but that can be avoided if m_isWaitingForRenderer in that class is
2344         initialized to false.
2345
2346         CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
2347         ThreadedCompositor implementation are removed. renderNextFrame() in the
2348         CoordinatedGraphicsScene class can also be removed, along with the
2349         unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
2350         the associated m_clientRunLoop member variable.
2351
2352         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2353         (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
2354         (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
2355         (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
2356         (WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
2357         (WebKit::CoordinatedGraphicsScene::setActive): Deleted.
2358         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2359         (WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
2360         (WebKit::CoordinatedGraphicsScene::setActive):
2361         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2362         (WebKit::m_displayRefreshMonitor):
2363         (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
2364         (WebKit::ThreadedCompositor::renderNextFrame): Deleted.
2365         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2366         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2367
2368 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
2369
2370         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
2371         https://bugs.webkit.org/show_bug.cgi?id=183771
2372
2373         Reviewed by Carlos Garcia Campos.
2374
2375         In CoordinatedGraphicsScene::paintToCurrentGLContext(), retrieve
2376         information about any running animation in the scene via the
2377         TextureMapperLayer::applyAnimationsRecursively() call. Use that boolean
2378         value at the end up the method, instead of again traversing the
2379         TextureMapperLayer tree to determine whether any running animations are
2380         present.
2381
2382         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2383         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
2384
2385 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2386
2387         Enable the minimal simulator feature flag when appropriate
2388         https://bugs.webkit.org/show_bug.cgi?id=183807
2389
2390         Reviewed by Dan Bernstein.
2391
2392         * Configurations/FeatureDefines.xcconfig:
2393
2394 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
2395
2396         Expose content attributes on _WKLinkIconParameters
2397         https://bugs.webkit.org/show_bug.cgi?id=183768
2398
2399         Reviewed by Alex Christensen.
2400
2401         Added _WKLinkIconParameters.attributes to expose content attributes of a link element
2402         which defined a favicon, touch icon, or pre-compressed touch icon.
2403
2404         * UIProcess/API/Cocoa/_WKLinkIconParameters.h:
2405         (_WKLinkIconParameters.attributes): Added.
2406         * UIProcess/API/Cocoa/_WKLinkIconParameters.mm:
2407         (_WKLinkIconParameters._attributes): Added.
2408         (-[_WKLinkIconParameters _initWithLinkIcon:]): Convert the hash map from WebCore to a NSDictionary.
2409         (-[_WKLinkIconParameters attributes]): Added.
2410
2411 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2412
2413         Add AssistedNodeInformation plumbing for form control placeholder text and label text
2414         https://bugs.webkit.org/show_bug.cgi?id=183802
2415         <rdar://problem/38686273>
2416
2417         Reviewed by Tim Horton.
2418
2419         Surfaces some additional information about the currently focused element to the input delegate in the UI process.
2420         See comments below for more details.
2421
2422         Test: WebKit.FocusedElementInfo
2423
2424         * Shared/AssistedNodeInformation.cpp:
2425         (WebKit::AssistedNodeInformation::encode const):
2426         (WebKit::AssistedNodeInformation::decode):
2427         * Shared/AssistedNodeInformation.h:
2428
2429         Add `placeholder` and `label` to AssistedNodeInformation, which capture the value of the placeholder attribute
2430         and the text of the first associated label element for the focused form control. Also add boilerplate encoder/
2431         decoder support for these members.
2432
2433         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2434
2435         Augment _WKFocusedElementInfo to include placeholder and label.
2436
2437         * UIProcess/ios/WKContentViewInteraction.mm:
2438         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
2439         (-[WKFocusedElementInfo label]):
2440         (-[WKFocusedElementInfo placeholder]):
2441         * WebProcess/WebPage/ios/WebPageIOS.mm:
2442         (WebKit::WebPage::getAssistedNodeInformation):
2443
2444         For input elements and textareas, set the placeholder to the value of the placeholder attribute. For all
2445         elements with associated labels, grab the inner text of the first label that is not empty, ignoring all labels
2446         that are `display: none` (i.e. not being rendered).
2447
2448 2018-03-20  Brady Eidson  <beidson@apple.com>
2449
2450         First piece of process swapping on navigation.
2451         https://bugs.webkit.org/show_bug.cgi?id=183665
2452
2453         Reviewed by Andy Estes.
2454
2455         This patch adds the first pieces of the following feature:
2456         "When a navigation originating inside a WKWebView goes to a different origin,
2457          swap to a new WebProcess for that navigation"
2458
2459         There are significant bugs to be resolved and significant optimizations to be made.
2460         Which is why the feature is disabled by default.
2461
2462         Besides the core logic implementing the feature, this patch does a lot of related 
2463         work such as:
2464         - Removing some now-invalid ASSERTs
2465         - Adding some ASSERTs
2466         - Update various switch states to handle the new "Suspend" policy and "NavigationSwap"
2467           process termination reason
2468
2469         * NetworkProcess/NetworkDataTaskBlob.cpp:
2470         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
2471
2472         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
2473         (WebKit::NetworkCapture::NetworkDataTaskReplay::didReceiveResponse):
2474
2475         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2476         (toNSURLSessionResponseDisposition):
2477
2478         * Platform/Logging.h:
2479
2480         * Shared/LoadParameters.cpp:
2481         (WebKit::LoadParameters::encode const):
2482         (WebKit::LoadParameters::decode):
2483         * Shared/LoadParameters.h:
2484
2485         * Shared/ProcessTerminationReason.h: Add "NavigationSwap" as a process termination reason.
2486
2487         * UIProcess/API/APINavigation.h:
2488
2489         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2490         (API::ProcessPoolConfiguration::copy):
2491
2492         * UIProcess/API/C/WKAPICast.h:
2493         (WebKit::toAPI):
2494
2495         * UIProcess/Cocoa/NavigationState.mm:
2496         (WebKit::wkProcessTerminationReason):
2497
2498         * UIProcess/WebFramePolicyListenerProxy.cpp:
2499         (WebKit::WebFramePolicyListenerProxy::WebFramePolicyListenerProxy):
2500         * UIProcess/WebFramePolicyListenerProxy.h:
2501         (WebKit::WebFramePolicyListenerProxy::create):
2502         (WebKit::WebFramePolicyListenerProxy::policyListenerType const):
2503
2504         * UIProcess/WebFrameProxy.cpp:
2505         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2506         (WebKit::WebFrameProxy::activePolicyListenerProxy):
2507         * UIProcess/WebFrameProxy.h:
2508
2509         * UIProcess/WebNavigationState.cpp:
2510         (WebKit::WebNavigationState::navigation):
2511         (WebKit::WebNavigationState::takeNavigation):
2512
2513         * UIProcess/WebPageProxy.cpp:
2514         (WebKit::WebPageProxy::reattachToWebProcess):
2515         (WebKit::WebPageProxy::attachToProcessForNavigation): Pretend that the existing process 
2516           terminated using the new "NavigationSwap" reason, then manually start the next load.
2517         (WebKit::WebPageProxy::loadRequest):
2518         (WebKit::WebPageProxy::loadRequestWithNavigation):
2519         (WebKit::WebPageProxy::receivedPolicyDecision):
2520         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2521         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2522         (WebKit::WebPageProxy::decidePolicyForResponse):
2523         (WebKit::WebPageProxy::processDidTerminate):
2524         (WebKit::WebPageProxy::resetState):
2525         (WebKit::WebPageProxy::resetStateAfterProcessExited):
2526         * UIProcess/WebPageProxy.h:
2527
2528         * UIProcess/WebProcessPool.cpp:
2529         (WebKit::WebProcessPool::processForNavigation): Determine which process should be used
2530           for a proposed navigation, creating a new one if necessary.
2531         * UIProcess/WebProcessPool.h:
2532
2533         * UIProcess/WebStorage/StorageManager.cpp:
2534         (WebKit::StorageManager::SessionStorageNamespace::setAllowedConnection):
2535
2536         * WebProcess/WebPage/WebPage.cpp:
2537         (WebKit::WebPage::loadRequest):
2538
2539 2018-03-20  Youenn Fablet  <youenn@apple.com>
2540
2541         ServiceWorkerClientFetch::didReceiveData should check for m_encodedDataLength
2542         https://bugs.webkit.org/show_bug.cgi?id=183668
2543
2544         Reviewed by Chris Dumez.
2545
2546         Crash happens when releasing a RefPtr<SharedBuffer> buffer that is null.
2547         It happens because ServiceWorkerClientFetch can call m_loader->didReceiveBuffer at two different places.
2548         Either when receiving an IPC call or as part of completion handler for the response validation check.
2549         At each call site, we release the buffer to pass it to the loader and we set m_encodedLength to zero.
2550         The fix is to add the m_encodedLength check like done in the case of response validation check completion handler.
2551
2552         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
2553         (WebKit::ServiceWorkerClientFetch::didReceiveData):
2554
2555 2018-03-20  Jeff Miller  <jeffm@apple.com>
2556
2557         Expose aggressiveTileRetentionEnabled in WKPreferences SPI to match C SPI
2558         https://bugs.webkit.org/show_bug.cgi?id=183790
2559
2560         Reviewed by Alex Christensen.
2561         
2562         Expose this property on macOS only.
2563
2564         * UIProcess/API/Cocoa/WKPreferences.mm:
2565         (-[WKPreferences _setAggressiveTileRetentionEnabled:]):
2566         (-[WKPreferences _aggressiveTileRetentionEnabled]):
2567         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2568
2569 2018-03-20  Tim Horton  <timothy_horton@apple.com>
2570
2571         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
2572         https://bugs.webkit.org/show_bug.cgi?id=183758
2573         <rdar://problem/38017644>
2574
2575         Reviewed by Dan Bernstein.
2576
2577         * Configurations/FeatureDefines.xcconfig:
2578
2579 2018-03-20  Chris Dumez  <cdumez@apple.com>
2580
2581         Unreviewed, rolling out r229726 and r229763.
2582
2583         Caused some API test failures on iOS
2584
2585         Reverted changesets:
2586
2587         "Make policy decisions asynchronous"
2588         https://bugs.webkit.org/show_bug.cgi?id=180568
2589         https://trac.webkit.org/changeset/229726
2590
2591         "Rebaseline three webarchive tests for WK2 after r229726."
2592         https://bugs.webkit.org/show_bug.cgi?id=180568
2593         https://trac.webkit.org/changeset/229763
2594
2595 2018-03-20  Brent Fulgham  <bfulgham@apple.com>
2596
2597         [iOS] Grant IOKit preference access for the Home button
2598         https://bugs.webkit.org/show_bug.cgi?id=183754
2599         <rdar://problem/38179704>
2600
2601         Reviewed by Eric Carlson.
2602
2603         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2604
2605 2018-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2606
2607         [Extra zoom mode] Adopt updated input view controller machinery for text input
2608         https://bugs.webkit.org/show_bug.cgi?id=183765
2609         <rdar://problem/36926269>
2610
2611         Reviewed by Tim Horton.
2612
2613         Adopt new classes for extra zoomed text inputs. Massage WKTextInputViewController into WKTextInputListView-
2614         Controller and introduce WKFormControlListViewController, the eventual replacement for the base class
2615         WKTextFormControlViewController that will act as the base class of all list-view-controller-based input UI in
2616         extra zoom mode.
2617
2618         * UIProcess/ios/WKContentViewInteraction.h:
2619         * UIProcess/ios/WKContentViewInteraction.mm:
2620         (-[WKContentView presentTextInputViewController:]):
2621         (-[WKContentView dismissTextInputViewController:]):
2622         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2623         (-[WKContentView _wheelChangedWithEvent:]):
2624         * UIProcess/ios/forms/WKFormControlListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2625         * UIProcess/ios/forms/WKFormControlListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.mm.
2626         * UIProcess/ios/forms/WKTextInputListViewController.h: Copied from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2627         * UIProcess/ios/forms/WKTextInputListViewController.mm: Renamed from Source/WebKit/UIProcess/ios/forms/WKTextInputViewController.h.
2628         * WebKit.xcodeproj/project.pbxproj:
2629
2630 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
2631
2632         Clear style colors when setting default appearance
2633         https://bugs.webkit.org/show_bug.cgi?id=183759
2634
2635         Reviewed by Tim Horton.
2636
2637         Colors are cached and need to be cleared and recalculated.
2638
2639         * WebProcess/WebPage/WebPage.cpp:
2640         (WebKit::WebPage::setDefaultAppearance):
2641
2642 2018-03-19  Chris Dumez  <cdumez@apple.com>
2643
2644         WKWebView.ClearAppCache is a flaky API test failure on High Sierra.
2645         https://bugs.webkit.org/show_bug.cgi?id=181546
2646         <rdar://problem/36444327>
2647
2648         Reviewed by Ryosuke Niwa.
2649
2650         in LocalStorageDatabaseTracker::deleteDatabasesModifiedSince(), add origin
2651         to originIdentifiersToDelete if we cannot determine the last modification
2652         time of the database file. This likely means the database file does not
2653         exist. However, we still needs to make sure the origin gets removed from
2654         the origins database and there may be *.wal / *.shm variants of the database
2655         that are still on disk and need to be deleted.
2656
2657         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2658         (WebKit::LocalStorageDatabaseTracker::deleteDatabasesModifiedSince):
2659
2660 2018-03-19  Chris Dumez  <cdumez@apple.com>
2661
2662         Have one service worker process per security origin
2663         https://bugs.webkit.org/show_bug.cgi?id=183600
2664         <rdar://problem/35280128>
2665
2666         Reviewed by Brady Eidson.
2667
2668         Split service workers from different origins into their own processes
2669         for security reasons.
2670
2671         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
2672         (WebKit::WebSWServerConnection::startFetch):
2673         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
2674         (WebKit::WebSWServerConnection::scheduleJobInServer):
2675         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2676         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
2677         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
2678         * StorageProcess/StorageProcess.cpp:
2679         (WebKit::StorageProcess::connectionToContextProcessFromIPCConnection):
2680         (WebKit::StorageProcess::didClose):
2681         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
2682         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
2683         (WebKit::StorageProcess::didReceiveMessage):
2684         (WebKit::StorageProcess::createStorageToWebProcessConnection):
2685         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
2686         (WebKit::StorageProcess::createServerToContextConnection):
2687         * StorageProcess/StorageProcess.h:
2688         * StorageProcess/StorageProcess.messages.in:
2689         * StorageProcess/StorageToWebProcessConnection.cpp:
2690         (WebKit::StorageToWebProcessConnection::didReceiveMessage):
2691         (WebKit::StorageToWebProcessConnection::didClose):
2692         * StorageProcess/StorageToWebProcessConnection.h:
2693         * UIProcess/API/C/WKContext.cpp:
2694         (WKContextTerminateServiceWorkerProcess):
2695         * UIProcess/API/Cocoa/WKProcessPool.mm:
2696         (-[WKProcessPool _terminateServiceWorkerProcesses]):
2697         (-[WKProcessPool _webPageContentProcessCount]):
2698         (-[WKProcessPool _serviceWorkerProcessCount]):
2699         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2700         * UIProcess/Network/NetworkProcessProxy.cpp:
2701         (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
2702         (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
2703         * UIProcess/ServiceWorkerProcessProxy.cpp:
2704         (WebKit::ServiceWorkerProcessProxy::create):
2705         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
2706         * UIProcess/ServiceWorkerProcessProxy.h:
2707         (isType):
2708         * UIProcess/Storage/StorageProcessProxy.cpp:
2709         (WebKit::StorageProcessProxy::getStorageProcessConnection):
2710         (WebKit::StorageProcessProxy::didFinishLaunching):
2711         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcess):
2712         (WebKit::StorageProcessProxy::establishWorkerContextConnectionToStorageProcessForExplicitSession):
2713         * UIProcess/Storage/StorageProcessProxy.h:
2714         * UIProcess/Storage/StorageProcessProxy.messages.in:
2715         * UIProcess/WebProcessPool.cpp:
2716         (WebKit::WebProcessPool::getStorageProcessConnection):
2717         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
2718         (WebKit::WebProcessPool::createNewWebProcess):
2719         (WebKit::WebProcessPool::disconnectProcess):
2720         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
2721         (WebKit::WebProcessPool::createWebPage):
2722         (WebKit::WebProcessPool::updateServiceWorkerUserAgent):
2723         (WebKit::WebProcessPool::mayHaveRegisteredServiceWorkers):
2724         (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore):
2725         (WebKit::WebProcessPool::terminateServiceWorkerProcesses):
2726         (WebKit::WebProcessPool::updateProcessAssertions):
2727         (WebKit::WebProcessPool::serviceWorkerProcessProxyFromPageID const):
2728         * UIProcess/WebProcessPool.h:
2729         * UIProcess/WebProcessProxy.cpp:
2730         (WebKit::WebProcessProxy::getStorageProcessConnection):
2731
2732 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
2733
2734         Unreviewed, another quick fix for r229699
2735
2736         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
2737
2738         * Configurations/FeatureDefines.xcconfig:
2739
2740 2018-03-19  Chris Dumez  <cdumez@apple.com>
2741
2742         Make policy decisions asynchronous
2743         https://bugs.webkit.org/show_bug.cgi?id=180568
2744         <rdar://problem/37131297>
2745
2746         Reviewed by Alex Christensen.
2747
2748         Get rid of synchronous IPC and synchronous code paths for policy delegates.
2749         Policy decisions are now all made asynchronously and rely on asynchronous
2750         IPC.
2751
2752         This code change is based on work by Alex Christensen.
2753
2754         * UIProcess/WebPageProxy.cpp:
2755         (WebKit::WebPageProxy::receivedPolicyDecision):
2756         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2757         (WebKit::WebPageProxy::decidePolicyForResponse):
2758         * UIProcess/WebPageProxy.h:
2759         * UIProcess/WebPageProxy.messages.in:
2760         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2761         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2762         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2763
2764 2018-03-19  Brian Burg  <bburg@apple.com>
2765
2766         Web Inspector: clean up WKWebView configuration code
2767         https://bugs.webkit.org/show_bug.cgi?id=183747
2768         <rdar://problem/38629343>
2769
2770         Reviewed by Timothy Hatcher.
2771
2772         * UIProcess/mac/WKInspectorViewController.mm:
2773         (-[WKInspectorViewController webView]): Always use system
2774         appearance for Inspector's web content.
2775
2776 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
2777
2778         [Extra zoom mode] Require fullscreen for video playback
2779         https://bugs.webkit.org/show_bug.cgi?id=183742
2780         <rdar://problem/38235862>
2781
2782         Reviewed by Jer Noble.
2783
2784         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
2785         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2786         (-[WKVideoFullScreenViewController initWithAVPlayerViewController:]):
2787         (-[WKVideoFullScreenViewController viewDidLoad]):
2788         (-[WKVideoFullScreenViewController prefersStatusBarHidden]):
2789         (WebKit::VideoFullscreenModelContext::presentingViewController):
2790         (WebKit::VideoFullscreenModelContext::createVideoFullscreenViewController):
2791         * WebProcess/cocoa/VideoFullscreenManager.mm:
2792         (WebKit::VideoFullscreenManager::didEnterFullscreen):
2793
2794 2018-03-19  Daniel Bates  <dabates@apple.com>
2795
2796         test-webkitpy no longer runs WebKit2 tests
2797         https://bugs.webkit.org/show_bug.cgi?id=183724
2798
2799         Reviewed by Alexey Proskuryakov.
2800
2801         Fixes an issue where Python emits errors "global name reset_results is not defined" when
2802         running tests in messages_unittest.py using test-webkitpy.
2803
2804         Currently messages_unittest.py conditionally defines the global variable reset_results
2805         when run as the main program (i.e. __name__ == "__main__"). When messages_unittest.py is
2806         imported as a module as test-webkitpy does then it is not considered the main program
2807         ;=> the top-level script environment is not __main__ ;=> we do not define the global
2808         variable reset_results. Instead we should unconditionally define the global variable
2809         reset_results.
2810
2811         * Scripts/webkit/messages_unittest.py:
2812
2813 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
2814
2815         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
2816         https://bugs.webkit.org/show_bug.cgi?id=183604
2817         <rdar://problem/38305109>
2818
2819         Reviewed by Brent Fulgham.
2820
2821         * UIProcess/WebPageProxy.h:
2822         * UIProcess/WebPageProxy.messages.in:
2823         * UIProcess/mac/DisplayLink.cpp: Added.
2824         (WebKit::DisplayLink::DisplayLink):
2825         (WebKit::DisplayLink::~DisplayLink):
2826         (WebKit::DisplayLink::displayLinkCallback):
2827         * UIProcess/mac/DisplayLink.h: Added.
2828         * UIProcess/mac/WebPageProxyMac.mm:
2829         (WebKit::WebPageProxy::startDisplayRefreshMonitor):
2830         (WebKit::WebPageProxy::stopDisplayRefreshMonitor):
2831         * WebKit.xcodeproj/project.pbxproj:
2832         * WebProcess/WebPage/DrawingArea.cpp:
2833         (WebKit::DrawingArea::createDisplayRefreshMonitor):
2834         * WebProcess/WebPage/DrawingArea.h:
2835         * WebProcess/WebPage/DrawingArea.messages.in:
2836         * WebProcess/WebPage/mac/DrawingAreaMac.cpp: Added.
2837         (WebKit::DisplayRefreshMonitorMac::create):
2838         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
2839         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
2840         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
2841         (WebKit::DisplayRefreshMonitorMac::displayLinkFired):
2842         (WebKit::DrawingArea::screenWasRefreshed):
2843         (WebKit::DrawingArea::createDisplayRefreshMonitor):
2844
2845 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
2846
2847         [WebAuthN] Implement authenticatorMakeCredential
2848         https://bugs.webkit.org/show_bug.cgi?id=183527
2849         <rdar://problem/35275886>
2850
2851         Reviewed by Brent Fulgham.
2852
2853         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
2854         (WebKit::WebCredentialsMessengerProxy::WebCredentialsMessengerProxy):
2855         (WebKit::WebCredentialsMessengerProxy::makeCredential):
2856         (WebKit::WebCredentialsMessengerProxy::getAssertion):
2857         (WebKit::WebCredentialsMessengerProxy::isUserVerifyingPlatformAuthenticatorAvailable):
2858         (WebKit::WebCredentialsMessengerProxy::exceptionReply):
2859         (WebKit::WebCredentialsMessengerProxy::makeCredentialReply):
2860         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
2861         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
2862         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm: Removed.
2863         * WebKit.xcodeproj/project.pbxproj:
2864         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
2865         (WebKit::WebCredentialsMessenger::makeCredential):
2866         (WebKit::WebCredentialsMessenger::makeCredentialReply):
2867         * WebProcess/CredentialManagement/WebCredentialsMessenger.h:
2868         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
2869
2870 2018-03-17  Daniel Bates  <dabates@apple.com>
2871
2872         Tests fail in messages_unittest.py
2873         https://bugs.webkit.org/show_bug.cgi?id=183725
2874
2875         Partial revert of r222113. The messages generator machinery does not know when
2876         it is sufficient to emit an include for wtf/Forward.h as opposed to a concrete
2877         header.
2878
2879         * Scripts/webkit/LegacyMessages-expected.h:
2880         * Scripts/webkit/Messages-expected.h:
2881
2882 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2883
2884         Unreviewed, rolling out r229688.
2885
2886         There's a solution that doesn't require this SPI.
2887
2888         Reverted changeset:
2889
2890         "Add SPI to expose width and height anchors for WKWebView's
2891         content view"
2892         https://bugs.webkit.org/show_bug.cgi?id=183711
2893         https://trac.webkit.org/changeset/229688
2894
2895 2018-03-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2896
2897         Add SPI to expose width and height anchors for WKWebView's content view
2898         https://bugs.webkit.org/show_bug.cgi?id=183711
2899         <rdar://problem/38562899>
2900
2901         Reviewed by Tim Horton.
2902
2903         Add _contentWidthAnchor and _contentHeightAnchor SPI to WKWebView for internal clients to be able to reason
2904         about the size of the content view on iOS using autolayout.
2905
2906         Test: WebKit.AutoLayoutPositionHeaderAndFooterViewsInScrollView.
2907
2908         * UIProcess/API/Cocoa/WKWebView.mm:
2909         (-[WKWebView _contentWidthAnchor]):
2910         (-[WKWebView _contentHeightAnchor]):
2911         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2912
2913 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2914
2915         Add _useSystemAppearance to WKView
2916         https://bugs.webkit.org/show_bug.cgi?id=183706
2917         <rdar://problem/38516584>
2918
2919         Reviewed by Tim Horton.
2920
2921         Plumb useSystemAppearance and other supporting functions to WKView
2922
2923         * UIProcess/API/Cocoa/WKViewPrivate.h:
2924         * UIProcess/API/Cocoa/WKWebView.mm:
2925         (-[WKWebView _initializeWithConfiguration:]):
2926         (-[WKWebView _useSystemAppearance]):
2927         (-[WKWebView _setUseSystemAppearance:]):
2928         (-[WKWebView effectiveAppearanceDidChange]):
2929         * UIProcess/API/mac/WKView.mm:
2930         (-[WKView effectiveAppearanceDidChange]):
2931         (-[WKView _setUseSystemAppearance:]):
2932         (-[WKView _useSystemAppearance]):
2933         (-[WKView _setDefaultAppearance:]):
2934         * UIProcess/Cocoa/WebViewImpl.h:
2935         * UIProcess/Cocoa/WebViewImpl.mm:
2936         (WebKit::WebViewImpl::setUseSystemAppearance):
2937         (WebKit::WebViewImpl::useSystemAppearance):
2938         (WebKit::WebViewImpl::setDefaultAppearance):
2939
2940 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2941
2942         Set a trap to catch an infrequent form-related nullptr crash
2943         https://bugs.webkit.org/show_bug.cgi?id=183704
2944         <rdar://problem/37579354>
2945
2946         Reviewed by Ryosuke Niwa.
2947
2948         Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.
2949
2950         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2951         (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
2952
2953 2018-03-16  Jer Noble  <jer.noble@apple.com>
2954
2955         Make Fullscreen API an Experimental Feature
2956         https://bugs.webkit.org/show_bug.cgi?id=183662
2957
2958         Reviewed by Jon Lee.
2959
2960         Add the ability to have a conditional for whether an Experimental Feature is "visible", separate from
2961         whether the preference is available, for definining platform-specific Experimental Features.
2962
2963         * Scripts/GeneratePreferences.rb:
2964         * Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
2965         * Shared/WebPreferences.yaml:
2966
2967 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2968
2969         Ensure that style is updated when the effective appearance changes
2970         https://bugs.webkit.org/show_bug.cgi?id=183690
2971         <rdar://problem/38385900>
2972
2973         Reviewed by Tim Horton and Wenson Hsieh.
2974
2975         Respond to and respect the effective appearance changing.
2976
2977         * UIProcess/API/Cocoa/WKWebView.mm:
2978         (-[WKWebView effectiveAppearanceDidChange]):
2979         * WebProcess/WebPage/WebPage.cpp:
2980         (WebKit::WebPage::setDefaultAppearance):
2981
2982 2018-03-16  Chris Dumez  <cdumez@apple.com>
2983
2984         URLSchemeHandler.Basic API test fails with async policy delegates
2985         https://bugs.webkit.org/show_bug.cgi?id=183678
2986
2987         Reviewed by Alex Christensen.
2988
2989         The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
2990         on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
2991         asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
2992         for an async policy delegate.
2993
2994         * WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
2995         (WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
2996         (WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
2997         (WebKit::WebURLSchemeTaskProxy::didReceiveData):
2998         (WebKit::WebURLSchemeTaskProxy::didComplete):
2999         (WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
3000         * WebProcess/WebPage/WebURLSchemeTaskProxy.h:
3001         (WebKit::WebURLSchemeTaskProxy::queueTask):
3002
3003 2018-03-16  Claudio Saavedra  <csaavedra@igalia.com>
3004
3005         Suppress GCC warnings by using #include instead of #import
3006
3007         Unreviewed.
3008         * UIProcess/SystemPreviewController.cpp:
3009
3010 2018-03-15  Keith Rollin  <krollin@apple.com>
3011
3012         Telemetry for stalled webpage loads
3013         https://bugs.webkit.org/show_bug.cgi?id=183221
3014         <rdar://problem/36549013>
3015
3016         Reviewed by Chris Dumez.
3017
3018         Add telemetry for page loads, tracking the pages that succeed, fail,
3019         or are canceled. This information will be used to track the overall
3020         health of our page loading as time goes on.
3021
3022         * UIProcess/WebPageProxy.cpp:
3023         (WebKit::WebPageProxy::close):
3024         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3025         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3026         (WebKit::WebPageProxy::didFinishLoadForFrame):
3027         (WebKit::WebPageProxy::didFailLoadForFrame):
3028         (WebKit::WebPageProxy::reportPageLoadResult):
3029         * UIProcess/WebPageProxy.h:
3030         (WebKit::WebPageProxy::reportPageLoadResult):
3031
3032 2018-03-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3033
3034         [iOS WK2] Hit-testing fails when specifying a large top content inset
3035         https://bugs.webkit.org/show_bug.cgi?id=183648
3036         <rdar://problem/38421894>
3037
3038         Reviewed by Tim Horton.
3039
3040         Currently, in the process of computing unobscured content rect in the UI process on iOS, we subtract away parts
3041         of the view that are obscured by insets (e.g. MobileSafari's chrome). The helper method -[WKWebView
3042         _computeContentInset] is intended to compute these obscuring insets around the view, but it takes scroll view
3043         insets into account. This means that if WKWebView's inner scroll view has content insets, we'll end up shrinking
3044         the unobscured content rect as if the insetted region obscures the viewport; this causes visible content on the
3045         page to be uninteractible, since WKWebView erroneously thinks it's obscured.
3046
3047         To address this, we rename _computeContentInset to _computeObscuredInset, and make it _not_ affected by the
3048         scroll view's content insets. From code inspection and testing, all but one of the former call sites of
3049         _computeContentInset really need the obscured inset instead (see below). The one exception, -[WKWebView
3050         _adjustedContentOffset:], takes a scroll position from the page and maps it to a content offset in the inner
3051         UIScrollView (see below for more details).
3052
3053         Tests:  ScrollViewInsetTests.InnerHeightWithLargeTopContentInset
3054                 ScrollViewInsetTests.InnerHeightWithLargeBottomContentInset
3055                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash
3056                 ScrollViewInsetTests.RestoreInitialContentOffsetAfterNavigation
3057
3058         * UIProcess/API/Cocoa/WKWebView.mm:
3059         (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
3060         (-[WKWebView _initialContentOffsetForScrollView]):
3061
3062         See -_contentOffsetAdjustedForObscuredInset: below.
3063
3064         (-[WKWebView _contentOffsetAdjustedForObscuredInset:]):
3065
3066         Formerly -_adjustedContentOffset:. -_contentOffsetAdjustedForObscuredInset: no longer takes scroll view content
3067         inset into account, and only cares about insets that obscure the view. This means that the scroll position
3068         (0, 0) in the document now maps to the content offset in the inner UIScrollView, such that the top of the page
3069         is aligned with the top of the viewport.
3070
3071         However, many call sites of -_adjustedContentOffset: were intended to compute the initial, top-left-most content
3072         offset in the scroll view to scroll to when resetting the web view (i.e., they pass in CGPointZero for the
3073         scroll position). An example of this is the scroll position to jump to after web content process termination, or
3074         the scroll position after main frame navigation. In these cases, we actually want to jump to the top of the
3075         scroll view, so we do want to use the version of the computed content insets that accounts for scroll view
3076         insets.
3077
3078         Since these cases are limited to finding the top-left-most scroll position, we pull this out into a separate
3079         helper method (-_initialContentOffsetForScrollView) and replace calls to
3080         `-[self _adjustedContentOffset:CGPointZero]` with this instead.
3081
3082         (-[WKWebView _computedObscuredInset]):
3083
3084         A version of -_computeContentInset that doesn't care about scroll view insets. Used whereever we need to account
3085         for obscured insets rather than the combination of content insets and unobscured insets (e.g.
3086         -_initialContentOffsetForScrollView).
3087
3088         (-[WKWebView _processDidExit]):
3089         (-[WKWebView _didCommitLayerTree:]):
3090         (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]):
3091         (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
3092         (-[WKWebView scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
3093         (-[WKWebView _updateVisibleContentRects]):
3094         (-[WKWebView _navigationGestureDidBegin]):
3095
3096         In all these places where we inset the view bounds to compute the unobscured region of the viewport, it doesn't
3097         make sense to additionally inset by the scroll view's content insets, since (1) the scroll view's content insets
3098         don't obscure the viewport, and (2) it's perfectly valid for the inner scroll view to have arbitrarily large
3099         content insets.
3100
3101         (-[WKWebView _adjustedContentOffset:]): Deleted.
3102
3103         Renamed to -_contentOffsetAdjustedForObscuredInset:.
3104
3105         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3106         * UIProcess/ios/WKPDFView.mm:
3107         (-[WKPDFView _offsetForPageNumberIndicator]):
3108
3109         Similar to -_scrollToFragment: (see below).
3110
3111         (-[WKPDFView _scrollToFragment:]):
3112
3113         This helper figures out which content offset to scroll to, given the y-origin of a page in a PDF document. If
3114         insets are added to the scroll view, we end up scrolling to the wrong content offset since we'll add the height
3115         of the top content inset (imagine that the top content inset is enormous — then we'll scroll an amount equal to
3116         the top content inset _past_ the point where the y-origin of the page is at the top of the viewport).
3117
3118 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
3119
3120         [macOS] Correct sandbox violations during Flash playback under ToT WebKit
3121         https://bugs.webkit.org/show_bug.cgi?id=183672
3122         <rdar://problem/38510839>
3123
3124         Reviewed by Eric Carlson.
3125
3126         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3127         * WebProcess/com.apple.WebProcess.sb.in:
3128
3129 2018-03-15  Brent Fulgham  <bfulgham@apple.com>
3130
3131         REGRESSION(r229484): Plugins often require CGS Connections to draw
3132         https://bugs.webkit.org/show_bug.cgi?id=183663
3133         <rdar://problem/38439218>
3134
3135         Reviewed by Per Arne Vollan.
3136
3137         Flash requires an active CGSConnection to work properly. Since we don't want the WebContent
3138         process to have on, create a new plugin process-specific layer host creation method that
3139         gives this access.
3140
3141         * Platform/mac/LayerHostingContext.h:
3142         * Platform/mac/LayerHostingContext.mm:
3143         (WebKit::LayerHostingContext::createForExternalPluginHostingProcess): Added.
3144         * PluginProcess/mac/PluginControllerProxyMac.mm:
3145         (WebKit::PluginControllerProxy::updateLayerHostingContext): Use the new creation
3146         method.
3147
3148 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
3149
3150         [TexMap] Remove TextureMapperLayer::texture()
3151         https://bugs.webkit.org/show_bug.cgi?id=183635
3152
3153         Reviewed by Michael Catanzaro.
3154
3155         Remove the CoordinatedBackingStore::texture() override since the virtual
3156         method is also being removed.
3157
3158         * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
3159         (WebKit::CoordinatedBackingStore::texture const): Deleted.
3160         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
3161
3162 2018-03-14  John Wilander  <wilander@apple.com>
3163
3164         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
3165         https://bugs.webkit.org/show_bug.cgi?id=183641
3166         <rdar://problem/38469497>
3167
3168         Reviewed by Brent Fulgham and Chris Dumez.
3169
3170         This change is to stabilize existing layout tests by removing
3171         all storage access entries on a call to 
3172         WebResourceLoadStatisticsStore::clearInMemory().
3173         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
3174
3175         Almost all of the code changes are piping to get this
3176         call from the WebResourceLoadStatisticsStore to
3177         WebCore::NetworkStorageSession where entries reside.
3178
3179         * NetworkProcess/NetworkProcess.cpp:
3180         (WebKit::NetworkProcess::removeAllStorageAccess):
3181         * NetworkProcess/NetworkProcess.h:
3182         * NetworkProcess/NetworkProcess.messages.in:
3183         * UIProcess/Network/NetworkProcessProxy.cpp:
3184         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
3185         * UIProcess/Network/NetworkProcessProxy.h:
3186         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3187         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3188         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
3189         (WebKit::WebResourceLoadStatisticsStore::clearInMemory):
3190             Now also clears all storage access entries in the network process.
3191         * UIProcess/WebResourceLoadStatisticsStore.h:
3192         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3193         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
3194         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3195         * UIProcess/WebsiteData/WebsiteDataStore.h:
3196
3197 2018-03-14  Ryan Haddad  <ryanhaddad@apple.com>
3198
3199         Unreviewed, rolling out r229613.
3200
3201         Caused API test failures
3202
3203         Reverted changeset:
3204
3205         "Make policy decisions asynchronous"
3206         https://bugs.webkit.org/show_bug.cgi?id=180568
3207         https://trac.webkit.org/changeset/229613
3208
3209 2018-03-14  Chris Dumez  <cdumez@apple.com>
3210
3211         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
3212         https://bugs.webkit.org/show_bug.cgi?id=183626
3213
3214         Reviewed by Youenn Fablet.
3215
3216         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving
3217         towards having multiple context connections.
3218
3219         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3220         (WebKit::WebSWServerConnection::startFetch):
3221         (WebKit::WebSWServerConnection::postMessageToServiceWorker):
3222
3223 2018-03-14  Chris Dumez  <cdumez@apple.com>
3224
3225         Make policy decisions asynchronous
3226         https://bugs.webkit.org/show_bug.cgi?id=180568
3227         <rdar://problem/37131297>
3228
3229         Reviewed by Alex Christensen.
3230
3231         Get rid of synchronous IPC and synchronous code paths for policy delegates.
3232         Policy decisions are now all made asynchronously and rely on asynchronous
3233         IPC.
3234
3235         This code change is based on work by Alex Christensen.
3236
3237         * UIProcess/WebPageProxy.cpp:
3238         (WebKit::WebPageProxy::receivedPolicyDecision):
3239         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3240         (WebKit::WebPageProxy::decidePolicyForResponse):
3241         * UIProcess/WebPageProxy.h:
3242         * UIProcess/WebPageProxy.messages.in:
3243         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3244         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3245         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3246
3247 2018-03-14  Chris Dumez  <cdumez@apple.com>
3248
3249         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
3250         https://bugs.webkit.org/show_bug.cgi?id=183624
3251
3252         Reviewed by Youenn Fablet.
3253
3254         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
3255         since it was going through all SWServers. Calling workerContextProcessConnectionCreated()
3256         on every StorageToWebProcessConnection was thus doing redundant work.
3257
3258         * StorageProcess/StorageProcess.cpp:
3259         (WebKit::StorageProcess::createStorageToWebProcessConnection):
3260         * StorageProcess/StorageToWebProcessConnection.cpp:
3261         (WebKit::StorageToWebProcessConnection::establishSWServerConnection):
3262         (WebKit::StorageToWebProcessConnection::workerContextProcessConnectionCreated): Deleted.
3263         * StorageProcess/StorageToWebProcessConnection.h:
3264
3265 2018-03-14  Tim Horton  <timothy_horton@apple.com>
3266
3267         Fix the build after r229567
3268
3269         * Configurations/FeatureDefines.xcconfig:
3270
3271 2018-03-13  John Wilander  <wilander@apple.com>
3272
3273         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
3274         https://bugs.webkit.org/show_bug.cgi?id=183620
3275         <rdar://problem/38431469>
3276
3277         Reviewed by Brent Fulgham.
3278
3279         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
3280         wasn't enough to address the compatibility issues with popups. Some of
3281         them just detect their unpartitioned cookies, auto-dismiss themselves,
3282         and expect their unpartitioned cookies to be available under the opener
3283         afterwards. We should grant them access if the popup's domain has had
3284         user interaction _previously_.
3285
3286         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
3287         because if the popup's domain has not received user interaction
3288         previously, we will not grant it storage access on just the window open.
3289
3290         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3291         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
3292         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener): Deleted.
3293             Renamed WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener()
3294             to WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener()
3295             since there is now a case where access will not be granted, i.e. when
3296             the popup domain has not had user interaction previously.
3297         * UIProcess/WebResourceLoadStatisticsStore.h:
3298         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
3299              Similar renaming.
3300         * WebProcess/WebProcess.cpp:
3301         (WebProcess::WebProcess):
3302              Similar renaming.
3303
3304 2018-03-13  Jer Noble  <jer.noble@apple.com>
3305
3306         Add missing artwork for fullscreen mode.
3307         https://bugs.webkit.org/show_bug.cgi?id=183618
3308
3309         Reviewed by Jon Lee.
3310
3311         * Resources/ios/iOS.xcassets/Done.imageset/Contents.json: Added.
3312         * Resources/ios/iOS.xcassets/Done.imageset/Done.pdf: Added.
3313         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/Contents.json: Added.
3314         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@1x.png: Added.
3315         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@2x.png: Added.
3316         * Resources/ios/iOS.xcassets/StartPictureInPictureButton.imageset/StartPictureInPictureButton@3x.png: Added.
3317         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/Contents.json: Added.
3318         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@1x.png: Added.
3319         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@2x.png: Added.
3320         * Resources/ios/iOS.xcassets/StopPictureInPictureButton.imageset/StopPictureInPictureButton@3x.png: Added.
3321
3322 2018-03-13  Brian Burg  <bburg@apple.com>
3323
3324         [WK2] Web Inspector: NavigationAction for opening a link in a new tab should have a UserGestureIndicator
3325         https://bugs.webkit.org/show_bug.cgi?id=183612
3326         <rdar://problem/38388641>
3327
3328         Reviewed by Timothy Hatcher.
3329
3330         The current gesture token will be attached to the NavigationAction at construction time,
3331         so set up a UserGestureIndicator when creating the action and sending it out.
3332
3333         * WebProcess/WebPage/WebInspector.cpp:
3334         (WebKit::WebInspector::openInNewTab):
3335
3336 2018-03-13  Dean Jackson  <dino@apple.com>
3337
3338         WKSystemPreviewView needs to implement some of UIScrollViewDelegate
3339         https://bugs.webkit.org/show_bug.cgi?id=183607
3340         <rdar://problem/38427622>
3341
3342         Reviewed by Antoine Quint.
3343
3344         Add an empty implementation of scrollViewDidScroll.
3345
3346         * UIProcess/ios/WKSystemPreviewView.mm:
3347         (-[WKSystemPreviewView scrollViewDidScroll:]):
3348
3349 2018-03-13  Jiewen Tan  <jiewen_tan@apple.com>
3350
3351         Soft-link LocalAuthentication.Framework
3352         https://bugs.webkit.org/show_bug.cgi?id=183587
3353         <rdar://problem/38219763>
3354
3355         Reviewed by Brian Burg.
3356
3357         * UIProcess/CredentialManagement/cocoa/WebCredentialsMessengerProxyCocoa.mm:
3358         (WebKit::WebCredentialsMessengerProxy::platformIsUserVerifyingPlatformAuthenticatorAvailable):
3359         * WebKit.xcodeproj/project.pbxproj:
3360
3361 2018-03-12  Dean Jackson  <dino@apple.com>
3362
3363         Add a WKWebViewContentProvider for system previews
3364         https://bugs.webkit.org/show_bug.cgi?id=183582
3365         <rdar://problem/38393569>
3366
3367         Reviewed by Tim Horton.
3368
3369         Implement WKSystemPreviewView, which conforms to WKWebViewContentProvider, in
3370         order to view content as a "system preview". This effectively replaces the
3371         SystemPreviewController, which will be removed soon.
3372
3373         Some of the required methods of WKWebViewContentProvider are not necessary on
3374         this instance, so a follow-up patch will clean the protocol up a bit.
3375
3376         * UIProcess/Cocoa/NavigationState.mm: Don't trigger a SystemPreview when downloading.
3377         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3378
3379         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3380         (-[WKWebViewContentProviderRegistry init]): Register the WKSystemPreviewView for
3381         MIME types retrieved from WebKitAdditions.
3382
3383         * UIProcess/ios/WKSystemPreviewView.h: Added.
3384         * UIProcess/ios/WKSystemPreviewView.mm: Added.
3385
3386         (-[WKSystemPreviewView web_initWithFrame:webView:]):
3387         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]): This is the
3388         method that actually creates a QuickLook preview and provides the data.
3389         (-[WKSystemPreviewView web_setMinimumSize:]):
3390         (-[WKSystemPreviewView web_setOverlaidAccessoryViewsInset:]):
3391         (-[WKSystemPreviewView web_computedContentInsetDidChange]):
3392         (-[WKSystemPreviewView web_setFixedOverlayView:]):
3393         (-[WKSystemPreviewView web_didSameDocumentNavigation:]):
3394         (-[WKSystemPreviewView web_countStringMatches:options:maxCount:]):
3395         (-[WKSystemPreviewView web_findString:options:maxCount:]):
3396         (-[WKSystemPreviewView web_hideFindUI]):
3397
3398         (-[WKSystemPreviewView numberOfPreviewItemsInPreviewController:]): QuickLook delegates.
3399         (-[WKSystemPreviewView previewController:previewItemAtIndex:]):
3400         (-[WKSystemPreviewView provideDataForItem:]):
3401         (-[WKSystemPreviewView previewControllerWillDismiss:]):
3402
3403         * WebKit.xcodeproj/project.pbxproj: Add new files.
3404
3405 2018-03-12  John Wilander  <wilander@apple.com>
3406
3407         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
3408         https://bugs.webkit.org/show_bug.cgi?id=183577
3409         <rdar://problem/38266987>
3410
3411         Reviewed by Brent Fulgham.
3412
3413         * NetworkProcess/NetworkProcess.cpp:
3414         (WebKit::NetworkProcess::hasStorageAccessForFrame):
3415             Now also checks for general page access.
3416         (WebKit::NetworkProcess::grantStorageAccess):
3417             Renamed from grantStorageAccessForFrame since the frameID now is optional.
3418         (WebKit::NetworkProcess::grantStorageAccessForFrame): Deleted.
3419             Renamed since the frameID now is optional.
3420         * NetworkProcess/NetworkProcess.h:
3421             Renaming since the frameID now is optional.
3422         * NetworkProcess/NetworkProcess.messages.in:
3423             Renaming since the frameID now is optional.
3424         * NetworkProcess/NetworkResourceLoader.cpp:
3425         (WebKit::NetworkResourceLoader::logCookieInformation):
3426             Consequence of function renaming.
3427         * UIProcess/Network/NetworkProcessProxy.cpp:
3428         (WebKit::NetworkProcessProxy::grantStorageAccess):
3429         (WebKit::NetworkProcessProxy::grantStorageAccessForFrame): Deleted.
3430             Renaming since the frameID now is optional.
3431         * UIProcess/Network/NetworkProcessProxy.h:
3432         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3433         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
3434             Renaming since the frameID now is optional.
3435         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
3436             Handler renaming since the frameID now is optional.
3437         (WebKit::WebResourceLoadStatisticsStore::grantStorageAccessUnderOpener):
3438             New function for that grants cookie access under a whole page.
3439         * UIProcess/WebResourceLoadStatisticsStore.h:
3440             Member renaming since the frameID now is optional.
3441         * UIProcess/WebResourceLoadStatisticsStore.messages.in:
3442             New message received straight from WebCore::ResourceLoadObserver.
3443         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3444         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
3445             Renamed and made frameID optional.
3446         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
3447             Consequence of renaming and making frameID optional.
3448         (WebKit::WebsiteDataStore::grantStorageAccessForFrameHandler): Deleted.
3449             Renamed and made frameID optional.
3450         * UIProcess/WebsiteData/WebsiteDataStore.h:
3451         * WebProcess/WebProcess.cpp:
3452         (WebProcess::WebProcess):
3453             Now calls setGrantStorageAccessUnderOpenerCallback() on the shared
3454             WebCore::ResourceLoadObserver.
3455
3456 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3457
3458         Stop using SDK conditionals to control feature definitions
3459         https://bugs.webkit.org/show_bug.cgi?id=183430
3460         <rdar://problem/38251619>
3461
3462         Reviewed by Dan Bernstein.
3463
3464         * Configurations/FeatureDefines.xcconfig:
3465         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
3466
3467 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
3468
3469         Runtime flag for link prefetch and remove link subresource.
3470         https://bugs.webkit.org/show_bug.cgi?id=183540
3471
3472         Reviewed by Chris Dumez.
3473
3474         Remove the LINK_PREFETCH build time flag.
3475
3476         * Configurations/FeatureDefines.xcconfig:
3477         * WebProcess/Network/WebLoaderStrategy.cpp:
3478         (WebKit::maximumBufferingTime):
3479
3480 2018-03-12  Chris Dumez  <cdumez@apple.com>
3481
3482         Load may get committed before receiving policy for the resource response
3483         https://bugs.webkit.org/show_bug.cgi?id=183579
3484         <rdar://problem/38268780>
3485
3486         Reviewed by Youenn Fablet.
3487
3488         r228852 updated WebResourceLoader::didReceiveResponse to only send the
3489         ContinueDidReceiveResponse IPC back to the Networkprocess *after* the
3490         policy decision for the resource response has been made. This is necessary
3491         now that policy decisions can be made asynchronously.
3492
3493         However, one of the 2 code paths in NetworkProcess side (code path when
3494         the resource is already in the HTTP disk cache) failed to wait for the
3495         ContinueDidReceiveResponse IPC before sending over the data to the WebProcess.
3496         As a result, the WebProcess could commit the load before even receiving the
3497         policy response from the client.        
3498
3499         * NetworkProcess/NetworkResourceLoader.cpp:
3500         (WebKit::NetworkResourceLoader::continueDidReceiveResponse):
3501         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3502         (WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
3503         * NetworkProcess/NetworkResourceLoader.h:
3504         Make sure NetworkResourceLoader::didRetrieveCacheEntry() does not start sending the data
3505         until the network process gets the ContinueDidReceiveResponse IPC back from the WebProcess.
3506
3507         * WebProcess/Network/WebResourceLoader.cpp:
3508         (WebKit::WebResourceLoader::didReceiveResponse):
3509         (WebKit::WebResourceLoader::didReceiveData):
3510         * WebProcess/Network/WebResourceLoader.h:
3511         Add assertion to make sure didReceiveData() never gets called before didReceiveResponse's
3512         completion handler has been called. If this hits, then the load may get committed even
3513         though the client did not reply to the policy for the resource response yet.
3514
3515 2018-03-12  Ali Juma  <ajuma@chromium.org>
3516
3517         http/tests/workers/service/service-worker-download.https.html times out with async policy delegates
3518         https://bugs.webkit.org/show_bug.cgi?id=183479
3519
3520         Reviewed by Youenn Fablet.
3521
3522         Ensure that ServiceWorkerFetchClient::m_isCheckingResponse is set before code that depends on it
3523         executes. This bit was set by code that's posted to the runloop using 'callOnMainThread' in
3524         ServiceWorkerFetchClient::didReceiveResponse. But when didReceiveResponse is executing, tasks for
3525         handling didReceiveData, didFail, or didFinish may already have been posted to the runloop, and in
3526         that case would execute before m_isCheckingResponse gets set, and then incorrectly fail to 
3527         early-out. Fix this by directly setting m_isCheckingResponse in didReceiveResponse.
3528
3529         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3530         (WebKit::ServiceWorkerClientFetch::start):
3531         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3532
3533 2018-03-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3534
3535         REGRESSION(r211643): Dismissing WKActionSheet should not also dismiss its presenting view controller
3536         https://bugs.webkit.org/show_bug.cgi?id=183549
3537         <rdar://problem/34960698>
3538
3539         Reviewed by Andy Estes.
3540
3541         Fixes the bug by dismissing the presented view controller (i.e. the action sheet or the view controller being
3542         presented during rotation) rather than the presenting view controller.
3543
3544         Test: ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
3545
3546         * UIProcess/ios/WKActionSheet.mm:
3547         (-[WKActionSheet doneWithSheet:]):
3548
3549 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
3550
3551         Remove GridLayout runtime flag
3552         https://bugs.webkit.org/show_bug.cgi?id=183484
3553
3554         Reviewed by Myles C. Maxfield.
3555
3556         The Grid Layout feature has been enabled by default for almost a
3557         year, so I think it's time to remove the runtime flag and the
3558         codepath run when the feature is disabled.
3559
3560         * Shared/WebPreferences.yaml:
3561         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3562         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3563
3564 2018-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3565
3566         Fix the internal iOS build after r229512
3567         https://bugs.webkit.org/show_bug.cgi?id=183550
3568
3569         Reviewed by Zalan Bujtas.
3570
3571         Fixes a typo in a header import, as well as a nullability error. `SecTrustEvaluate()` takes in a nonnull outparam,
3572         which was removed in r229512; this adds the outparam back, but does not consult its value when setting the
3573         `infoDictionary`.
3574
3575         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
3576         (-[WKFullScreenWindowController _EVOrganizationName]):
3577
3578 2018-03-10  Jer Noble  <jer.noble@apple.com>
3579
3580         Improvements to fullscreen; new UI and security features
3581         https://bugs.webkit.org/show_bug.cgi?id=183503
3582
3583         Reviewed by Dean Jackson.
3584
3585         Now that the iOS Fullscreen code has more than one major class, move it into an ios/
3586         directory.
3587
3588         Clean up the WKFullScreenWindowControllerIOS class to more clearly separate external
3589         facing API from purely internal functions.
3590
3591         Move the WKFullScreenViewController out into its own file. Add support for fullscreen
3592         top inset and fullscreen autohide duration CSS constants.
3593
3594         Add a heuristic to distinguish between media control related touches and ones that look
3595         more keyboard interactions.
3596
3597         Add a new UIStackView based control to hold the fullscreen controls.
3598
3599         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm: Removed.
3600         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.cpp: Added.
3601         (WebKit::FullscreenTouchSecheuristic::scoreOfNextTouch):
3602         (WebKit::FullscreenTouchSecheuristic::reset):
3603         (WebKit::FullscreenTouchSecheuristic::distanceScore):
3604         (WebKit::FullscreenTouchSecheuristic::attenuationFactor):
3605         * UIProcess/ios/fullscreen/FullscreenTouchSecheuristic.h: 
3606         (WebKit::FullscreenTouchSecheuristic::setRampUpSpeed):
3607         (WebKit::FullscreenTouchSecheuristic::setRampDownSpeed):
3608         (WebKit::FullscreenTouchSecheuristic::setXWeight):
3609         (WebKit::FullscreenTouchSecheuristic::setYWeight):
3610         (WebKit::FullscreenTouchSecheuristic::setSize):
3611         (WebKit::FullscreenTouchSecheuristic::setGamma):
3612         (WebKit::FullscreenTouchSecheuristic::setGammaCutoff):
3613         * UIProcess/ios/fullscreen/WKFullScreenViewController.h:
3614         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm: Added.
3615         (WKFullScreenViewControllerPlaybackSessionModelClient::setParent):
3616         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
3617         (-[_WKExtrinsicButton setExtrinsicContentSize:]):
3618         (-[_WKExtrinsicButton intrinsicContentSize]):
3619         (-[WKFullScreenViewController initWithWebView:]):
3620         (-[WKFullScreenViewController dealloc]):
3621         (-[WKFullScreenViewController showUI]):
3622         (-[WKFullScreenViewController hideUI]):
3623         (-[WKFullScreenViewController videoControlsManagerDidChange]):
3624         (-[WKFullScreenViewController setPrefersStatusBarHidden:]):
3625         (-[WKFullScreenViewController setPlaying:]):
3626         (-[WKFullScreenViewController setPictureInPictureActive:]):
3627         (-[WKFullScreenViewController loadView]):
3628         (-[WKFullScreenViewController viewWillAppear:]):
3629         (-[WKFullScreenViewController viewDidLayoutSubviews]):
3630         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
3631         (-[WKFullScreenViewController preferredStatusBarStyle]):
3632         (-[WKFullScreenViewController prefersStatusBarHidden]):
3633         (-[WKFullScreenViewController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3634         (-[WKFullScreenViewController gestureRecognizer:shouldReceiveTouch:]):
3635         (-[WKFullScreenViewController _manager]):
3636         (-[WKFullScreenViewController _effectiveFullscreenInsetTop]):
3637         (-[WKFullScreenViewController _cancelAction:]):
3638         (-[WKFullScreenViewController _togglePiPAction:]):
3639         (-[WKFullScreenViewController _touchDetected:]):
3640         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
3641         (-[WKFullScreenViewController _updateWebViewFullscreenInsets]):
3642         (-[WKFullScreenViewController _showPhishingAlert]):
3643         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h: Copied from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
3644         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: Added.
3645         (WebKit::replaceViewWithView):
3646         (WebKit::WKWebViewState::applyTo):
3647         (WebKit::WKWebViewState::store):
3648         (-[WKFullscreenAnimationController transitionDuration:]):
3649         (-[WKFullscreenAnimationController configureInitialAndFinalStatesForTransition:]):
3650         (-[WKFullscreenAnimationController animateTransition:]):
3651         (-[WKFullscreenAnimationController animationEnded:]):
3652         (-[WKFullscreenAnimationController startInteractiveTransition:]):
3653         (-[WKFullscreenAnimationController updateWithPercent:]):
3654         (-[WKFullscreenAnimationController updateWithPercent:translation:anchor:]):
3655         (-[WKFullscreenAnimationController end:]):
3656         (-[WKFullScreenInteractiveTransition initWithAnimator:anchor:]):
3657         (-[WKFullScreenInteractiveTransition wantsInteractiveStart]):
3658         (-[WKFullScreenInteractiveTransition startInteractiveTransition:]):
3659         (-[WKFullScreenInteractiveTransition updateInteractiveTransition:withTranslation:]):
3660         (-[WKFullScreenInteractiveTransition cancelInteractiveTransition]):
3661         (-[WKFullScreenInteractiveTransition finishInteractiveTransition]):
3662         (-[WKFullScreenWindowController initWithWebView:]):
3663         (-[WKFullScreenWindowController dealloc]):
3664         (-[WKFullScreenWindowController isFullScreen]):
3665         (-[WKFullScreenWindowController webViewPlaceholder]):
3666         (-[WKFullScreenWindowController enterFullScreen]):
3667         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
3668         (-[WKFullScreenWindowController requestExitFullScreen]):
3669         (-[WKFullScreenWindowController exitFullScreen]):
3670         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
3671         (-[WKFullScreenWindowController _completedExitFullScreen]):
3672         (-[WKFullScreenWindowController close]):
3673         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
3674         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
3675         (-[WKFullScreenWindowController gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
3676         (-[WKFullScreenWindowController animationControllerForPresentedController:presentingController:sourceController:]):
3677         (-[WKFullScreenWindowController animationControllerForDismissedController:]):
3678         (-[WKFullScreenWindowController interactionControllerForDismissal:]):
3679         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
3680         (-[WKFullScreenWindowController _invalidateEVOrganizationName]):
3681         (-[WKFullScreenWindowController _isSecure]):
3682         (-[WKFullScreenWindowController _serverTrust]):
3683         (-[WKFullScreenWindowController _EVOrganizationName]):
3684         (-[WKFullScreenWindowController _updateLocationInfo]):
3685         (-[WKFullScreenWindowController _manager]):
3686         (-[WKFullScreenWindowController _startToDismissFullscreenChanged:]):
3687         (-[WKFullScreenWindowController _interactiveDismissChanged:]):
3688         * UIProcess/ios/fullscreen/WKFullscreenStackView.h: Renamed from Source/WebKit/UIProcess/ios/WKFullScreenWindowControllerIOS.h.
3689         * UIProcess/ios/fullscreen/WKFullscreenStackView.mm: Added.
3690         (+[WKFullscreenStackView baseEffects]):
3691         (+[WKFullscreenStackView configureView:forTintEffectWithColor:filterType:]):
3692         (+[WKFullscreenStackView configureView:withBackgroundFillOfColor:opacity:filter:]):
3693         (+[WKFullscreenStackView secondaryMaterialOverlayView]):
3694         (+[WKFullscreenStackView applyPrimaryGlyphTintToView:]):
3695         (+[WKFullscreenStackView applySecondaryGlyphTintToView:]):
3696         (-[WKFullscreenStackView initWithArrangedSubviews:axis:]):
3697         (-[WKFullscreenStackView setTargetViewForSecondaryMaterialOverlay:]):
3698         (-[WKFullscreenStackView contentView]):
3699         (-[WKFullscreenStackView _setArrangedSubviews:axis:]):
3700         (-[WKFullscreenStackView setBounds:]):
3701         (-[WKFullscreenStackView updateConstraints]):
3702         * WebKit.xcodeproj/project.pbxproj:
3703
3704 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
3705
3706         Media query for default appearance
3707         https://bugs.webkit.org/show_bug.cgi?id=183539
3708         <rdar://problem/38326388>
3709
3710         Reviewed by Tim Horton.
3711
3712         Write a media query to evaluate appearance.
3713
3714         * Shared/WebPageCreationParameters.cpp:
3715         (WebKit::WebPageCreationParameters::encode const):
3716         (WebKit::WebPageCreationParameters::decode):
3717         * Shared/WebPageCreationParameters.h:
3718         * UIProcess/API/Cocoa/WKWebView.mm:
3719         (-[WKWebView _initializeWithConfiguration:]):
3720         (-[WKWebView _setUseSystemAppearance:]):
3721         * UIProcess/WebPageProxy.cpp:
3722         (WebKit::WebPageProxy::creationParameters):
3723         (WebKit::WebPageProxy::setDefaultAppearance):
3724         * UIProcess/WebPageProxy.h:
3725         (WebKit::WebPageProxy::defaultAppearance const):
3726         * WebProcess/WebPage/WebPage.cpp:
3727         (WebKit::m_credentialsMessenger):
3728         (WebKit::WebPage::setDefaultAppearance):
3729         * WebProcess/WebPage/WebPage.h:
3730         * WebProcess/WebPage/WebPage.messages.in:
3731
3732 2018-03-09  Jer Noble  <jer.noble@apple.com>
3733
3734         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
3735         https://bugs.webkit.org/show_bug.cgi?id=183501
3736         <rdar://problem/38312038>
3737
3738         Unreviewed build fix; add correct pragmas to code referencing m_playbackSessionManager.
3739
3740         * UIProcess/WebPageProxy.cpp:
3741         (WebKit::WebPageProxy::hasActiveVideoForControlsManager const):
3742         (WebKit::WebPageProxy::requestControlledElementID const):
3743         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
3744
3745 2018-03-09  Brian Burg  <bburg@apple.com>
3746
3747         Web Inspector: there should only be one way for async backend commands to send failure
3748         https://bugs.webkit.org/show_bug.cgi?id=183524
3749
3750         Reviewed by Timothy Hatcher.
3751
3752         Remove useless ErrorString argument from async commands.
3753
3754         For Automation protocol, introduce sync and async macros for filling
3755         in and sending a failure response. Now that async commands don't have
3756         an ErrorString and sync commands don't have a callback, trying to send
3757         an error with the wrong macro is a compile-time error.
3758
3759         * UIProcess/Automation/WebAutomationSession.cpp:
3760         (WebKit::WebAutomationSession::getBrowsingContexts):
3761         (WebKit::WebAutomationSession::getBrowsingContext):
3762         (WebKit::WebAutomationSession::createBrowsingContext):
3763         (WebKit::WebAutomationSession::closeBrowsingContext):
3764         (WebKit::WebAutomationSession::switchToBrowsingContext):
3765         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
3766         (WebKit::WebAutomationSession::waitForNavigationToComplete):
3767         (WebKit::WebAutomationSession::navigateBrowsingContext):
3768         (WebKit::WebAutomationSession::goBackInBrowsingContext):
3769         (WebKit::WebAutomationSession::goForwardInBrowsingContext):
3770         (WebKit::WebAutomationSession::reloadBrowsingContext):
3771         (WebKit::WebAutomationSession::evaluateJavaScriptFunction):
3772         (WebKit::WebAutomationSession::resolveChildFrameHandle):
3773         (WebKit::WebAutomationSession::resolveParentFrameHandle):
3774         (WebKit::WebAutomationSession::computeElementLayout):
3775         (WebKit::WebAutomationSession::selectOptionElement):
3776         (WebKit::WebAutomationSession::isShowingJavaScriptDialog):
3777         (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog):
3778         (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog):
3779         (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog):
3780         (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
3781         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
3782         (WebKit::WebAutomationSession::getAllCookies):
3783         (WebKit::WebAutomationSession::deleteSingleCookie):
3784         (WebKit::WebAutomationSession::addSingleCookie):
3785         (WebKit::WebAutomationSession::deleteAllCookies):
3786         (WebKit::WebAutomationSession::setSessionPermissions):
3787         (WebKit::WebAutomationSession::performMouseInteraction):
3788         (WebKit::WebAutomationSession::performKeyboardInteractions):
3789         (WebKit::WebAutomationSession::takeScreenshot):
3790         (WebKit::WebAutomationSession::didTakeScreenshot):
3791         * UIProcess/Automation/WebAutomationSession.h:
3792         * UIProcess/Automation/WebAutomationSessionMacros.h:
3793         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
3794         (WebKit::WebAutomationSession::inspectBrowsingContext):
3795
3796 2018-03-09  Jer Noble  <jer.noble@apple.com>
3797
3798         Don't pass NULL to the result parameter of SecTrustEvaluate()
3799         https://bugs.webkit.org/show_bug.cgi?id=183495
3800         <rdar://problem/38185688>
3801
3802         Reviewed by Andy Estes.
3803
3804         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
3805         (-[WKFullScreenWindowController _EVOrganizationName]):
3806
3807 2018-03-09  Dean Jackson  <dino@apple.com>
3808
3809         Allow NavigationState to intercept requests and send them to SystemPreviewController
3810         https://bugs.webkit.org/show_bug.cgi?id=183526
3811         <rdar://problem/37801140>
3812
3813         Reviewed by Tim Horton.
3814
3815         Implement a bit more of SystemPreviewController, such that it can be used
3816         from NavigationState to identify and handle content that can be previewed.
3817
3818         * UIProcess/Cocoa/NavigationState.mm:
3819         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3820             If we'd in a download response policy, then check if SystemPreviewController
3821             can show the content. We ignore the download, but pass the original URL onto
3822             the preview. Ultimately, we'd want to avoid the navigation
3823             but use the download destination URL for preview.
3824
3825         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3826         (-[_WKPreviewControllerDataSource initWithURL:]):
3827             Move the URL to property, to help use a single datasource object for all previews.
3828         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3829         (-[_WKPreviewControllerDelegate initWithSystemPreviewController:]):
3830             Add a delegate object, so we can detect when the preview is dismissed and return
3831             to the previous page.
3832         (-[_WKPreviewControllerDelegate previewControllerWillDismiss:]):
3833         (WebKit::SystemPreviewController::showPreview):
3834             Use single instances of the QLPreviewController, its datasource and delegate.
3835
3836         * UIProcess/SystemPreviewController.cpp:
3837             Add a helper to navigate back.
3838         (WebKit::SystemPreviewController::SystemPreviewController):
3839         (WebKit::SystemPreviewController::sendPageBack):
3840         * UIProcess/SystemPreviewController.h:
3841
3842 2018-03-09  Jer Noble  <jer.noble@apple.com>
3843
3844         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
3845         https://bugs.webkit.org/show_bug.cgi?id=183383
3846         <rdar://problem/38197028>
3847
3848         Reviewed by Eric Carlson.
3849
3850         Follow-up patch: now that the 'fullscreenchange' event is being fired slightly earlier, the
3851         Fullscreen.TopContentInset tests triggers what appears to be an existing behavior: if you
3852         exit in the middle of an enter fullscreen animation, the exit never happens, because the
3853         NSWindow never starts the exit animation. The solution is to store the exit fullscreen
3854         request, and only act upon it when the enter animation completes.
3855
3856         * UIProcess/mac/WKFullScreenWindowController.h:
3857         * UIProcess/mac/WKFullScreenWindowController.mm:
3858         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
3859         (-[WKFullScreenWindowController exitFullScreen]):
3860
3861 2018-03-09  Jer Noble  <jer.noble@apple.com>
3862
3863         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
3864         https://bugs.webkit.org/show_bug.cgi?id=183501
3865
3866         Reviewed by Eric Carlson.
3867
3868         No reason for these methods to be PLATFORM(MAC) only.
3869
3870         * UIProcess/API/Cocoa/WKWebView.mm:
3871         (-[WKWebView _videoControlsManagerDidChange]):
3872         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3873         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
3874         (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID):
3875         (WebKit::PlaybackSessionManagerProxy::clearPlaybackControlsManager):
3876         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3877         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3878         * UIProcess/PageClient.h:
3879         * UIProcess/WebPageProxy.cpp:
3880         (WebKit::WebPageProxy::isPlayingMediaDidChange):
3881         (WebKit::WebPageProxy::handleControlledElementIDResponse const):
3882         (WebKit::WebPageProxy::isPlayingVideoInEnhancedFullscreen const):
3883         * UIProcess/WebPageProxy.h:
3884         * UIProcess/ios/PageClientImplIOS.h:
3885         * UIProcess/ios/PageClientImplIOS.mm:
3886         (WebKit::PageClientImpl::videoControlsManagerDidChange):
3887         * UIProcess/ios/WKFullScreenWindowControllerIOS.h:
3888         * UIProcess/ios/WKFullScreenWindowControllerIOS.mm:
3889         (-[WKFullScreenWindowController videoControlsManagerDidChange]):
3890         * WebProcess/cocoa/PlaybackSessionManager.mm:
3891         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
3892
3893 2018-03-09  Per Arne Vollan  <pvollan@apple.com>
3894
3895         Create CA layer contexts with +remoteContextWithOptions.
3896         https://bugs.webkit.org/show_bug.cgi?id=182747
3897
3898         Reviewed by Brent Fulgham.
3899
3900         CA layer contexts (CAContext) are currently created with +contextWithCGSConnection, which is
3901         using the main WindowServer connection to create the context. Instead, the contexts can be
3902         created with +remoteContextWithOptions, which does not use the main WindowServer connection.
3903         This is a step towards limiting the access the WebContent process has to the window server.
3904         To make the +remoteContextWithOptions call succeed, the sandbox has to be modified to allow
3905         access to CARenderServer. Also, access to the WindowServer should be denied by calling
3906         CGSSetDenyWindowServerConnections(true) before entering the sandbox. This is planned to do
3907         in a follow-up patch. The call to +remoteContextWithOptions will open up WindowServer
3908         connections, since the WindowServer is the system default CA render server, but these
3909         connections come with limited WindowServer exposure. In addition, we need to open up the
3910         sandbox for accessing some IOKit properties.
3911
3912         * Platform/mac/LayerHostingContext.mm:
3913         (WebKit::LayerHostingContext::createForExternalHostingProcess):
3914         * Shared/mac/HangDetectionDisablerMac.mm:
3915         (WebKit::setClientsMayIgnoreEvents):
3916         * WebProcess/com.apple.WebProcess.sb.in:
3917
3918 2018-03-09  Brent Fulgham  <bfulgham@apple.com>
3919
3920         Remove cookie API access from WebContent Process
3921         https://bugs.webkit.org/show_bug.cgi?id=183519
3922         <rdar://problem/35368802>
3923
3924         Reviewed by Alex Christensen.
3925
3926         All cookie access is now handled in the Network Process. However, there are vestiges of the original logic that used CFNetwork APIs in the WebContent process.
3927
3928         This patch removes CFNetwork calls from the WebProcess code paths, since they serve no purpose in modern WebKit.
3929
3930         No tests because this is a code cleanup with no expected change in behavior.
3931
3932         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
3933         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Moved from WebFrameNetworkingContext.
3934         * NetworkProcess/NetworkProcess.h:
3935         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3936         (WebKit::NetworkProcess::setSharedHTTPCookieStorage): Moved from ChildProcess, since this should only be
3937         called in the NetworkProcess.
3938         * Shared/ChildProcess.h:
3939         * Shared/mac/ChildProcessMac.mm:
3940         (WebKit::ChildProcess::setSharedHTTPCookieStorage): Deleted.
3941         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
3942         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3943         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Remove CFNetwork code. This version of
3944         'ensureWebsiteDataStoreSession' is needed to maintain a dictionary on the WebProcess side so we can refer to
3945         the same network session in both the WebContent and Network processes.
3946         (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
3947         (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
3948         * WebProcess/cocoa/WebProcessCocoa.mm:
3949         (WebKit::WebProcess::platformInitializeWebProcess): Remove calls to CFNetwork.
3950
3951 2018-03-09  Youenn Fablet  <youenn@apple.com>
3952
3953         ServiceWorkerClientFetch should send data to its resource loader once the didReceiveResponse completion handler is called
3954         https://bugs.webkit.org/show_bug.cgi?id=183110
3955
3956         Reviewed by Chris Dumez.
3957
3958         Buffering data/finish event/fail event until the response completion handler is called.
3959
3960         * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
3961         (WebKit::ServiceWorkerClientFetch::didReceiveResponse):
3962         (WebKit::ServiceWorkerClientFetch::didReceiveData):
3963         (WebKit::ServiceWorkerClientFetch::didFinish):
3964         (WebKit::ServiceWorkerClientFetch::didFail):
3965         (WebKit::ServiceWorkerClientFetch::didNotHandle):
3966         (WebKit::ServiceWorkerClientFetch::cancel):
3967         (WebKit::ServiceWorkerClientFetch::continueLoadingAfterCheckingResponse):
3968         * WebProcess/Storage/ServiceWorkerClientFetch.h:
3969
3970 2018-03-09  Jer Noble  <jer.noble@apple.com>
3971
3972         Add new CSS env constants for use with fullscreen
3973         https://bugs.webkit.org/show_bug.cgi?id=183498
3974
3975         Reviewed by Dean Jackson.
3976
3977         Pass the values given to WebFullScreenManagerProxy through the process boundary and
3978         into WebCore.
3979
3980         * UIProcess/WebFullScreenManagerProxy.cpp:
3981         (WebKit::WebFullScreenManagerProxy::setFullscreenInsetTop):
3982         (WebKit::WebFullScreenManagerProxy::setFullscreenAutoHideDelay):
3983         * UIProcess/WebFullScreenManagerProxy.h:
3984         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3985         (WebKit::WebFullScreenManager::didExitFullScreen):
3986         (WebKit::WebFullScreenManager::setFullscreenInsetTop):
3987         (WebKit::WebFullScreenManager::setFullscreenAutoHideDelay):
3988         * WebProcess/FullScreen/WebFullScreenManager.h:
3989         * WebProcess/FullScreen/WebFullScreenManager.messages.in: